Ensure that render nodes are translated

The clip rectangle may have non-zero offsets, so we need to ensure that
the GskRenderNode associated to the rendered area is translated by those
same offsets.
This commit is contained in:
Emmanuele Bassi 2016-07-05 11:58:44 +01:00
parent d790054c2e
commit dc3b240c20

View File

@ -15845,19 +15845,23 @@ gtk_widget_get_render_node (GtkWidget *widget,
{
GtkWidgetClass *klass = GTK_WIDGET_GET_CLASS (widget);
GskRenderNode *node;
graphene_matrix_t m;
graphene_point3d_t tmp;
graphene_rect_t bounds;
GtkAllocation clip;
gtk_widget_get_clip (widget, &clip);
graphene_rect_init (&bounds, 0, 0, clip.width, clip.height);
graphene_matrix_init_translate (&m, graphene_point3d_init (&tmp, clip.x, clip.y, 0.f));
if (klass->get_render_node == NULL)
{
GskRenderNode *tmp;
graphene_rect_t bounds;
GtkAllocation clip;
cairo_t *cr;
gtk_widget_get_clip (widget, &clip);
graphene_rect_init (&bounds, clip.x, clip.y, clip.width, clip.height);
tmp = gsk_render_node_new ();
gsk_render_node_set_bounds (tmp, &bounds);
gsk_render_node_set_transform (tmp, &m);
cr = gsk_render_node_get_draw_context (tmp);
gtk_widget_draw (widget, cr);
@ -15874,16 +15878,12 @@ gtk_widget_get_render_node (GtkWidget *widget,
g_signal_has_handler_pending (widget, widget_signals[DRAW], 0, FALSE))
{
GskRenderNode *tmp;
graphene_rect_t bounds;
GtkAllocation clip;
gboolean result;
cairo_t *cr;
gtk_widget_get_clip (widget, &clip);
graphene_rect_init (&bounds, clip.x, clip.y, clip.width, clip.height);
tmp = gsk_render_node_new ();
gsk_render_node_set_bounds (tmp, &bounds);
gsk_render_node_set_transform (tmp, &m);
cr = gsk_render_node_get_draw_context (tmp);
if (g_signal_has_handler_pending (widget, widget_signals[DRAW], 0, FALSE))