[librsvg: 12/21] Test compound transforms and use post_transform instead of multiply in TransformProperty::to_transfo
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 12/21] Test compound transforms and use post_transform instead of multiply in TransformProperty::to_transfo
- Date: Tue, 31 Aug 2021 18:37:37 +0000 (UTC)
commit 7ffe5f9be8443e5fb68051f981aaa986621efaf7
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Aug 23 19:56:09 2021 -0500
Test compound transforms and use post_transform instead of multiply in TransformProperty::to_transform
Using Transform::multiply() is equivalent to using
Transform::post_transform, but the latter is consistent with the spec
and with the rest of the code (e.g. parse_transform_list())
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/576>
src/transform.rs | 2 +-
tests/src/primitives.rs | 14 ++++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/src/transform.rs b/src/transform.rs
index 6780e53c..b9344f8d 100644
--- a/src/transform.rs
+++ b/src/transform.rs
@@ -66,7 +66,7 @@ impl TransformProperty {
TransformFunction::SkewX(ax) => Transform::new_skew(*ax, Angle::new(0.0)),
TransformFunction::SkewY(ay) => Transform::new_skew(Angle::new(0.0), *ay),
};
- final_transform = Transform::multiply(&final_transform, &t);
+ final_transform = final_transform.post_transform(&t);
}
}
diff --git a/tests/src/primitives.rs b/tests/src/primitives.rs
index 9a8553a6..e1564bf8 100644
--- a/tests/src/primitives.rs
+++ b/tests/src/primitives.rs
@@ -386,3 +386,17 @@ test_compare_render_output!(
<rect x="10" y="10" width="20" height="20" fill="black" style="transform: translate(40px, 40px);"/>
</svg>"##,
);
+
+test_compare_render_output!(
+ compound_transform_property,
+ 100,
+ 100,
+ br##"<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="-30 -30 60 60">
+ <rect x="0" y="0" width="20" height="20" fill="black" style="transform: translate(-10px, -20px) scale(2)
rotate(45deg);"/>
+</svg>"##,
+ br##"<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="-30 -30 60 60">
+ <rect x="0" y="0" width="20" height="20" fill="black" transform="translate(-10 -20) scale(2) rotate(45)"/>
+</svg>"##,
+);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]