summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2023-03-22 12:14:02 -0600
committerMarge Bot <marge-bot@gnome.org>2023-03-23 01:41:14 +0000
commitdfa94acbff1e11bf3932368e113d151e961df0e2 (patch)
tree64cbe62a66af0e4a18ef1dd35f22ab00f54c9904
parent2b1cb3bac41dd0b3afff44c544bf5e00f40eb879 (diff)
downloadlibrsvg-dfa94acbff1e11bf3932368e113d151e961df0e2.tar.gz
StackingCtx: extract the current_color here instead of in with_discrete_layer
I want to remove the use of ComputedValues in with_discrete_layer; this removes one of the uses. Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/816>
-rw-r--r--src/drawing_ctx.rs8
-rw-r--r--src/layout.rs5
2 files changed, 8 insertions, 5 deletions
diff --git a/src/drawing_ctx.rs b/src/drawing_ctx.rs
index 96ce7df5..5c5bc6fc 100644
--- a/src/drawing_ctx.rs
+++ b/src/drawing_ctx.rs
@@ -796,8 +796,6 @@ impl DrawingCtx {
.unwrap(),
)?;
- let current_color = values.color().0;
-
let params = temporary_draw_ctx.get_view_params();
// TODO: the stroke/fill paint are already resolved for shapes. Outside of shapes,
@@ -810,7 +808,7 @@ impl DrawingCtx {
.resolve(
acquired_nodes,
values.stroke_opacity().0,
- current_color,
+ stacking_ctx.current_color,
None,
None,
self.session(),
@@ -825,7 +823,7 @@ impl DrawingCtx {
.resolve(
acquired_nodes,
values.fill_opacity().0,
- current_color,
+ stacking_ctx.current_color,
None,
None,
self.session(),
@@ -851,7 +849,7 @@ impl DrawingCtx {
&user_space_params,
stroke_paint_source,
fill_paint_source,
- current_color,
+ stacking_ctx.current_color,
bbox,
)?
.into_image_surface()?;
diff --git a/src/layout.rs b/src/layout.rs
index ac40ce95..7f55b275 100644
--- a/src/layout.rs
+++ b/src/layout.rs
@@ -5,6 +5,7 @@
use std::rc::Rc;
use std::sync::Arc;
+use cssparser::RGBA;
use float_cmp::approx_eq;
use crate::aspect_ratio::AspectRatio;
@@ -47,6 +48,7 @@ pub struct StackingContext {
pub transform: Transform,
pub opacity: Opacity,
pub filter: Filter,
+ pub current_color: RGBA,
pub clip_in_user_space: Option<Node>,
pub clip_in_object_space: Option<Node>,
pub mask: Option<Node>,
@@ -161,6 +163,8 @@ impl StackingContext {
let opacity;
let filter;
+ let current_color = values.color().0;
+
match element.element_data {
// "The opacity, filter and display properties do not apply to the mask element"
// https://drafts.fxtf.org/css-masking-1/#MaskElement
@@ -233,6 +237,7 @@ impl StackingContext {
transform,
opacity,
filter,
+ current_color,
clip_in_user_space,
clip_in_object_space,
mask,