[librsvg: 6/22] PositionedSpan::from_measured - compute the NormalizeParams in the caller
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 6/22] PositionedSpan::from_measured - compute the NormalizeParams in the caller
- Date: Thu, 23 Sep 2021 18:42:08 +0000 (UTC)
commit de4b907728b48d1943903eb0d6dfc824cd5659d3
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Sep 22 20:34:38 2021 -0500
PositionedSpan::from_measured - compute the NormalizeParams in the caller
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/593>
src/text.rs | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/src/text.rs b/src/text.rs
index c60b148d..570003bb 100644
--- a/src/text.rs
+++ b/src/text.rs
@@ -135,8 +135,12 @@ impl PositionedChunk {
// Position each span
+ let view_params = draw_ctx.get_view_params();
+
for measured_span in &measured.spans {
- let positioned_span = PositionedSpan::from_measured(measured_span, draw_ctx, x, y);
+ let params = NormalizeParams::new(&measured_span.values, &view_params);
+
+ let positioned_span = PositionedSpan::from_measured(measured_span, ¶ms, x, y);
x = positioned_span.next_span_x;
y = positioned_span.next_span_y;
@@ -222,16 +226,13 @@ impl MeasuredSpan {
impl PositionedSpan {
fn from_measured(
measured: &MeasuredSpan,
- draw_ctx: &DrawingCtx,
+ params: &NormalizeParams,
x: f64,
y: f64,
) -> PositionedSpan {
let layout = measured.layout.clone();
let values = measured.values.clone();
- let view_params = draw_ctx.get_view_params();
- let params = NormalizeParams::new(&values, &view_params);
-
let baseline = f64::from(layout.baseline()) / f64::from(pango::SCALE);
let baseline_shift = values.baseline_shift().0.to_user(¶ms);
let offset = baseline + baseline_shift;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]