diff options
author | Federico Mena Quintero <federico@gnome.org> | 2022-10-21 12:04:32 -0500 |
---|---|---|
committer | Federico Mena Quintero <federico@gnome.org> | 2022-11-04 08:44:28 -0600 |
commit | 466d91607d1c7922ee4403f493c2f1c84209a0f6 (patch) | |
tree | 66fdb275eefab9748972f9b693fa64ed57e70e39 | |
parent | cf7f238c6afaa1ee04a28ddffc0c3a29d6975005 (diff) | |
download | librsvg-466d91607d1c7922ee4403f493c2f1c84209a0f6.tar.gz |
GaussianBlur::render() - explicitly return the input surface if stdDeviation is negative
Fixes https://gitlab.gnome.org/GNOME/librsvg/-/issues/913
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/763>
-rw-r--r-- | src/filters/gaussian_blur.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/filters/gaussian_blur.rs b/src/filters/gaussian_blur.rs index 9ea55d29..7ca9ad35 100644 --- a/src/filters/gaussian_blur.rs +++ b/src/filters/gaussian_blur.rs @@ -221,6 +221,17 @@ impl GaussianBlur { .into(); let NumberOptionalNumber(std_x, std_y) = self.std_deviation; + + // "A negative value or a value of zero disables the effect of + // the given filter primitive (i.e., the result is the filter + // input image)." + if std_x <= 0.0 && std_y <= 0.0 { + return Ok(FilterOutput { + surface: input_1.surface().clone(), + bounds, + }); + } + let (std_x, std_y) = ctx.paffine().transform_distance(std_x, std_y); // The deviation can become negative here due to the transform. |