diff options
author | Timm Bäder <mail@baedert.org> | 2020-05-13 16:26:35 +0200 |
---|---|---|
committer | Timm Bäder <mail@baedert.org> | 2020-05-16 08:22:55 +0200 |
commit | b2b207041524d6d97d6521030390113362cfbeac (patch) | |
tree | 2e42ae3505f55d8589a7fe9213084b27c550e03c /gsk | |
parent | f4d3d8e27c87b7979699f8bd71e044f4bd98703e (diff) | |
download | gtk+-b2b207041524d6d97d6521030390113362cfbeac.tar.gz |
Implement diff() for color matrix nodes
This way we don't redraw color matrix nodes all the time.
Diffstat (limited to 'gsk')
-rw-r--r-- | gsk/gskrendernodeimpl.c | 24 |
1 files changed, 23 insertions, 1 deletions
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); |