[librsvg: 12/22] Compute all values for PositionedSpan before initializing it
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 12/22] Compute all values for PositionedSpan before initializing it
- Date: Thu, 23 Sep 2021 18:42:13 +0000 (UTC)
commit 64be38470b9ddd5e8c72b1796ab5f112e579b35e
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Sep 23 10:56:26 2021 -0500
Compute all values for PositionedSpan before initializing it
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/593>
src/text.rs | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/text.rs b/src/text.rs
index a2c3d002..6114d913 100644
--- a/src/text.rs
+++ b/src/text.rs
@@ -148,22 +148,25 @@ impl PositionedChunk {
let dx = mspan.dx;
let dy = mspan.dy;
- let (render_x, render_y) = if values.writing_mode().is_vertical() {
+ let rendered_position = if values.writing_mode().is_vertical() {
(x + offset + dx, y + dy)
} else {
(x + dx, y - offset + dy)
};
+ let next_span_x = x + mspan.advance.0 + dx;
+ let next_span_y = y + mspan.advance.1 + dy;
+
let positioned_span = PositionedSpan {
layout,
values,
- rendered_position: (render_x, render_y),
- next_span_x: x + mspan.advance.0 + dx,
- next_span_y: y + mspan.advance.1 + dy,
+ rendered_position,
+ next_span_x,
+ next_span_y,
};
- x = positioned_span.next_span_x;
- y = positioned_span.next_span_y;
+ x = next_span_x;
+ y = next_span_y;
positioned.push(positioned_span);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]