[gtk+] gdk: Mark window surfaces as dirty before reading from them



commit 15d043c5d239facb99fa776c100f520c350562fb
Author: Benjamin Otte <otte redhat com>
Date:   Fri Sep 18 02:04:10 2015 +0200

    gdk: Mark window surfaces as dirty before reading from them
    
    We do not know what happened to this surface outside of GDK.
    Especially for foreign windows, they will have been modified
    by external applications.
    
    So be on the safe side and tell Cairo to clear all its caches.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=754952

 gdk/gdkpixbuf-drawable.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gdk/gdkpixbuf-drawable.c b/gdk/gdkpixbuf-drawable.c
index 9fabf87..ae6e7da 100644
--- a/gdk/gdkpixbuf-drawable.c
+++ b/gdk/gdkpixbuf-drawable.c
@@ -93,6 +93,14 @@ gdk_pixbuf_get_from_window (GdkWindow *src,
   g_return_val_if_fail (gdk_window_is_viewable (src), NULL);
 
   surface = _gdk_window_ref_cairo_surface (src);
+
+  /* We do not know what happened to this surface outside of GDK.
+   * Especially for foreign windows, they will have been modified
+   * by external applications.
+   * So be on the safe side and:
+   */
+  cairo_surface_mark_dirty (surface);
+
   dest = gdk_pixbuf_get_from_surface (surface,
                                       src_x, src_y,
                                       width, height);


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