[gtk+/wip/baedert/gl: 1/39] snapshot: Only create clip nodes if we have to



commit 1e30c24b929b4fcc3d62b29656adcd020f3f1e9b
Author: Timm Bäder <mail baedert org>
Date:   Mon Nov 20 14:14:01 2017 +0100

    snapshot: Only create clip nodes if we have to
    
    gtk_snapshot_push_clip takes a bounds argument that describes the rect
    to be clipped to. If that rect entirely contains the child node bounds,
    we don't need to create a clip node in the first place.

 gtk/gtksnapshot.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c
index 8885806..4ae3f4a 100644
--- a/gtk/gtksnapshot.c
+++ b/gtk/gtksnapshot.c
@@ -548,6 +548,10 @@ gtk_snapshot_collect_clip (GtkSnapshot      *snapshot,
   if (node == NULL)
     return NULL;
 
+  /* Check if the child node will even be clipped */
+  if (graphene_rect_contains_rect (&state->data.clip.bounds, &node->bounds))
+    return node;
+
   clip_node = gsk_clip_node_new (node, &state->data.clip.bounds);
   if (name)
     gsk_render_node_set_name (clip_node, name);


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