[librsvg: 10/37] PositionedSpan: store both the nominal position and the rendered position
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 10/37] PositionedSpan: store both the nominal position and the rendered position
- Date: Fri, 28 Dec 2018 03:24:48 +0000 (UTC)
commit 91a4019450767844f09480cb07581a03e6b8f1fa
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Oct 30 15:09:49 2018 -0600
PositionedSpan: store both the nominal position and the rendered position
rsvg_internals/src/text.rs | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/rsvg_internals/src/text.rs b/rsvg_internals/src/text.rs
index 28f09359..404d72ae 100644
--- a/rsvg_internals/src/text.rs
+++ b/rsvg_internals/src/text.rs
@@ -60,8 +60,8 @@ struct MeasuredSpan {
struct PositionedSpan {
layout: pango::Layout,
values: ComputedValues,
- x: f64,
- y: f64,
+ position: (f64, f64),
+ rendered_position: (f64, f64),
}
impl Span {
@@ -115,7 +115,7 @@ impl PositionedSpan {
.normalize(&values, &draw_ctx.get_view_params());
let offset = baseline + baseline_shift;
- let (x, y) = if values.text_gravity_is_vertical() {
+ let (render_x, render_y) = if values.text_gravity_is_vertical() {
(x + offset, y)
} else {
(x, y - offset)
@@ -124,13 +124,19 @@ impl PositionedSpan {
PositionedSpan {
layout: measured.layout.clone(),
values,
- x,
- y,
+ position: (x, y),
+ rendered_position: (render_x, render_y),
}
}
fn draw(&self, draw_ctx: &mut DrawingCtx, clipping: bool) -> Result<(), RenderingError> {
- draw_ctx.draw_pango_layout(&self.layout, &self.values, self.x, self.y, clipping)
+ draw_ctx.draw_pango_layout(
+ &self.layout,
+ &self.values,
+ self.rendered_position.0,
+ self.rendered_position.1,
+ clipping,
+ )
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]