[librsvg: 5/14] Return SharedImageSurface from convolve()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 5/14] Return SharedImageSurface from convolve()
- Date: Sun, 15 Jul 2018 17:55:46 +0000 (UTC)
commit 5576c03c6f6f3fdf431cb1b4a64188ca1fa38f06
Author: Ivan Molodetskikh <yalterz gmail com>
Date: Sun Jul 15 13:25:02 2018 +0300
Return SharedImageSurface from convolve()
rsvg_internals/src/filters/gaussian_blur.rs | 20 ++++++++++----------
rsvg_internals/src/surface_utils/shared_surface.rs | 4 ++--
2 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/rsvg_internals/src/filters/gaussian_blur.rs b/rsvg_internals/src/filters/gaussian_blur.rs
index be3b825a..4a62520c 100644
--- a/rsvg_internals/src/filters/gaussian_blur.rs
+++ b/rsvg_internals/src/filters/gaussian_blur.rs
@@ -158,40 +158,40 @@ fn three_box_blurs(
let mut surface = input_surface.clone();
for _ in 0..3 {
- surface = SharedImageSurface::new(surface.convolve(
+ surface = surface.convolve(
bounds,
((cols / 2) as i32, (rows / 2) as i32),
&kernel,
EdgeMode::None,
- )?)?;
+ )?;
}
surface
} else {
// Even kernel sizes have a more interesting scheme.
- let surface = SharedImageSurface::new(input_surface.convolve(
+ let surface = input_surface.convolve(
bounds,
((cols / 2) as i32, (rows / 2) as i32),
&kernel,
EdgeMode::None,
- )?)?;
+ )?;
- let surface = SharedImageSurface::new(surface.convolve(
+ let surface = surface.convolve(
bounds,
(max((cols / 2) as i32 - 1, 0), max((rows / 2) as i32 - 1, 0)),
&kernel,
EdgeMode::None,
- )?)?;
+ )?;
let d = d + 1;
let (rows, cols) = if vertical { (d, 1) } else { (1, d) };
let kernel = Matrix::new(rows, cols, box_blur_kernel(d));
- SharedImageSurface::new(surface.convolve(
+ surface.convolve(
bounds,
((cols / 2) as i32, (rows / 2) as i32),
&kernel,
EdgeMode::None,
- )?)?
+ )?
};
Ok(surface)
@@ -214,12 +214,12 @@ fn gaussian_blur(
};
let kernel = Matrix::new(rows, cols, kernel);
- Ok(SharedImageSurface::new(input_surface.convolve(
+ Ok(input_surface.convolve(
bounds,
((cols / 2) as i32, (rows / 2) as i32),
&kernel,
EdgeMode::None,
- )?)?)
+ )?)
}
impl Filter for GaussianBlur {
diff --git a/rsvg_internals/src/surface_utils/shared_surface.rs
b/rsvg_internals/src/surface_utils/shared_surface.rs
index fc74b511..1ec35cc9 100644
--- a/rsvg_internals/src/surface_utils/shared_surface.rs
+++ b/rsvg_internals/src/surface_utils/shared_surface.rs
@@ -267,7 +267,7 @@ impl SharedImageSurface {
target: (i32, i32),
kernel: &Matrix<f64>,
edge_mode: EdgeMode,
- ) -> Result<ImageSurface, cairo::Status> {
+ ) -> Result<SharedImageSurface, cairo::Status> {
assert!(kernel.rows() >= 1);
assert!(kernel.cols() >= 1);
@@ -315,7 +315,7 @@ impl SharedImageSurface {
}
}
- Ok(output_surface)
+ SharedImageSurface::new(output_surface)
}
/// Returns a raw pointer to the underlying surface.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]