GNOME Bugzilla – Bug 710501
wrong graphics rendering on gtk-3.10 osx with retina display
Last modified: 2016-03-23 15:42:25 UTC
there are several issues in one, but i decided to file them in one, because i'm not sure if they are caused by different things.
1. i compiled gtk-3.10.1 using jhbuild modules-stable, osx 10.8.5, xcode 5
2. i have macbookpro with retina 220 ppi
3. i've tested stuff in my own app deadbeef, but also double checked with gtktest
now the issues:
1. toolbar is twice bigger than it should be, while the toolbar button icons are using the low resolution, and stretched to approximately 4x of their source size. this is different from gtk 3.6 behaviour, where the toolbar size was correct. another difference here is that icons use high quality resizing, while in 3.6 they were not using filtering. still they look very bad.
2. in custom widgets, which render their content using cairo, all raster graphics are pixelized, even if their source resolution is HDPI. all vector graphics and text look correct.
3. in standard GtkTreeView with GtkCellRendererText, all text is pixelized (2x), the same happens in GtkTextView. this doesn't happen e.g. in labels and buttons.
4. in the notification area, the application icon doesn't fit in the panel, and is 2x pixelized, even though high res icon is present in the icon theme folder.
i will attach the relevant screenshots shortly.
Created attachment 257692 [details]
Toolbar icons wrong size
Created attachment 257693 [details]
images in custom widgets are pixelized
Created attachment 257694 [details]
notification area icon doesn't fit and pixelized
Created attachment 257695 [details]
GtkTextView text is pixelized
Created attachment 257696 [details]
GtkTreeView is pixelized
I have the same issues when compiling bluefish using gtk+3.10.
Just few more observations:
1. Not only toolbar icons are twice the size, all images are larger twice. This causes interface look weird when widgets are trying to accomodate oversized graphics.
2. Compiling bluefish with gtk+3.9.6 gave back normal icon sizes and good looking text in GtkTextView. However, text in GtkTreeView is still pixelized.
I have noticed that both GtkTreeView and GtkTextView some time ago were ported to use GtkPixelCache. This might have caused this behavior. To make sure one would need to try to compare 3.9.12 and 3.9.14 versions...
Created attachment 268175 [details] [review]
patch: always return scalefactor of 1 for icons (proof of concept fix for retina)
adding a patch which fixes oversized icons
the code inside GdkQuartzScreen does:
scale_factor = [(id <ScaleFactor>) nsscreen backingScaleFactor];
but if Quartz is already scaling up surfaces then we should not be doing this.
alternatively, we need to find a way to opt out of the automatic scaling done by Quartz, so that we can apply our own scaling.
there's also the question whether Cairo supports per-device scaling on Quartz surfaces.
Adding Mitch to CC, he once did some retina debugging. From what I remember, things mostly worked fine with the 2.x branch.
The pixelation in GtkTextView/GtkTreeView seems to be caused by the pixel cache. Setting GTK_DEBUG=no-pixel-cache makes things work here.
I converted my project to use Cocoa on OSX, so this bug is no longer a problem to me, and can be closed.
(In reply to Alexey Yakovenko from comment #11)
> I converted my project to use Cocoa on OSX, so this bug is no longer a
> problem to me, and can be closed.
Even if it's not a problem for you, it's still a bug.
I think pixel cache breakage is due to https://bugs.freedesktop.org/show_bug.cgi?id=69796
As all my other uses of surface_create_similar() are pixelated as well.
*** Bug 758338 has been marked as a duplicate of this bug. ***
This should be fixed now: https://git.gnome.org/browse/gtk+/commit/?id=3f077ec36f4a59e803c9f4509996269c862e04af