[librsvg: 28/45] filters/mod.rs: Use a session for logging




commit 7e9b0df1af2f3a88d2bd13fabc581e275384d51c
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Aug 23 12:33:18 2022 -0500

    filters/mod.rs: Use a session for logging
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/731>

 src/filters/mod.rs | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/src/filters/mod.rs b/src/filters/mod.rs
index 0b3136cdf..2f9f13aec 100644
--- a/src/filters/mod.rs
+++ b/src/filters/mod.rs
@@ -246,6 +246,8 @@ pub fn extract_filter_from_filter_node(
     acquired_nodes: &mut AcquiredNodes<'_>,
     draw_ctx: &DrawingCtx,
 ) -> Result<FilterSpec, FilterResolveError> {
+    let session = draw_ctx.session().clone();
+
     let filter_node = &*filter_node;
     assert!(is_element_of_type!(filter_node, Filter));
 
@@ -270,7 +272,11 @@ pub fn extract_filter_from_filter_node(
             let in_error = c.borrow_element().is_in_error();
 
             if in_error {
-                rsvg_log!("(ignoring filter primitive {} because it is in error)", c);
+                rsvg_log_session!(
+                    session,
+                    "(ignoring filter primitive {} because it is in error)",
+                    c
+                );
             }
 
             !in_error
@@ -292,7 +298,8 @@ pub fn extract_filter_from_filter_node(
             effect
                 .resolve(acquired_nodes, &primitive_node)
                 .map_err(|e| {
-                    rsvg_log!(
+                    rsvg_log_session!(
+                        session,
                         "(filter primitive {} returned an error: {})",
                         primitive_name,
                         e
@@ -320,6 +327,8 @@ pub fn render(
     transform: Transform,
     node_bbox: BoundingBox,
 ) -> Result<SharedImageSurface, RenderingError> {
+    let session = draw_ctx.session().clone();
+
     FilterContext::new(
         &filter.user_space_filter,
         stroke_paint_source,
@@ -335,7 +344,8 @@ pub fn render(
             match render_primitive(user_space_primitive, &filter_ctx, acquired_nodes, draw_ctx) {
                 Ok(output) => {
                     let elapsed = start.elapsed();
-                    rsvg_log!(
+                    rsvg_log_session!(
+                        session,
                         "(rendered filter primitive {} in\n    {} seconds)",
                         user_space_primitive.params.name(),
                         elapsed.as_secs() as f64 + f64::from(elapsed.subsec_nanos()) / 1e9
@@ -348,7 +358,8 @@ pub fn render(
                 }
 
                 Err(err) => {
-                    rsvg_log!(
+                    rsvg_log_session!(
+                        session,
                         "(filter primitive {} returned an error: {})",
                         user_space_primitive.params.name(),
                         err


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