From b2b207041524d6d97d6521030390113362cfbeac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 13 May 2020 16:26:35 +0200 Subject: Implement diff() for color matrix nodes This way we don't redraw color matrix nodes all the time. --- gsk/gskrendernodeimpl.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'gsk') diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c index 767e7f87c7..5fa0dbc46a 100644 --- a/gsk/gskrendernodeimpl.c +++ b/gsk/gskrendernodeimpl.c @@ -2331,6 +2331,28 @@ gsk_color_matrix_node_draw (GskRenderNode *node, cairo_pattern_destroy (pattern); } +static void +gsk_color_matrix_node_diff (GskRenderNode *node1, + GskRenderNode *node2, + cairo_region_t *region) +{ + GskColorMatrixNode *self1 = (GskColorMatrixNode *) node1; + GskColorMatrixNode *self2 = (GskColorMatrixNode *) node2; + + if (!graphene_vec4_equal (&self1->color_offset, &self2->color_offset)) + goto nope; + + if (!graphene_matrix_equal_fast (&self1->color_matrix, &self2->color_matrix)) + goto nope; + + gsk_render_node_diff (self1->child, self2->child, region); + return; + +nope: + gsk_render_node_diff_impossible (node1, node2, region); + return; +} + /** * gsk_color_matrix_node_new: * @child: The node to draw @@ -4311,7 +4333,7 @@ gsk_render_node_init_types_once (void) gsk_color_matrix_node_finalize, gsk_color_matrix_node_draw, NULL, - NULL, + gsk_color_matrix_node_diff, }; GType node_type = gsk_render_node_type_register_static (I_("GskColorMatrixNode"), &node_info); -- cgit v1.2.1