[librsvg/rustification] Don't push/pop a new state for nodes that wouldn't be drawn anyway



commit 2d5a23c124e431cef52ae6475e65ff75a6b1fd07
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Dec 2 10:56:19 2016 -0600

    Don't push/pop a new state for nodes that wouldn't be drawn anyway
    
    Nodes will be omitted from drawing when:
    
    - we are in a draw_sub() situation, where only a subtree of a node a
      specific ID is rendered, and/or
    
    - a node's state resolves to visibility:hidden
    
    In either case, we were pushing/popping a new state.  Now we only do it
    when the node will actually be drawn.

 rsvg-structure.c |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/rsvg-structure.c b/rsvg-structure.c
index b0dbb3c..a0287d5 100644
--- a/rsvg-structure.c
+++ b/rsvg-structure.c
@@ -40,25 +40,25 @@ rsvg_node_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate)
     RsvgState *state;
     GSList *stacksave;
 
-    rsvg_state_push (ctx);
-
-    state = rsvg_node_get_state (self);
-
     stacksave = ctx->drawsub_stack;
     if (stacksave) {
         if (stacksave->data != self)
-            goto out;
+            return;
 
         ctx->drawsub_stack = stacksave->next;
     }
-    if (!state->visible)
-        goto out;
 
-    self->draw (self, ctx, dominate);
-    ctx->drawsub_stack = stacksave;
+    state = rsvg_node_get_state (self);
+
+    if (state->visible) {
+        rsvg_state_push (ctx);
+
+        self->draw (self, ctx, dominate);
+
+        rsvg_state_pop (ctx);
+    }
 
-out:
-    rsvg_state_pop (ctx);
+    ctx->drawsub_stack = stacksave;
 }
 
 static gboolean


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