[librsvg/librsvg-2.50] Really make the initial viewport have its upper-left corner at (0, 0)
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.50] Really make the initial viewport have its upper-left corner at (0, 0)
- Date: Fri, 2 Oct 2020 19:24:37 +0000 (UTC)
commit 81ec44d17c687ac32c1b790c276898a31c13a82f
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Sep 28 19:29:23 2020 -0500
Really make the initial viewport have its upper-left corner at (0, 0)
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 b7ded244..ff0aa5a8 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -205,10 +205,17 @@ impl DrawingCtx {
// "... the initial viewport coordinate system (and therefore
// the initial user coordinate system) must have its origin at
// the top/left of the viewport"
+
+ // Translate so (0, 0) is at the viewport's upper-left corner.
+ cr.translate(viewport.x0, viewport.y0);
+ let transform = Transform::from(cr.get_matrix());
+
+ // Per the spec, so the viewport has (0, 0) as upper-left.
+ let viewport = viewport.translate((-viewport.x0, -viewport.y0));
let vbox = ViewBox::from(viewport);
let initial_viewport = Viewport {
- transform: Transform::from(cr.get_matrix()),
+ transform,
vbox,
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]