[librsvg/librsvg-2.44] (#368): Log when an element is not rendered due to a nonexistent filter



commit e3b95358d58d8d2c9a5d1a3998ffd3cdef487bad
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Oct 24 11:25:13 2018 -0500

    (#368): Log when an element is not rendered due to a nonexistent filter
    
    This behavior changed since librsvg 2.40.  In the old version, if an
    element references a nonexistent filter, the element would be rendered
    unfiltered.
    
    In the Rustified version of the filters code, the element appears to
    not be rendered at all (in reality librsvg creates an empty filter
    surface).  Firefox takes the same approach.
    
    Having a message in the log when this happens will make it easier to
    debug those invalid SVGs.
    
    Fixes https://gitlab.gnome.org/GNOME/librsvg/issues/368

 rsvg_internals/src/drawing_ctx.rs | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs
index e372caca..fa158398 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -424,7 +424,7 @@ impl<'a> DrawingCtx<'a> {
                 let child_surface = cairo::ImageSurface::from(self.cr.get_target()).unwrap();
 
                 let filter_result_surface = if let Some(filter_uri) = filter {
-                    self.run_filter(filter_uri, values, &child_surface)?
+                    self.run_filter(filter_uri, node, values, &child_surface)?
                 } else {
                     child_surface
                 };
@@ -482,6 +482,7 @@ impl<'a> DrawingCtx<'a> {
     fn run_filter(
         &mut self,
         filter_uri: &str,
+        node: &RsvgNode,
         values: &ComputedValues,
         child_surface: &cairo::ImageSurface,
     ) -> Result<cairo::ImageSurface, RenderingError> {
@@ -500,6 +501,12 @@ impl<'a> DrawingCtx<'a> {
             }
 
             None => {
+                rsvg_log!(
+                    "element {} will not be rendered since its filter \"{}\" was not found",
+                    node.get_human_readable_name(),
+                    filter_uri,
+                );
+
                 // Non-existing filters must act as null filters (that is, an
                 // empty surface is returned).
                 Ok(cairo::ImageSurface::create(


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