[gtk+/rendering-cleanup: 4/40] gdk: Get rid of gdk_draw_pixbuf() call



commit e84bf4ff1ea980c1efd4680091ac63e5fef1c125
Author: Benjamin Otte <otte redhat com>
Date:   Mon Jul 12 13:27:41 2010 +0200

    gdk: Get rid of gdk_draw_pixbuf() call
    
    Use Cairo code instead.

 gdk/gdkpixbuf-render.c |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)
---
diff --git a/gdk/gdkpixbuf-render.c b/gdk/gdkpixbuf-render.c
index bd94aaf..fae5b12 100644
--- a/gdk/gdkpixbuf-render.c
+++ b/gdk/gdkpixbuf-render.c
@@ -208,13 +208,11 @@ gdk_pixbuf_render_pixmap_and_mask_for_colormap (GdkPixbuf   *pixbuf,
   
   if (pixmap_return)
     {
-      GdkGC *gc;
       *pixmap_return = gdk_pixmap_new (gdk_screen_get_root_window (screen),
 				       gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf),
 				       gdk_colormap_get_visual (colormap)->depth);
 
       gdk_drawable_set_colormap (GDK_DRAWABLE (*pixmap_return), colormap);
-      gc = _gdk_drawable_get_scratch_gc (*pixmap_return, FALSE);
 
       /* If the pixbuf has an alpha channel, using gdk_pixbuf_draw would give
        * random pixel values in the area that are within the mask, but semi-
@@ -222,17 +220,21 @@ gdk_pixbuf_render_pixmap_and_mask_for_colormap (GdkPixbuf   *pixbuf,
        * see bug #487865.
        */
       if (gdk_pixbuf_get_has_alpha (pixbuf))
-        gdk_draw_rgb_32_image (*pixmap_return, gc,
-                               0, 0,
-                               gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf),
-                               GDK_RGB_DITHER_NORMAL,
-                               gdk_pixbuf_get_pixels (pixbuf), gdk_pixbuf_get_rowstride (pixbuf));
+        {
+          GdkGC *gc = _gdk_drawable_get_scratch_gc (*pixmap_return, FALSE);
+          gdk_draw_rgb_32_image (*pixmap_return, gc,
+                                 0, 0,
+                                 gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf),
+                                 GDK_RGB_DITHER_NORMAL,
+                                 gdk_pixbuf_get_pixels (pixbuf), gdk_pixbuf_get_rowstride (pixbuf));
+        }
       else
-        gdk_draw_pixbuf (*pixmap_return, gc, pixbuf, 
-                         0, 0, 0, 0,
-                         gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf),
-                         GDK_RGB_DITHER_NORMAL,
-                         0, 0);
+        {
+          cairo_t *cr = gdk_cairo_create (*pixmap_return);
+          gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
+          cairo_paint (cr);
+          cairo_destroy (cr);
+        }
     }
   
   if (mask_return)



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