[librsvg: 14/15] (#823): Fix geometry computation for individual layers




commit 44927afa05ece56341f08872393332202482f951
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon May 9 19:36:39 2022 -0500

    (#823): Fix geometry computation for individual layers
    
    (#823) correctly points out that commit
    e3bb911b2cd860e4e4671c87ea9712913bb35d26 broke geometry computation.
    I didn't see how it could, since it didn't even have to do with
    extracting bounding boxes from elements.
    
    It turns out that I forgot to copy the DrawingCtx.drawsub_stack for
    the nested context.  So, for an SVG with structure
    
      a
        b
          c -> with isolation context (due to non-100% opacity / etc.)
            d
            e
            f id="draw_only_this_one"
            g
    
    if one calls geometry_for_layer("draw_only_this_one"), draw_tree() would
    properly create a drawsub_stack like (a b c f), but then the nested
    rendering would go:
    
      stack_top=a
    
      stack_top=b
    
      stack_top=c (creates isolation context, and a nested DrawingCtx)
    
      stack_top=empty (nested DrawingCtx has an empty drawsub_stack) ->
        draw every child of c since there's no drawsub_stack to limit it,
        instead of just drawing f in there.
    
    https://gitlab.gnome.org/GNOME/librsvg/-/issues/823
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/697>

 src/drawing_ctx.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/drawing_ctx.rs b/src/drawing_ctx.rs
index 410295519..cde3c61d3 100644
--- a/src/drawing_ctx.rs
+++ b/src/drawing_ctx.rs
@@ -326,7 +326,7 @@ impl DrawingCtx {
             cr,
             user_language: self.user_language.clone(),
             viewport_stack: self.viewport_stack.clone(),
-            drawsub_stack: Vec::new(),
+            drawsub_stack: self.drawsub_stack.clone(),
             measuring: self.measuring,
             testing: self.testing,
         }


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