[librsvg: 9/27] DrawingCtx.set_paint_source - new function, extracted from set_source_paint_server
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 9/27] DrawingCtx.set_paint_source - new function, extracted from set_source_paint_server
- Date: Fri, 5 Mar 2021 23:36:26 +0000 (UTC)
commit 2485dd575e740ceb11c7fb0450a4d6c27507068e
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Mar 4 19:34:30 2021 -0600
DrawingCtx.set_paint_source - new function, extracted from set_source_paint_server
Let's see if we can avoid passing the ComputedValues of the node being
filtered to the filters engine.
src/drawing_ctx.rs | 38 ++++++++++++++++++++++++--------------
1 file changed, 24 insertions(+), 14 deletions(-)
---
diff --git a/src/drawing_ctx.rs b/src/drawing_ctx.rs
index 8502eddb..62c3a4ad 100644
--- a/src/drawing_ctx.rs
+++ b/src/drawing_ctx.rs
@@ -1124,22 +1124,16 @@ impl DrawingCtx {
Ok(true)
}
- fn set_source_paint_server(
+ fn set_paint_source(
&mut self,
- acquired_nodes: &mut AcquiredNodes<'_>,
- paint_server: &PaintServer,
+ paint_source: &UserSpacePaintSource,
opacity: UnitInterval,
- bbox: &BoundingBox,
current_color: cssparser::RGBA,
- values: &ComputedValues,
+ acquired_nodes: &mut AcquiredNodes<'_>,
) -> Result<bool, RenderingError> {
- let paint_source = paint_server
- .resolve(acquired_nodes)?
- .to_user_space(bbox, self, values);
-
- match paint_source {
- UserSpacePaintSource::Gradient(gradient, c) => {
- if self.set_gradient(&gradient, opacity)? {
+ match *paint_source {
+ UserSpacePaintSource::Gradient(ref gradient, c) => {
+ if self.set_gradient(gradient, opacity)? {
Ok(true)
} else if let Some(c) = c {
self.set_color(c, opacity, current_color)
@@ -1147,8 +1141,8 @@ impl DrawingCtx {
Ok(false)
}
}
- UserSpacePaintSource::Pattern(pattern, c) => {
- if self.set_pattern(&pattern, acquired_nodes, opacity)? {
+ UserSpacePaintSource::Pattern(ref pattern, c) => {
+ if self.set_pattern(pattern, acquired_nodes, opacity)? {
Ok(true)
} else if let Some(c) = c {
self.set_color(c, opacity, current_color)
@@ -1161,6 +1155,22 @@ impl DrawingCtx {
}
}
+ fn set_source_paint_server(
+ &mut self,
+ acquired_nodes: &mut AcquiredNodes<'_>,
+ paint_server: &PaintServer,
+ opacity: UnitInterval,
+ bbox: &BoundingBox,
+ current_color: cssparser::RGBA,
+ values: &ComputedValues,
+ ) -> Result<bool, RenderingError> {
+ let paint_source = paint_server
+ .resolve(acquired_nodes)?
+ .to_user_space(bbox, self, values);
+
+ self.set_paint_source(&paint_source, opacity, current_color, acquired_nodes)
+ }
+
/// Computes and returns a surface corresponding to the given paint server.
pub fn get_paint_server_surface(
&mut self,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]