[gtk+] snapshot: Only create clip nodes if we need to
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] snapshot: Only create clip nodes if we need to
- Date: Fri, 1 Dec 2017 06:36:18 +0000 (UTC)
commit 94184eda4214b3162eead554212443b3a0f50481
Author: Timm Bäder <mail baedert org>
Date: Fri Dec 1 07:38:43 2017 +0100
snapshot: Only create clip nodes if we need to
Clip nodes have a clip rect and we only need to actually create a clip
node if any child node gets clipped at all. If the clip rect conains the
child node bounds entirely, we don't need a clip node.
gtk/gtksnapshot.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c
index 4995c3d..c969fde 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;
+
/* Its not uncommon to produce stacked clip nodes, which are trivial
to merge, so do that here */
if (gsk_render_node_get_node_type (node) == GSK_CLIP_NODE)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]