summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2023-03-21 21:54:30 -0600
committerMarge Bot <marge-bot@gnome.org>2023-03-23 01:41:14 +0000
commitc6ec3a7510376003a474876a2c3df0eac8108d71 (patch)
treed8c6ff335971146d42087753463f5583f1747e98
parent607895ec8766e3b9c6b72ec195ad9802a66e94c9 (diff)
downloadlibrsvg-c6ec3a7510376003a474876a2c3df0eac8108d71.tar.gz
draw_shape: use get_transform_for_stacking_ctx() as well
This is the only other place apart from text.rs that used the transform passed in the draw_fn callback from with_discrete_layer(). It turns out that get_transform_for_stacking_ctx() needs to know whether we are creating a clipping path; in that case, there's no need to look at the stacking context. This is getting convoluted; I kind of want to split the clipping stuff away from the main draw() method. Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/816>
-rw-r--r--src/drawing_ctx.rs9
-rw-r--r--src/text.rs2
2 files changed, 7 insertions, 4 deletions
diff --git a/src/drawing_ctx.rs b/src/drawing_ctx.rs
index d6632888..9e5bf85f 100644
--- a/src/drawing_ctx.rs
+++ b/src/drawing_ctx.rs
@@ -366,8 +366,9 @@ impl DrawingCtx {
pub fn get_transform_for_stacking_ctx(
&self,
stacking_ctx: &StackingContext,
+ clipping: bool,
) -> Result<ValidTransform, RenderingError> {
- if stacking_ctx.should_isolate() {
+ if stacking_ctx.should_isolate() && !clipping {
let affines = CompositingAffines::new(
*self.get_transform(),
self.initial_viewport.transform,
@@ -1329,10 +1330,12 @@ impl DrawingCtx {
values,
clipping,
None,
- &mut |an, dc, transform| {
+ &mut |an, dc, _transform| {
let cr = dc.cr.clone();
+
+ let transform = dc.get_transform_for_stacking_ctx(stacking_ctx, clipping)?;
let mut path_helper =
- PathHelper::new(&cr, *transform, &shape.path, shape.stroke.line_cap);
+ PathHelper::new(&cr, transform, &shape.path, shape.stroke.line_cap);
if clipping {
if shape.is_visible {
diff --git a/src/text.rs b/src/text.rs
index 77e3fb60..997e7ae4 100644
--- a/src/text.rs
+++ b/src/text.rs
@@ -784,7 +784,7 @@ impl ElementTrait for Text {
);
let layout_text = {
- let transform = draw_ctx.get_transform_for_stacking_ctx(&stacking_ctx)?;
+ let transform = draw_ctx.get_transform_for_stacking_ctx(&stacking_ctx, clipping)?;
let layout_context = LayoutContext {
writing_mode: values.writing_mode(),