[librsvg: 17/90] Convince myself that the bbox in the FilterContext is always the same



commit cf6dd438000f220518a64fe367bcfbf521093fc0
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Mar 11 14:55:47 2019 -0600

    Convince myself that the bbox in the FilterContext is always the same

 rsvg_internals/src/bbox.rs            | 2 +-
 rsvg_internals/src/filters/context.rs | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/rsvg_internals/src/bbox.rs b/rsvg_internals/src/bbox.rs
index 4c76b805..b8338333 100644
--- a/rsvg_internals/src/bbox.rs
+++ b/rsvg_internals/src/bbox.rs
@@ -3,7 +3,7 @@ use cairo::MatrixTrait;
 
 use crate::rect::RectangleExt;
 
-#[derive(Debug, Copy, Clone)]
+#[derive(Debug, Copy, Clone, PartialEq)]
 pub struct BoundingBox {
     pub affine: cairo::Matrix,
     pub rect: Option<cairo::Rectangle>,     // without stroke
diff --git a/rsvg_internals/src/filters/context.rs b/rsvg_internals/src/filters/context.rs
index 96b578dc..643d3507 100644
--- a/rsvg_internals/src/filters/context.rs
+++ b/rsvg_internals/src/filters/context.rs
@@ -51,6 +51,8 @@ pub enum FilterInput {
 pub struct FilterContext {
     /// The <filter> node.
     node: RsvgNode,
+    /// Bounding box of node being filtered
+    node_bbox: BoundingBox,
     /// Values from the node which referenced this filter.
     computed_from_node_being_filtered: ComputedValues,
     /// The source graphic surface.
@@ -149,6 +151,7 @@ impl FilterContext {
 
         Self {
             node: filter_node.clone(),
+            node_bbox: bbox,
             computed_from_node_being_filtered: computed_from_node_being_filtered.clone(),
             source_surface,
             last_result: None,
@@ -330,6 +333,7 @@ impl FilterContext {
         draw_ctx.set_cairo_context(&cr);
 
         let bbox = draw_ctx.get_bbox().clone();
+        assert!(bbox == self.node_bbox);
 
         // FIXME: we are ignoring the following error; propagate it upstream
         let _ = draw_ctx


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