[librsvg: 23/30] Handle cairo errors in paint_surface
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 23/30] Handle cairo errors in paint_surface
- Date: Wed, 23 Jun 2021 23:05:40 +0000 (UTC)
commit 137fdff85ce195a90f97bb1975ffa7ccbb4780b7
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Jun 21 20:15:42 2021 -0500
Handle cairo errors in paint_surface
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/516>
src/drawing_ctx.rs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/drawing_ctx.rs b/src/drawing_ctx.rs
index a25e5570..4767727c 100644
--- a/src/drawing_ctx.rs
+++ b/src/drawing_ctx.rs
@@ -1251,7 +1251,7 @@ impl DrawingCtx {
)
}
- fn paint_surface(&mut self, surface: &SharedImageSurface, width: f64, height: f64) {
+ fn paint_surface(&mut self, surface: &SharedImageSurface, width: f64, height: f64) -> Result<(),
cairo::Error> {
let cr = self.cr.clone();
// We need to set extend appropriately, so can't use cr.set_source_surface().
@@ -1263,12 +1263,12 @@ impl DrawingCtx {
// transparent almost everywhere without this fix (which it shouldn't).
let ptn = surface.to_cairo_pattern();
ptn.set_extend(cairo::Extend::Pad);
- cr.set_source(&ptn);
+ cr.set_source(&ptn)?;
// Clip is needed due to extend being set to pad.
clip_to_rectangle(&cr, &Rect::from_size(width, height));
- cr.paint();
+ cr.paint()
}
pub fn draw_image(
@@ -1315,7 +1315,7 @@ impl DrawingCtx {
if let Some(_params) =
dc.push_new_viewport(Some(vbox), image.rect, image.aspect, clip_mode)
{
- dc.paint_surface(&image.surface, image_width, image_height);
+ dc.paint_surface(&image.surface, image_width, image_height)?;
}
Ok(bounds)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]