[gtk+/wip/ebassi/gsk-renderer: 49/67] Ensure that render nodes are translated



commit 87679d16f783d6a4a4d59f47a3ec4ffeef155fc3
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Tue Jul 5 11:58:44 2016 +0100

    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.

 gtk/gtkwidget.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 7f578bf..89888db 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -17483,19 +17483,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);
@@ -17512,16 +17516,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))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]