[librsvg: 2/4] filters: use compose method also for FeMerge
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 2/4] filters: use compose method also for FeMerge
- Date: Sat, 28 Dec 2019 18:43:39 +0000 (UTC)
commit b210fe702a397df3ed5c0688239bd05ed6355a28
Author: Paolo Borelli <pborelli gnome org>
Date: Fri Dec 27 22:24:31 2019 +0100
filters: use compose method also for FeMerge
rsvg_internals/src/filters/merge.rs | 36 ++++--------------------------------
1 file changed, 4 insertions(+), 32 deletions(-)
---
diff --git a/rsvg_internals/src/filters/merge.rs b/rsvg_internals/src/filters/merge.rs
index eb47e735..8b55adf4 100644
--- a/rsvg_internals/src/filters/merge.rs
+++ b/rsvg_internals/src/filters/merge.rs
@@ -69,39 +69,11 @@ impl FeMergeNode {
if output_surface.is_none() {
return Ok(input.surface().clone());
}
- let output_surface = output_surface.unwrap();
-
- // If we're combining two alpha-only surfaces, the result is alpha-only. Otherwise the
- // result is whatever the non-alpha-only type we're working on (which can be either sRGB or
- // linear sRGB depending on color-interpolation-filters).
- let surface_type = if input.surface().is_alpha_only() {
- output_surface.surface_type()
- } else {
- if !output_surface.is_alpha_only() {
- // All surface types should match (this is enforced by get_input()).
- assert_eq!(
- output_surface.surface_type(),
- input.surface().surface_type()
- );
- }
-
- input.surface().surface_type()
- };
-
- let output_surface = output_surface.into_image_surface()?;
-
- {
- let cr = cairo::Context::new(&output_surface);
- let r = cairo::Rectangle::from(bounds);
- cr.rectangle(r.x, r.y, r.width, r.height);
- cr.clip();
-
- input.surface().set_as_source_surface(&cr, 0f64, 0f64);
- cr.set_operator(cairo::Operator::Over);
- cr.paint();
- }
- Ok(SharedImageSurface::new(output_surface, surface_type)?)
+ input
+ .surface()
+ .compose(&output_surface.unwrap(), bounds, cairo::Operator::Over)
+ .map_err(FilterError::CairoError)
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]