[gtk/wip/otte/display-gl: 5/6] node-editor: Create renderers surfaceless




commit ff57fdb4483013cd9fce4fe5a482a0e353efc3b1
Author: Benjamin Otte <otte redhat com>
Date:   Wed Oct 20 20:30:43 2021 +0200

    node-editor: Create renderers surfaceless

 demos/node-editor/node-editor-window.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/demos/node-editor/node-editor-window.c b/demos/node-editor/node-editor-window.c
index 4a22a0b9d8..995d2969f6 100644
--- a/demos/node-editor/node-editor-window.c
+++ b/demos/node-editor/node-editor-window.c
@@ -646,7 +646,6 @@ create_cairo_texture (NodeEditorWindow *self)
   GskRenderer *renderer;
   GskRenderNode *node;
   GdkTexture *texture;
-  GdkSurface *surface;
 
   paintable = gtk_picture_get_paintable (GTK_PICTURE (self->picture));
   if (paintable == NULL ||
@@ -659,9 +658,8 @@ create_cairo_texture (NodeEditorWindow *self)
   if (node == NULL)
     return NULL;
 
-  surface = gtk_native_get_surface (gtk_widget_get_native (GTK_WIDGET (self)));
   renderer = gsk_cairo_renderer_new ();
-  gsk_renderer_realize (renderer, surface, NULL);
+  gsk_renderer_realize (renderer, NULL, NULL);
 
   texture = gsk_renderer_render_texture (renderer, node, NULL);
   gsk_render_node_unref (node);
@@ -839,16 +837,18 @@ node_editor_window_add_renderer (NodeEditorWindow *self,
                                  GskRenderer      *renderer,
                                  const char       *description)
 {
-  GdkSurface *surface;
   GdkPaintable *paintable;
 
-  surface = gtk_native_get_surface (GTK_NATIVE (self));
-  g_assert (surface != NULL);
-
-  if (renderer != NULL && !gsk_renderer_realize (renderer, surface, NULL))
+  if (!gsk_renderer_realize (renderer, NULL, NULL))
     {
-      g_object_unref (renderer);
-      return;
+      GdkSurface *surface = gtk_native_get_surface (GTK_NATIVE (self));
+      g_assert (surface != NULL);
+
+      if (!gsk_renderer_realize (renderer, surface, NULL))
+        {
+          g_object_unref (renderer);
+          return;
+        }
     }
 
   paintable = gtk_renderer_paintable_new (renderer, gtk_picture_get_paintable (GTK_PICTURE (self->picture)));


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