[librsvg: 10/14] filters: shorten code in context.rs



commit bf75e8a247fba551f986d59de12453f840da442c
Author: Paolo Borelli <pborelli gnome org>
Date:   Tue Jan 14 20:50:06 2020 +0100

    filters: shorten code in context.rs

 rsvg_internals/src/filters/context.rs | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)
---
diff --git a/rsvg_internals/src/filters/context.rs b/rsvg_internals/src/filters/context.rs
index 4c242c8f..2e427297 100644
--- a/rsvg_internals/src/filters/context.rs
+++ b/rsvg_internals/src/filters/context.rs
@@ -220,18 +220,11 @@ impl FilterContext {
     pub fn into_output(self) -> Result<SharedImageSurface, cairo::Status> {
         match self.last_result {
             Some(FilterOutput { surface, bounds }) => surface.to_srgb(bounds),
-            None => {
-                let empty_surface = cairo::ImageSurface::create(
-                    cairo::Format::ARgb32,
-                    self.source_surface.width(),
-                    self.source_surface.height(),
-                )?;
-
-                Ok(SharedImageSurface::wrap(
-                    empty_surface,
-                    SurfaceType::AlphaOnly,
-                )?)
-            }
+            None => SharedImageSurface::empty(
+                self.source_surface.width(),
+                self.source_surface.height(),
+                SurfaceType::AlphaOnly,
+            ),
         }
     }
 


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