[gtk+] Sync with changes in the cairo device-scale handling



commit 854f5818f8d7b97ead2af62bc474a59396082dd8
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Sep 5 19:30:23 2013 +0200

    Sync with changes in the cairo device-scale handling
    
    The version of device scale that landed in upstream cairo
    master already inherits the device scale in cairo_create_similar,
    so no need to do that in gtk anymore.

 gdk/gdkwindow.c   |   16 ++++++++--------
 gtk/gtkcssimage.c |   14 ++------------
 2 files changed, 10 insertions(+), 20 deletions(-)
---
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 55f5bf2..a07d3b4 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -9252,21 +9252,24 @@ gdk_window_create_similar_surface (GdkWindow *     window,
   cairo_surface_get_device_scale (window_surface, &sx, &sy);
 #endif
 
-  width = width * sx;
-  height = height * sy;
-
   switch (_gdk_rendering_mode)
   {
     case GDK_RENDERING_MODE_RECORDING:
       {
-        cairo_rectangle_t rect = { 0, 0, width, height };
+        cairo_rectangle_t rect = { 0, 0, width * sx, height *sy };
         surface = cairo_recording_surface_create (content, &rect);
+#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
+        cairo_surface_set_device_scale (surface, sx, sy);
+#endif
       }
       break;
     case GDK_RENDERING_MODE_IMAGE:
       surface = cairo_image_surface_create (content == CAIRO_CONTENT_COLOR ? CAIRO_FORMAT_RGB24 :
                                             content == CAIRO_CONTENT_ALPHA ? CAIRO_FORMAT_A8 : 
CAIRO_FORMAT_ARGB32,
-                                            width, height);
+                                            width * sx, height * sy);
+#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
+      cairo_surface_set_device_scale (surface, sx, sy);
+#endif
       break;
     case GDK_RENDERING_MODE_SIMILAR:
     default:
@@ -9276,9 +9279,6 @@ gdk_window_create_similar_surface (GdkWindow *     window,
       break;
   }
 
-#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
-  cairo_surface_set_device_scale (surface, sx, sy);
-#endif
 
   cairo_surface_destroy (window_surface);
 
diff --git a/gtk/gtkcssimage.c b/gtk/gtkcssimage.c
index 33c85f2..042086b 100644
--- a/gtk/gtkcssimage.c
+++ b/gtk/gtkcssimage.c
@@ -398,20 +398,10 @@ _gtk_css_image_get_surface (GtkCssImage     *image,
 
   if (target)
     {
-#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
-      cairo_surface_get_device_scale (target, &sx, &sy);
-#else
-      sx = sy = 1;
-#endif
-
       result = cairo_surface_create_similar (target,
                                             CAIRO_CONTENT_COLOR_ALPHA,
-                                            surface_width*sx,
-                                            surface_height*sy);
-
-#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
-      cairo_surface_set_device_scale (result, sx, sy);
-#endif
+                                            surface_width,
+                                            surface_height);
     }
   else
     result = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]