[gtk+/gtk-3-2] Fix gdk_cairo_region_create_from_surface on big endian



commit b448ae79634501582633b6a8ad71e75fbdf38526
Author: Michel DÃnzer <michel daenzer net>
Date:   Sat Nov 19 12:23:27 2011 -0500

    Fix gdk_cairo_region_create_from_surface on big endian
    
    gdk_cairo_region_create_from_surface doesn't work correctly on PPC.
    This is most prominently seen with the GTK window resize grip, the
    shape of which is mirrored every eight pixels horizontally.
    
    At the same time, use an A1 surface for the resize grip shape to
    eliminates an A8->A1 surface conversion.

 gdk/gdkcairo.c  |    4 ++++
 gtk/gtkwindow.c |    2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/gdk/gdkcairo.c b/gdk/gdkcairo.c
index 2ae8b09..ea58c42 100644
--- a/gdk/gdkcairo.c
+++ b/gdk/gdkcairo.c
@@ -427,7 +427,11 @@ gdk_cairo_region_create_from_surface (cairo_surface_t *surface)
           gint x0 = x;
           while (x < extents.width)
             {
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
               if (((data[x / 8] >> (x%8)) & 1) == 0)
+#else
+              if (((data[x / 8] >> (7-(x%8))) & 1) == 0)
+#endif
                 /* This pixel is "transparent"*/
                 break;
               x++;
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index bdbe861..e614aed 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5297,7 +5297,7 @@ set_grip_shape (GtkWindow *window)
 
   width = gdk_window_get_width (priv->grip_window);
   height = gdk_window_get_height (priv->grip_window);
-  surface = cairo_image_surface_create (CAIRO_FORMAT_A8, width, height);
+  surface = cairo_image_surface_create (CAIRO_FORMAT_A1, width, height);
 
   cr = cairo_create (surface);
   cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.0);



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