[librsvg] (#590): Fix regression when rendering masks
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] (#590): Fix regression when rendering masks
- Date: Thu, 23 Apr 2020 16:32:15 +0000 (UTC)
commit 38602be9f484d2e24ad1b360e72b6caec5c9759a
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Apr 23 11:24:08 2020 -0500
(#590): Fix regression when rendering masks
There was a cut&paste error in Mask::get_units(). I'm not sure why
the test suite didn't catch this; maybe we don't have a test with the
defaults for maskUnits and maskContentUnits?
Fixes https://gitlab.gnome.org/GNOME/librsvg/-/issues/590
rsvg_internals/src/structure.rs | 2 +-
.../fixtures/reftests/bugs/590-mask-units-ref.png | Bin 0 -> 2701 bytes
tests/fixtures/reftests/bugs/590-mask-units.svg | 26 +++++++++++++++++++++
3 files changed, 27 insertions(+), 1 deletion(-)
---
diff --git a/rsvg_internals/src/structure.rs b/rsvg_internals/src/structure.rs
index d1325bbb..3d3ff469 100644
--- a/rsvg_internals/src/structure.rs
+++ b/rsvg_internals/src/structure.rs
@@ -427,7 +427,7 @@ impl Default for Mask {
impl Mask {
pub fn get_units(&self) -> CoordUnits {
- CoordUnits::from(self.content_units)
+ CoordUnits::from(self.units)
}
pub fn get_content_units(&self) -> CoordUnits {
diff --git a/tests/fixtures/reftests/bugs/590-mask-units-ref.png
b/tests/fixtures/reftests/bugs/590-mask-units-ref.png
new file mode 100644
index 00000000..3647c930
Binary files /dev/null and b/tests/fixtures/reftests/bugs/590-mask-units-ref.png differ
diff --git a/tests/fixtures/reftests/bugs/590-mask-units.svg b/tests/fixtures/reftests/bugs/590-mask-units.svg
new file mode 100644
index 00000000..14e2e719
--- /dev/null
+++ b/tests/fixtures/reftests/bugs/590-mask-units.svg
@@ -0,0 +1,26 @@
+<svg preserveAspectRatio="xMidYMid" viewBox="-70 -100 140 200" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
+ <defs>
+ <!-- A square mask -->
+ <mask id="square-mask">
+ <rect fill="#ffffff" height="49" stroke="none" width="49" x="-49" y="24.5"/>
+ </mask>
+ </defs>
+ <g fill="none" stroke="#292d2f" stroke-width="0.14">
+ <!-- Black background rectangle -->
+ <rect fill="#292d2f" height="200" stroke="#292d2f" width="140" x="-70" y="-100"/>
+
+ <!-- Draw a filled white circle and apply a square mask to only show the bottom left 90 degree arc -->
+ <g mask="url(#square-mask)">
+ <g fill="#ffffff" stroke="none" transform="matrix(-1.8369701987210297e-16 -1 1 -1.8369701987210297e-16
-24.5 49)">
+ <circle cx="24.5" cy="24.5" r="49"/>
+ </g>
+ </g>
+
+ <!-- Magenta outline of the square mask -->
+ <rect stroke="#ff00ff" height="49" fill="none" width="49" x="-49" y="24.5"/>
+ <!-- Yellow outline of the entire circle to mask -->
+ <g fill="none" stroke="#ffff00" transform="matrix(-1.8369701987210297e-16 -1 1 -1.8369701987210297e-16
-24.5 49)">
+ <circle cx="24.5" cy="24.5" r="49" />
+ </g>
+ </g>
+</svg>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]