(#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 #368
parent 0a5e9f78
......@@ -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(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment