[gtk] gl renderer: Cache rendered fallback nodes



commit 9105de917028aae534367b3c820b3bca237713c9
Author: Timm Bäder <mail baedert org>
Date:   Tue Mar 5 09:03:11 2019 +0100

    gl renderer: Cache rendered fallback nodes

 gsk/gl/gskglrenderer.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index 02b15f5c8e..599c7a760c 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -433,12 +433,23 @@ render_fallback_node (GskGLRenderer       *self,
   const int surface_height = ceilf (node->bounds.size.height) * scale;
   cairo_surface_t *surface;
   cairo_t *cr;
+  int cached_id;
   int texture_id;
 
   if (surface_width <= 0 ||
       surface_height <= 0)
     return;
 
+  cached_id = gsk_gl_driver_get_texture_for_pointer (self->gl_driver, node);
+
+  if (cached_id != 0)
+    {
+      ops_set_program (builder, &self->blit_program);
+      ops_set_texture (builder, cached_id);
+      ops_draw (builder, vertex_data);
+      return;
+    }
+
   surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
                                         surface_width,
                                         surface_height);
@@ -474,6 +485,8 @@ render_fallback_node (GskGLRenderer       *self,
 
   cairo_surface_destroy (surface);
 
+  gsk_gl_driver_set_texture_for_pointer (self->gl_driver, node, texture_id);
+
   ops_set_program (builder, &self->blit_program);
   ops_set_texture (builder, texture_id);
   ops_draw (builder, vertex_data);


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