[librsvg: 31/38] 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: 31/38] Really make the initial viewport have its upper-left corner at (0, 0)
- Date: Tue, 29 Sep 2020 23:37:21 +0000 (UTC)
commit 1ff0f6c4ebc1b813f3f17bcb2a8656e0a5c62b78
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]