[poppler] test/gtk-splash-test.cc

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Sun Feb 13 04:00:16 PST 2011


 test/gtk-splash-test.cc |   28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

New commits:
commit f410cd11268254b9d0422201c9860d775f73fdd8
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Sun Feb 13 12:55:37 2011 +0100

    gtk-splash-test: Don't use GDK deprecated API

diff --git a/test/gtk-splash-test.cc b/test/gtk-splash-test.cc
index d5a41d3..59fba28 100644
--- a/test/gtk-splash-test.cc
+++ b/test/gtk-splash-test.cc
@@ -63,7 +63,7 @@ public:
   // Copy the rectangle (srcX, srcY, width, height) to (destX, destY)
   // in destDC.
   void redraw(int srcX, int srcY,
-              GdkDrawable *drawable,
+              GdkWindow *drawable,
 	      int destX, int destY,
 	      int width, int height);
 
@@ -120,23 +120,25 @@ void GDKSplashOutputDev::updateFont(GfxState *state) {
 }
 
 void GDKSplashOutputDev::redraw(int srcX, int srcY,
-                                GdkDrawable *drawable,
+                                GdkWindow *drawable,
                                 int destX, int destY,
                                 int width, int height) {
-  GdkGC *gc;
+  cairo_t *cr;
+  GdkPixbuf *pixbuf;
   int gdk_rowstride;
 
   gdk_rowstride = getBitmap()->getRowSize();
-  gc = gdk_gc_new (drawable);
-  
-  gdk_draw_rgb_image (drawable, gc,
-                      destX, destY,
-                      width, height,
-                      GDK_RGB_DITHER_NORMAL,
-                      getBitmap()->getDataPtr() + srcY * gdk_rowstride + srcX * 3,
-                      gdk_rowstride);
-
-  g_object_unref (gc);
+  pixbuf = gdk_pixbuf_new_from_data (getBitmap()->getDataPtr() + srcY * gdk_rowstride + srcX * 3,
+                                     GDK_COLORSPACE_RGB, FALSE, 8,
+                                     width, height, gdk_rowstride,
+                                     NULL, NULL);
+
+  cr = gdk_cairo_create (drawable);
+  gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
+  cairo_paint (cr);
+  cairo_destroy (cr);
+
+  g_object_unref (pixbuf);
 }
 
 


More information about the poppler mailing list