[librsvg: 21/27] Use - use NormalizeParams
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 21/27] Use - use NormalizeParams
- Date: Mon, 10 May 2021 16:06:43 +0000 (UTC)
commit bb9400f6c000afd3437ca0a61adfd32d3537d755
Author: Federico Mena Quintero <federico gnome org>
Date: Fri May 7 21:35:44 2021 -0500
Use - use NormalizeParams
It is a bit suspect that DrawingCtx::draw_from_use_node gets used from
the Use element, and yet it has to create the NormalizeParams.
src/drawing_ctx.rs | 5 +++--
src/structure.rs | 10 +++++-----
2 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/src/drawing_ctx.rs b/src/drawing_ctx.rs
index 52aa5a09..71c7acef 100644
--- a/src/drawing_ctx.rs
+++ b/src/drawing_ctx.rs
@@ -1589,8 +1589,9 @@ impl DrawingCtx {
};
let values = cascaded.get();
- let params = self.get_view_params();
- let use_rect = borrow_element_as!(node, Use).get_rect(values, ¶ms);
+ let view_params = self.get_view_params();
+ let params = NormalizeParams::new(values, &view_params);
+ let use_rect = borrow_element_as!(node, Use).get_rect(¶ms);
// width or height set to 0 disables rendering of the element
// https://www.w3.org/TR/SVG/struct.html#UseElementWidthAttribute
diff --git a/src/structure.rs b/src/structure.rs
index e5828051..112ced0e 100644
--- a/src/structure.rs
+++ b/src/structure.rs
@@ -250,11 +250,11 @@ pub struct Use {
}
impl Use {
- pub fn get_rect(&self, values: &ComputedValues, params: &ViewParams) -> Rect {
- let x = self.x.normalize(values, ¶ms);
- let y = self.y.normalize(values, ¶ms);
- let w = self.width.normalize(values, ¶ms);
- let h = self.height.normalize(values, ¶ms);
+ pub fn get_rect(&self, params: &NormalizeParams) -> Rect {
+ let x = self.x.to_user(params);
+ let y = self.y.to_user(params);
+ let w = self.width.to_user(params);
+ let h = self.height.to_user(params);
Rect::new(x, y, x + w, y + h)
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]