[librsvg: 4/8] compute_text_bbox(): Don't mutate the bbox directly; use its methods
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 4/8] compute_text_bbox(): Don't mutate the bbox directly; use its methods
- Date: Tue, 25 Sep 2018 23:50:40 +0000 (UTC)
commit 7b399dae591d515be181b098e12e2adff1116441
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Sep 25 17:53:03 2018 -0500
compute_text_bbox(): Don't mutate the bbox directly; use its methods
rsvg_internals/src/drawing_ctx.rs | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs
index fd2aa020..b7f8ad22 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -864,30 +864,26 @@ fn compute_text_bbox(
) -> BoundingBox {
let pango_scale = f64::from(pango::SCALE);
- let mut bbox = BoundingBox::new(affine);
-
let ink_x = f64::from(ink.x);
let ink_y = f64::from(ink.y);
let ink_width = f64::from(ink.width);
let ink_height = f64::from(ink.height);
if gravity_is_vertical(gravity) {
- bbox.rect = Some(cairo::Rectangle {
+ BoundingBox::new(affine).with_rect(Some(cairo::Rectangle {
x: x + (ink_x - ink_height) / pango_scale,
y: y + ink_y / pango_scale,
width: ink_height / pango_scale,
height: ink_width / pango_scale,
- });
+ }))
} else {
- bbox.rect = Some(cairo::Rectangle {
+ BoundingBox::new(affine).with_rect(Some(cairo::Rectangle {
x: x + ink_x / pango_scale,
y: y + ink_y / pango_scale,
width: ink_width / pango_scale,
height: ink_height / pango_scale,
- });
+ }))
}
-
- bbox
}
fn compute_stroke_and_fill_box(cr: &cairo::Context, values: &ComputedValues) -> BoundingBox {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]