[librsvg: 9/14] filters: port drawing_ctx to ExclusiveImageSurface
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 9/14] filters: port drawing_ctx to ExclusiveImageSurface
- Date: Wed, 15 Jan 2020 00:32:54 +0000 (UTC)
commit d03b0b25e6de1818f814d2931a356cb07b4fc6b5
Author: Paolo Borelli <pborelli gnome org>
Date: Tue Jan 14 03:26:00 2020 +0100
filters: port drawing_ctx to ExclusiveImageSurface
rsvg_internals/src/drawing_ctx.rs | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs
index f7cbbe9d..6e7d622d 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -31,7 +31,10 @@ use crate::property_defs::{
use crate::rect::{Rect, TransformRect};
use crate::shapes::Markers;
use crate::structure::{ClipPath, Mask, Symbol, Use};
-use crate::surface_utils::{shared_surface::SharedImageSurface, shared_surface::SurfaceType};
+use crate::surface_utils::{
+ shared_surface::ExclusiveImageSurface, shared_surface::SharedImageSurface,
+ shared_surface::SurfaceType,
+};
use crate::unit_interval::UnitInterval;
use crate::viewbox::ViewBox;
@@ -926,11 +929,9 @@ impl DrawingCtx {
//
// CSS Compositing and Blending, "isolation" property:
// https://www.w3.org/TR/compositing-1/#isolation
- let surface = cairo::ImageSurface::create(cairo::Format::ARgb32, width, height)?;
-
- {
- let cr = cairo::Context::new(&surface);
+ let mut surface = ExclusiveImageSurface::new(width, height, SurfaceType::SRgb)?;
+ surface.draw(&mut |cr| {
for (depth, draw) in self.cr_stack.iter().enumerate() {
let affines = CompositingAffines::new(
draw.get_matrix(),
@@ -942,9 +943,11 @@ impl DrawingCtx {
cr.set_source_surface(&draw.get_target(), 0.0, 0.0);
cr.paint();
}
- }
- SharedImageSurface::wrap(surface, SurfaceType::SRgb)
+ Ok(())
+ })?;
+
+ surface.share()
}
pub fn lookup_image(&self, href: &str) -> Result<SharedImageSurface, RenderingError> {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]