[librsvg: 3/5] Make stroke_and_fill() return a Result<BoundingBox>
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 3/5] Make stroke_and_fill() return a Result<BoundingBox>
- Date: Fri, 20 Sep 2019 01:50:01 +0000 (UTC)
commit cd8c0fe14b4212896f207f9957c7c3c2405912b1
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Sep 17 20:44:25 2019 -0500
Make stroke_and_fill() return a Result<BoundingBox>
rsvg_internals/src/drawing_ctx.rs | 5 ++---
rsvg_internals/src/shapes.rs | 3 ++-
2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs
index ad06bef7..172d7669 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -706,7 +706,7 @@ impl DrawingCtx {
&mut self,
cr: &cairo::Context,
values: &ComputedValues,
- ) -> Result<(), RenderingError> {
+ ) -> Result<BoundingBox, RenderingError> {
cr.set_antialias(cairo::Antialias::from(values.shape_rendering));
self.setup_cr_for_stroke(cr, values);
@@ -716,7 +716,6 @@ impl DrawingCtx {
// rendering context to have an updated bbox; for example, for the
// coordinate system in patterns.
let bbox = compute_stroke_and_fill_box(cr, values);
- self.insert_bbox(&bbox);
let current_color = &values.color.0;
@@ -756,7 +755,7 @@ impl DrawingCtx {
// we leave it around from computing the bounding box
cr.new_path();
- res
+ res.and_then(|_: ()| Ok(bbox))
}
pub fn clip(&self, x: f64, y: f64, w: f64, h: f64) {
diff --git a/rsvg_internals/src/shapes.rs b/rsvg_internals/src/shapes.rs
index f91637fb..f368ac95 100644
--- a/rsvg_internals/src/shapes.rs
+++ b/rsvg_internals/src/shapes.rs
@@ -32,7 +32,8 @@ fn render_path_builder(
cr.set_fill_rule(cairo::FillRule::from(values.clip_rule));
} else {
cr.set_fill_rule(cairo::FillRule::from(values.fill_rule));
- dc.stroke_and_fill(&cr, values)?;
+ let bbox = dc.stroke_and_fill(&cr, values)?;
+ dc.insert_bbox(&bbox);
}
Ok(())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]