[librsvg] NodeSvg: Don't inline the computation of the SVG's affine
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] NodeSvg: Don't inline the computation of the SVG's affine
- Date: Thu, 23 Mar 2017 14:37:48 +0000 (UTC)
commit 5ecce07b482d5b991a47d16ba03a51f80ad7cbb5
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Mar 23 07:31:54 2017 -0600
NodeSvg: Don't inline the computation of the SVG's affine
Make it more clear by actually performing each step separately.
rust/src/structure.rs | 13 +++++--------
1 files changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/rust/src/structure.rs b/rust/src/structure.rs
index e9999b9..45076da 100644
--- a/rust/src/structure.rs
+++ b/rust/src/structure.rs
@@ -182,14 +182,11 @@ impl NodeTrait for NodeSvg {
let (x, y, w, h) = self.preserve_aspect_ratio.get ().compute (vbox.rect.width, vbox.rect.height,
nx, ny, nw, nh);
- let affine = cairo::Matrix::new (w / vbox.rect.width,
- 0.0,
- 0.0,
- h / vbox.rect.height,
- x - vbox.rect.x * w / vbox.rect.width,
- y - vbox.rect.y * h / vbox.rect.height);
-
- drawing_ctx::set_current_state_affine (draw_ctx, cairo::Matrix::multiply (&affine, &affine_old));
+ let mut affine = affine_old;
+ affine.translate (x, y);
+ affine.scale (w / vbox.rect.width, h / vbox.rect.height);
+ affine.translate (-vbox.rect.x, -vbox.rect.y);
+ drawing_ctx::set_current_state_affine (draw_ctx, affine);
drawing_ctx::push_view_box (draw_ctx, vbox.rect.width, vbox.rect.height);
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]