[gtk-osx] Fix gtk+2 breakage on retina introduced by the recent hidpi fixes.
- From: John Ralls <jralls src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-osx] Fix gtk+2 breakage on retina introduced by the recent hidpi fixes.
- Date: Thu, 17 Mar 2016 23:33:13 +0000 (UTC)
commit 8e0a0332fb8f8b233ca05c2223296cab801d95f4
Author: Christoph Reiter <reiter christoph gmail com>
Date: Wed Mar 16 20:19:08 2016 +0100
Fix gtk+2 breakage on retina introduced by the recent hidpi fixes.
The cairo changes introduced in a3826210aa38d15f for fixing
hidpi with gtk+3 broke gtk+2 in retina/hidpie mode.
Make it a gtk+3 only fix so gtk+2 isn't affected.
The new patch is also filed upstream:
https://bugzilla.gnome.org/show_bug.cgi?id=763779
https://bugzilla.gnome.org/show_bug.cgi?id=763269
modulesets-stable/gtk-osx.modules | 10 +--
patches/cairo-hidpi.patch | 37 -----------
...pixelated-image-surfaces-in-retina-hidpi-.patch | 65 ++++++++++++++++++++
patches/gtk3-hidpi.patch | 41 ------------
4 files changed, 69 insertions(+), 84 deletions(-)
---
diff --git a/modulesets-stable/gtk-osx.modules b/modulesets-stable/gtk-osx.modules
index f578fd6..fb8b140 100644
--- a/modulesets-stable/gtk-osx.modules
+++ b/modulesets-stable/gtk-osx.modules
@@ -188,8 +188,8 @@
<branch module="gtk+/3.14/gtk+-3.14.15.tar.xz" version="3.14.15"
hash="sha256:3ac87659112ced9e5ee5bd55d055faa881aafd040f26ca40b0d8ba0fa6509c83">
<patch
file="http://git.gnome.org/browse/gtk-osx/plain/patches/0001-Bug-707945-GTK2-Quartz-typeahead-find-in-GtkTreeView.patch"
strip="1"/>
- <!-- https://bugzilla.gnome.org/show_bug.cgi?id=740199#c4 -->
- <patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/gtk3-hidpi.patch" strip="1"/>
+ <!-- https://bugzilla.gnome.org/show_bug.cgi?id=763779 -->
+ <patch
file="http://git.gnome.org/browse/gtk-osx/plain/patches/gtk-quartz-fix-pixelated-image-surfaces-in-retina-hidpi-.patch"
strip="1"/>
</branch>
<dependencies>
<dep package="glib"/>
@@ -208,8 +208,8 @@
autogenargs="--enable-quartz-backend --enable-quartz-relocation">
<branch module="gtk+/3.16/gtk+-3.16.7.tar.xz" version="3.16.7"
hash="sha256:19689d14de54d182fad538153dbff6d41f53841f940aa871585fdea0306c7fba">
- <!-- https://bugzilla.gnome.org/show_bug.cgi?id=740199#c4 -->
- <patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/gtk3-hidpi.patch" strip="1"/>
+ <!-- https://bugzilla.gnome.org/show_bug.cgi?id=763779 -->
+ <patch
file="http://git.gnome.org/browse/gtk-osx/plain/patches/gtk-quartz-fix-pixelated-image-surfaces-in-retina-hidpi-.patch"
strip="1"/>
</branch>
<dependencies>
<dep package="glib"/>
@@ -243,8 +243,6 @@
<branch module="cairo-1.14.0.tar.xz" version="1.14.0"
repo="cairographics"
hash="sha1:53cf589b983412ea7f78feee2e1ba9cea6e3ebae">
- <!-- https://bugs.freedesktop.org/show_bug.cgi?id=69796#c4 -->
- <patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/cairo-hidpi.patch" strip="1"/>
</branch>
<dependencies>
<dep package="pixman"/>
diff --git a/patches/gtk-quartz-fix-pixelated-image-surfaces-in-retina-hidpi-.patch
b/patches/gtk-quartz-fix-pixelated-image-surfaces-in-retina-hidpi-.patch
new file mode 100644
index 0000000..de02320
--- /dev/null
+++ b/patches/gtk-quartz-fix-pixelated-image-surfaces-in-retina-hidpi-.patch
@@ -0,0 +1,65 @@
+From 2a46cc3633069fada208fccee686b7232db40af5 Mon Sep 17 00:00:00 2001
+From: Christoph Reiter <creiter src gnome org>
+Date: Wed, 16 Mar 2016 19:25:30 +0100
+Subject: [PATCH] quartz: fix pixelated image surfaces in retina/hidpi mode
+
+gtk+ currently depends on the scaling factor and the cairo device scale
+of both the backend surfaces and image surfaces to be equal.
+
+Until now we didn't apply a cairo device scale at all and depended on the
+automatic scaling of CGContexts. This works when drawing with cairo but
+fails in case of image surfaces, which get requested at a too small size.
+
+To make the quartz backend behave more like the X11 one, set the cairo device
+scale on the surface in gdk_quartz_ref_cairo_surface(). As this conflicts
+with the default scaling done by CGContext (we would get double scaling)
+undo the CGContext scaling using CGContextScaleCTM().
+---
+ gdk/quartz/gdkwindow-quartz.c | 15 +++++++++++++--
+ 1 file changed, 13 insertions(+), 2 deletions(-)
+
+diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
+index 62710a2..3cd7b3f 100644
+--- a/gdk/quartz/gdkwindow-quartz.c
++++ b/gdk/quartz/gdkwindow-quartz.c
+@@ -121,6 +121,7 @@ gdk_window_impl_quartz_get_context (GdkWindowImplQuartz *window_impl,
+ gboolean antialias)
+ {
+ CGContextRef cg_context;
++ CGSize scale;
+
+ if (GDK_WINDOW_DESTROYED (window_impl->wrapper))
+ return NULL;
+@@ -141,6 +142,12 @@ gdk_window_impl_quartz_get_context (GdkWindowImplQuartz *window_impl,
+ CGContextSaveGState (cg_context);
+ CGContextSetAllowsAntialiasing (cg_context, antialias);
+
++ /* Undo the default scaling transform, since we apply our own
++ * in gdk_quartz_ref_cairo_surface () */
++ scale = CGContextConvertSizeToDeviceSpace (cg_context,
++ CGSizeMake (1.0, 1.0));
++ CGContextScaleCTM (cg_context, 1.0 / scale.width, 1.0 / scale.height);
++
+ return cg_context;
+ }
+
+@@ -317,10 +324,14 @@ gdk_quartz_ref_cairo_surface (GdkWindow *window)
+
+ if (!impl->cairo_surface)
+ {
++ gint scale = gdk_window_get_scale_factor (impl->wrapper);
++
+ impl->cairo_surface =
+ gdk_quartz_create_cairo_surface (impl,
+- gdk_window_get_width (impl->wrapper),
+- gdk_window_get_height (impl->wrapper));
++ gdk_window_get_width (impl->wrapper) * scale,
++ gdk_window_get_height (impl->wrapper) * scale);
++
++ cairo_surface_set_device_scale (impl->cairo_surface, scale, scale);
+ }
+ else
+ cairo_surface_reference (impl->cairo_surface);
+--
+2.7.0
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]