diff options
author | Benjamin Otte <otte@redhat.com> | 2016-12-13 00:11:06 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2016-12-20 18:01:10 +0100 |
commit | 67fb129ed7db377bd179757a77514c9ce0d3557f (patch) | |
tree | c4e1edd4635e05e8f2064a3f6433ed232fd9d94c /gsk/gskcairorenderer.c | |
parent | 19753062c4e593507472638ae8a3bc0bd435e6f2 (diff) | |
download | gtk+-67fb129ed7db377bd179757a77514c9ce0d3557f.tar.gz |
gsk: gsk_render_node_set_transform() => GskTransformNode
Instead of having a setter for the transform, have a GskTransformNode.
Most of the oprations that GTK does do not require a transform, so it
doesn't make sense to have it as a primary attribute.
Also, changing the transform requires updating the uniforms of the GL
renderer, so we're happy if we can avoid that.
Diffstat (limited to 'gsk/gskcairorenderer.c')
-rw-r--r-- | gsk/gskcairorenderer.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/gsk/gskcairorenderer.c b/gsk/gskcairorenderer.c index 7d4dcff496..4fd85927d9 100644 --- a/gsk/gskcairorenderer.c +++ b/gsk/gskcairorenderer.c @@ -52,24 +52,10 @@ gsk_cairo_renderer_render_node (GskCairoRenderer *self, cairo_t *cr) { gboolean pop_group = FALSE; - graphene_matrix_t mat; - cairo_matrix_t ctm; graphene_rect_t frame; cairo_save (cr); - gsk_render_node_get_transform (node, &mat); - if (graphene_matrix_to_2d (&mat, &ctm.xx, &ctm.yx, &ctm.xy, &ctm.yy, &ctm.x0, &ctm.y0)) - { - GSK_NOTE (CAIRO, g_print ("CTM = { .xx = %g, .yx = %g, .xy = %g, .yy = %g, .x0 = %g, .y0 = %g }\n", - ctm.xx, ctm.yx, - ctm.xy, ctm.yy, - ctm.x0, ctm.y0)); - cairo_transform (cr, &ctm); - } - else - g_critical ("Invalid non-affine transformation for node %p", node); - 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, @@ -131,6 +117,27 @@ gsk_cairo_renderer_render_node (GskCairoRenderer *self, cairo_paint (cr); } break; + + case GSK_TRANSFORM_NODE: + { + graphene_matrix_t mat; + cairo_matrix_t ctm; + + gsk_transform_node_get_transform (node, &mat); + if (graphene_matrix_to_2d (&mat, &ctm.xx, &ctm.yx, &ctm.xy, &ctm.yy, &ctm.x0, &ctm.y0)) + { + GSK_NOTE (CAIRO, g_print ("CTM = { .xx = %g, .yx = %g, .xy = %g, .yy = %g, .x0 = %g, .y0 = %g }\n", + ctm.xx, ctm.yx, + ctm.xy, ctm.yy, + ctm.x0, ctm.y0)); + cairo_transform (cr, &ctm); + } + else + g_critical ("Invalid non-affine transformation for node %p", node); + + gsk_cairo_renderer_render_node (self, gsk_transform_node_get_child (node), cr); + } + break; } if (GSK_RENDER_MODE_CHECK (GEOMETRY)) |