[librsvg: 3/8] ImageSurface.draw() - let the callback consume the cr




commit 5ff7a1d4eaee4544a9cc566ea0138b950e3fe8fc
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed May 5 19:49:45 2021 -0500

    ImageSurface.draw() - let the callback consume the cr
    
    This cr is temporary and just used within the callback.

 src/drawing_ctx.rs                  | 2 +-
 src/surface_utils/shared_surface.rs | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/drawing_ctx.rs b/src/drawing_ctx.rs
index 190115e5..bdbf89ef 100644
--- a/src/drawing_ctx.rs
+++ b/src/drawing_ctx.rs
@@ -1117,7 +1117,7 @@ impl DrawingCtx {
         surface.draw(&mut |cr| {
             // FIXME: we are ignoring any error
 
-            let _ = self.with_cairo_context(cr, &mut |dc| {
+            let _ = self.with_cairo_context(&cr, &mut |dc| {
                 dc.set_paint_source(paint_source, acquired_nodes)
                     .map(|had_paint_server| {
                         if had_paint_server {
diff --git a/src/surface_utils/shared_surface.rs b/src/surface_utils/shared_surface.rs
index b1949d4a..98abf4b0 100644
--- a/src/surface_utils/shared_surface.rs
+++ b/src/surface_utils/shared_surface.rs
@@ -1324,10 +1324,10 @@ impl ImageSurface<Exclusive> {
     #[inline]
     pub fn draw(
         &mut self,
-        draw_fn: &mut dyn FnMut(&cairo::Context) -> Result<(), cairo::Error>,
+        draw_fn: &mut dyn FnMut(cairo::Context) -> Result<(), cairo::Error>,
     ) -> Result<(), cairo::Error> {
         let cr = cairo::Context::new(&self.surface);
-        draw_fn(&cr)
+        draw_fn(cr)
     }
 
     pub fn rows_mut(&mut self) -> RowsMut<'_> {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]