Community
Participate
Working Groups
Remove auto scaling of coordinates and sizes in the non cairo scaling path. Currently we are using cairo for image operations we don't use non cairo scale path now. Its better to remove that path
Created attachment 284917 [details] Screenshots with different desktop environments
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/172943
Created attachment 285012 [details] Modified snippet used for performance test
Created attachment 285019 [details] Fixed snippet for perf testing I have updated the snippet to do proper testing: 1) Added warmup iterations 2) Multiple iterations are measured and averaged 3) SWT.TOOL style is added to avoid focus switches between applications 4) Things are properly cleaned between iterations With these changes, also running on top of Bug 569647, I see 0.10 sec both with and without patch. I conclude that performance difference, if any, is hard to measure.
(In reply to Alexandr Miloslavskiy from comment #4) > Created attachment 285019 [details] > Fixed snippet for perf testing > > I have updated the snippet to do proper testing: > 1) Added warmup iterations > 2) Multiple iterations are measured and averaged > 3) SWT.TOOL style is added to avoid focus switches between applications > 4) Things are properly cleaned between iterations > > With these changes, also running on top of Bug 569647, I see 0.10 sec both > with and without patch. I conclude that performance difference, if any, is > hard to measure. If there is not performance improvement this this patch will become cleanup patch. lets target this in 4.24 when ubuntu 18.04 will become nearly obsolete. Thank you for your review
OK, this sounds reasonable. I wonder if the problem on 18.04 can be fixed without much pain? The simplest change could be to use this formula for DPI: gdk_monitor_get_scale_factor() * gdk_screen_get_resolution() / 96.0 This may already be enough for most cases.
Can you create a patch. I will do the requisite testing.
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/bundles/org.eclipse.swt/Eclipse%20SWT/gtk/org/eclipse/swt/graphics/Device.java#n688 is the location where we determine the dpi and select whether to scale all method or use cairo scaling method. Can you try passing gdk_monitor_get_scale_factor() * gdk_screen_get_resolution() * 100/ 96.0 to DPIUtil.setDeviceZoom method?
Was on vacation, will hopefully try it this or next week.
I found that the old branch in 'Device.getDeviceZoom()' already does exactly that. This explains why things briefly worked fine on KUbuntu 18.04 before Bug 539392. However, since then, it was broken again in a series of various hacks. What needs to be done on systems like KUbuntu 18.04 is: 1) Don't scale Controls and Fonts This is kind of similar to 'DPIUtil.setUseCairoAutoScale(true)'. Also, Controls should observe that their DPI matches DPI of screen. 2) Scale Images. It seems that existing SWT hacks can't cover this combination.