[gtk+] gdk: add alpha to the offscreen window's surface if its visual is RGBA



commit 0f2d1547f85159d25131db0fdffaebfa22a084ce
Author: Michael Natterer <mitch gimp org>
Date:   Wed Oct 20 17:44:23 2010 +0200

    gdk: add alpha to the offscreen window's surface if its visual is RGBA

 gdk/gdkoffscreenwindow.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c
index 81f3bbc..f9be9ad 100644
--- a/gdk/gdkoffscreenwindow.c
+++ b/gdk/gdkoffscreenwindow.c
@@ -156,16 +156,19 @@ _gdk_offscreen_window_create_surface (GdkWindow *offscreen,
   GdkWindowObject *private = (GdkWindowObject *) offscreen;
   cairo_surface_t *similar;
   cairo_surface_t *surface;
+  cairo_content_t  content = CAIRO_CONTENT_COLOR;
 
   g_return_val_if_fail (GDK_IS_OFFSCREEN_WINDOW (private->impl), NULL);
 
   similar = _gdk_drawable_ref_cairo_surface ((GdkWindow *)private->parent);
 
-  surface = cairo_surface_create_similar (similar,
-                                          /* FIXME: use visual */
-                                          CAIRO_CONTENT_COLOR,
-                                          width,
-                                          height);
+  if (gdk_window_get_visual (offscreen) ==
+      gdk_screen_get_rgba_visual (gdk_window_get_screen (offscreen)))
+    {
+      content = CAIRO_CONTENT_COLOR_ALPHA;
+    }
+
+  surface = cairo_surface_create_similar (similar, content, width, height);
 
   cairo_surface_destroy (similar);
 



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