[librsvg: 23/27] Don't cache resolved patterns




commit 15e8f1040c277b76b244362dddb1adb282653f87
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Mar 5 15:53:24 2021 -0600

    Don't cache resolved patterns
    
    Same as for gradients, they will depend on opacity.

 src/pattern.rs | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
---
diff --git a/src/pattern.rs b/src/pattern.rs
index 6bcc7a9e..d09d9b78 100644
--- a/src/pattern.rs
+++ b/src/pattern.rs
@@ -1,7 +1,6 @@
 //! The `pattern` element.
 
 use markup5ever::{expanded_name, local_name, namespace_url, ns};
-use once_cell::sync::OnceCell;
 
 use crate::aspect_ratio::*;
 use crate::bbox::BoundingBox;
@@ -117,7 +116,6 @@ pub struct UserSpacePattern {
 pub struct Pattern {
     common: Common,
     fallback: Option<NodeId>,
-    resolved: OnceCell<ResolvedPattern>,
 }
 
 impl SetAttributes for Pattern {
@@ -406,7 +404,7 @@ impl Pattern {
         }
     }
 
-    fn init_resolved(
+    pub fn resolve(
         &self,
         node: &Node,
         acquired_nodes: &mut AcquiredNodes<'_>,
@@ -458,16 +456,6 @@ impl Pattern {
 
         Ok(pattern.into_resolved())
     }
-
-    pub fn resolve(
-        &self,
-        node: &Node,
-        acquired_nodes: &mut AcquiredNodes<'_>,
-    ) -> Result<ResolvedPattern, AcquireError> {
-        self.resolved
-            .get_or_try_init(|| self.init_resolved(node, acquired_nodes))
-            .map(|r| r.clone())
-    }
 }
 
 #[cfg(test)]


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