[librsvg: 4/15] layout::TextSpan - store the layout's gravity here instead of extracting it elsewhere
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 4/15] layout::TextSpan - store the layout's gravity here instead of extracting it elsewhere
- Date: Mon, 18 Oct 2021 23:15:47 +0000 (UTC)
commit 1526fd7fb2988cf588d8a0c2b41a6658a21bf278
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Oct 18 11:45:18 2021 -0500
layout::TextSpan - store the layout's gravity here instead of extracting it elsewhere
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/613>
src/drawing_ctx.rs | 6 ++----
src/layout.rs | 1 +
src/text.rs | 3 +++
3 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/drawing_ctx.rs b/src/drawing_ctx.rs
index b885e2c6..9ddd1508 100644
--- a/src/drawing_ctx.rs
+++ b/src/drawing_ctx.rs
@@ -1362,9 +1362,7 @@ impl DrawingCtx {
let paint_order = values.paint_order();
- let gravity = span.layout.context().unwrap().gravity();
-
- let bbox = compute_text_box(&span.layout, span.x, span.y, transform, gravity);
+ let bbox = compute_text_box(&span.layout, span.x, span.y, transform, span.gravity);
if bbox.is_none() {
return Ok(self.empty_bbox());
}
@@ -1377,7 +1375,7 @@ impl DrawingCtx {
setup_cr_for_stroke(&self.cr, &span.stroke);
- let rotation_from_gravity = gravity.to_rotation();
+ let rotation_from_gravity = span.gravity.to_rotation();
let rotation = if !rotation_from_gravity.approx_eq_cairo(0.0) {
Some(-rotation_from_gravity)
} else {
diff --git a/src/layout.rs b/src/layout.rs
index 7eaccab1..c0dff1fb 100644
--- a/src/layout.rs
+++ b/src/layout.rs
@@ -96,6 +96,7 @@ pub struct Image {
/// A single text span in user-space coordinates.
pub struct TextSpan {
pub layout: pango::Layout,
+ pub gravity: pango::Gravity,
pub is_visible: bool,
pub x: f64,
pub y: f64,
diff --git a/src/text.rs b/src/text.rs
index 7f185972..103dcd4b 100644
--- a/src/text.rs
+++ b/src/text.rs
@@ -309,8 +309,11 @@ impl PositionedSpan {
let text_rendering = self.values.text_rendering();
+ let gravity = layout.context().unwrap().gravity();
+
let span = layout::TextSpan {
layout,
+ gravity,
is_visible,
x,
y,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]