summaryrefslogtreecommitdiff
path: root/gsk
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2019-03-05 09:03:11 +0100
committerTimm Bäder <mail@baedert.org>2019-03-06 06:31:25 +0100
commit9105de917028aae534367b3c820b3bca237713c9 (patch)
tree66334a74e531fa70e37608d6bb3cf4d8475f6220 /gsk
parenteeed55d45c2a3b6ece15f44427515664483d310e (diff)
downloadgtk+-9105de917028aae534367b3c820b3bca237713c9.tar.gz
gl renderer: Cache rendered fallback nodes
Diffstat (limited to 'gsk')
-rw-r--r--gsk/gl/gskglrenderer.c13
1 files changed, 13 insertions, 0 deletions
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);