[gtk+] gdk_pixbuf_get_from_source: only reuse surfaces with matching format



commit 0735aa1c2ee0faa8c9b75a2f1c31870db6597f79
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Fri Sep 6 18:44:57 2013 +0300

    gdk_pixbuf_get_from_source: only reuse surfaces with matching format
    
    Otherwise the conversion functions will return rubbish.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=707445

 gdk/gdkpixbuf-drawable.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gdk/gdkpixbuf-drawable.c b/gdk/gdkpixbuf-drawable.c
index 59698f8..b6d238e 100644
--- a/gdk/gdkpixbuf-drawable.c
+++ b/gdk/gdkpixbuf-drawable.c
@@ -248,7 +248,8 @@ gdk_pixbuf_get_from_surface  (cairo_surface_t *surface,
                          8,
                          width, height);
 
-  if (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_IMAGE)
+  if (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_IMAGE &&
+      cairo_image_surface_get_format (surface) == gdk_cairo_format_for_content (content))
     surface = cairo_surface_reference (surface);
   else
     {


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