summaryrefslogtreecommitdiff
path: root/gsk/gskrendernode.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2016-12-21 11:21:38 +0100
committerAlexander Larsson <alexl@redhat.com>2016-12-21 14:01:34 +0100
commit22110ef5a480fbddf9d20f510a64f4524a52718f (patch)
tree187ef0a26bc9a7e4402fbe6bd539310e995b9fc2 /gsk/gskrendernode.c
parent2d4b46f4f95025be01ffa5cf0f5abfe354d79a93 (diff)
downloadgtk+-22110ef5a480fbddf9d20f510a64f4524a52718f.tar.gz
gsk: Add bounds member to RenderNode
Instead of constantly recalculating this (especially recursively for parents!) we do it only on construction, because everything is immutable anyway. Also, most nodes had a bounds already and can use the new parent member instead. We also do direct access to the node bounds rather than calling gsk_render_node_get_bounds in various places, which means we do less copying.
Diffstat (limited to 'gsk/gskrendernode.c')
-rw-r--r--gsk/gskrendernode.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/gsk/gskrendernode.c b/gsk/gskrendernode.c
index 1cd01f4b63..1955d74acf 100644
--- a/gsk/gskrendernode.c
+++ b/gsk/gskrendernode.c
@@ -176,7 +176,7 @@ gsk_render_node_get_bounds (GskRenderNode *node,
g_return_if_fail (GSK_IS_RENDER_NODE (node));
g_return_if_fail (bounds != NULL);
- node->node_class->get_bounds (node, bounds);
+ graphene_rect_init_from_rect (bounds, &node->bounds);
}
void
@@ -258,14 +258,11 @@ gsk_render_node_draw (GskRenderNode *node,
if (!GSK_RENDER_MODE_CHECK (GEOMETRY))
{
- graphene_rect_t frame;
-
- gsk_render_node_get_bounds (node, &frame);
GSK_NOTE (CAIRO, g_print ("CLIP = { .x = %g, .y = %g, .width = %g, .height = %g }\n",
- frame.origin.x, frame.origin.y,
- frame.size.width, frame.size.height));
+ node->bounds.origin.x, node->bounds.origin.y,
+ node->bounds.size.width, node->bounds.size.height));
- cairo_rectangle (cr, frame.origin.x, frame.origin.y, frame.size.width, frame.size.height);
+ cairo_rectangle (cr, node->bounds.origin.x, node->bounds.origin.y, node->bounds.size.width, node->bounds.size.height);
cairo_clip (cr);
}
@@ -277,12 +274,9 @@ gsk_render_node_draw (GskRenderNode *node,
if (GSK_RENDER_MODE_CHECK (GEOMETRY))
{
- graphene_rect_t frame;
-
- gsk_render_node_get_bounds (node, &frame);
-
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
- cairo_rectangle (cr, frame.origin.x - 1, frame.origin.y - 1, frame.size.width + 2, frame.size.height + 2);
+ cairo_rectangle (cr, node->bounds.origin.x - 1, node->bounds.origin.y - 1,
+ node->bounds.size.width + 2, node->bounds.size.height + 2);
cairo_set_line_width (cr, 2);
cairo_set_source_rgba (cr, 0, 0, 0, 0.5);
cairo_stroke (cr);