[librsvg: 7/22] PositionedChunk::from_measured - take the ViewParams instead of the whole DrawingCtx
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 7/22] PositionedChunk::from_measured - take the ViewParams instead of the whole DrawingCtx
- Date: Thu, 23 Sep 2021 18:42:10 +0000 (UTC)
commit 14572873245b6f3ffec1125c6d1b8a3843a82a01
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Sep 22 20:41:48 2021 -0500
PositionedChunk::from_measured - take the ViewParams instead of the whole DrawingCtx
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/593>
src/text.rs | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/src/text.rs b/src/text.rs
index 570003bb..d22e648e 100644
--- a/src/text.rs
+++ b/src/text.rs
@@ -6,7 +6,7 @@ use std::rc::Rc;
use crate::bbox::BoundingBox;
use crate::document::{AcquiredNodes, NodeId};
-use crate::drawing_ctx::DrawingCtx;
+use crate::drawing_ctx::{DrawingCtx, ViewParams};
use crate::element::{Draw, Element, ElementResult, SetAttributes};
use crate::error::*;
use crate::layout::{self, FontProperties, StackingContext, Stroke};
@@ -116,7 +116,7 @@ impl MeasuredChunk {
impl PositionedChunk {
fn from_measured(
measured: &MeasuredChunk,
- draw_ctx: &DrawingCtx,
+ view_params: &ViewParams,
x: f64,
y: f64,
) -> PositionedChunk {
@@ -135,10 +135,8 @@ impl PositionedChunk {
// Position each span
- let view_params = draw_ctx.get_view_params();
-
for measured_span in &measured.spans {
- let params = NormalizeParams::new(&measured_span.values, &view_params);
+ let params = NormalizeParams::new(&measured_span.values, view_params);
let positioned_span = PositionedSpan::from_measured(measured_span, ¶ms, x, y);
@@ -558,7 +556,7 @@ impl Draw for Text {
let chunk_x = chunk.x.unwrap_or(x);
let chunk_y = chunk.y.unwrap_or(y);
- let positioned = PositionedChunk::from_measured(chunk, dc, chunk_x, chunk_y);
+ let positioned = PositionedChunk::from_measured(chunk, &view_params, chunk_x, chunk_y);
x = positioned.next_chunk_x;
y = positioned.next_chunk_y;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]