[gtk/gtk-2-24] Return a default surface if the view has no currentContext.



commit e6cfbb24b8280f76fd41e147cc7e0f4548617574
Author: John Ralls <jralls ceridwen us>
Date:   Thu Nov 1 12:56:20 2018 -0700

    Return a default surface if the view has no currentContext.
    
    Note that the resultind surface will not display on the screen.
    
    Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1411 for Gtk2.

 gdk/quartz/gdkdrawable-quartz.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gdk/quartz/gdkdrawable-quartz.c b/gdk/quartz/gdkdrawable-quartz.c
index 503ea83aa8..e5b6ace48d 100644
--- a/gdk/quartz/gdkdrawable-quartz.c
+++ b/gdk/quartz/gdkdrawable-quartz.c
@@ -65,15 +65,15 @@ _gdk_windowing_create_cairo_surface (GdkDrawable *drawable,
 
   cg_context = gdk_quartz_drawable_get_context (drawable, TRUE);
 
-  if (!cg_context)
-    return NULL;
-
   surface_data = g_new (GdkQuartzCairoSurfaceData, 1);
   surface_data->drawable = drawable;
   surface_data->cg_context = cg_context;
 
-  surface = cairo_quartz_surface_create_for_cg_context (cg_context,
-                                                        width, height);
+  if (cg_context)
+    surface = cairo_quartz_surface_create_for_cg_context (cg_context,
+                                                          width, height);
+  else
+    surface = cairo_quartz_surface_create(CAIRO_FORMAT_ARGB32, width, height);
 
   cairo_surface_set_user_data (surface, &gdk_quartz_cairo_key,
                                surface_data,


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