[librsvg: 7/27] setup_cr_for_stroke - use NormalizeParams
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 7/27] setup_cr_for_stroke - use NormalizeParams
- Date: Mon, 10 May 2021 16:06:42 +0000 (UTC)
commit 99fb1233d96360fa79ce042dae8ef37751718630
Author: Federico Mena Quintero <federico gnome org>
Date: Fri May 7 19:56:26 2021 -0500
setup_cr_for_stroke - use NormalizeParams
src/drawing_ctx.rs | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/src/drawing_ctx.rs b/src/drawing_ctx.rs
index 78d8fe2a..9c1eb25f 100644
--- a/src/drawing_ctx.rs
+++ b/src/drawing_ctx.rs
@@ -20,6 +20,7 @@ use crate::error::{AcquireError, ImplementationLimit, RenderingError};
use crate::filters::{self, FilterSpec};
use crate::float_eq_cairo::ApproxEqCairo;
use crate::gradient::{GradientVariant, SpreadMethod, UserSpaceGradient};
+use crate::length::*;
use crate::marker;
use crate::node::{CascadedValues, Node, NodeBorrow, NodeDraw};
use crate::paint_server::{PaintServer, UserSpacePaintSource};
@@ -1132,23 +1133,21 @@ impl DrawingCtx {
}
fn setup_cr_for_stroke(&self, cr: &cairo::Context, values: &ComputedValues) {
- let params = self.get_view_params();
+ let view_params = self.get_view_params();
+ let params = NormalizeParams::new(values, &view_params);
- cr.set_line_width(values.stroke_width().0.normalize(values, ¶ms));
+ cr.set_line_width(values.stroke_width().0.to_user(¶ms));
cr.set_miter_limit(values.stroke_miterlimit().0);
cr.set_line_cap(cairo::LineCap::from(values.stroke_line_cap()));
cr.set_line_join(cairo::LineJoin::from(values.stroke_line_join()));
if let StrokeDasharray(Dasharray::Array(ref dashes)) = values.stroke_dasharray() {
- let normalized_dashes: Vec<f64> = dashes
- .iter()
- .map(|l| l.normalize(values, ¶ms))
- .collect();
+ let normalized_dashes: Vec<f64> = dashes.iter().map(|l| l.to_user(¶ms)).collect();
let total_length = normalized_dashes.iter().fold(0.0, |acc, &len| acc + len);
if total_length > 0.0 {
- let offset = values.stroke_dashoffset().0.normalize(values, ¶ms);
+ let offset = values.stroke_dashoffset().0.to_user(¶ms);
cr.set_dash(&normalized_dashes, offset);
} else {
cr.set_dash(&[], 0.0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]