[librsvg: 1/7] drawing_ctx: simplify code
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 1/7] drawing_ctx: simplify code
- Date: Mon, 20 Jan 2020 22:43:05 +0000 (UTC)
commit 648ed7679f8039d0167fda23b3149d1e0ea110a0
Author: Paolo Borelli <pborelli gnome org>
Date: Fri Jan 17 22:36:14 2020 +0100
drawing_ctx: simplify code
We do not need to calculate the initial affine with offset, since
we only use it to transform a distance, hence offset does not
affect the result.
rsvg_internals/src/drawing_ctx.rs | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs
index 6e7d622d..e8213d4b 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -212,16 +212,13 @@ impl DrawingCtx {
fn size_for_temporary_surface(&self) -> (i32, i32) {
let (viewport_width, viewport_height) = (self.rect.width(), self.rect.height());
- let (scaled_width, scaled_height) = self
- .initial_affine_with_offset()
+ let (width, height) = self
+ .initial_affine
.transform_distance(viewport_width, viewport_height);
// We need a size in whole pixels, so use ceil() to ensure the whole viewport fits
// into the temporary surface.
- let width = scaled_width.ceil() as i32;
- let height = scaled_height.ceil() as i32;
-
- (width, height)
+ (width.ceil() as i32, height.ceil() as i32)
}
pub fn create_surface_for_toplevel_viewport(
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]