summaryrefslogtreecommitdiff
path: root/src/drawing_ctx.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/drawing_ctx.rs')
-rw-r--r--src/drawing_ctx.rs22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/drawing_ctx.rs b/src/drawing_ctx.rs
index c9cc9232..d6632888 100644
--- a/src/drawing_ctx.rs
+++ b/src/drawing_ctx.rs
@@ -358,8 +358,26 @@ impl DrawingCtx {
*self.initial_viewport.vbox
}
- pub fn toplevel_transform(&self) -> Transform {
- self.initial_viewport.transform.clone()
+ /// Gets the transform that will be used on the target surface,
+ /// whether using an isolated stacking context or not.
+ ///
+ /// This is only used in the text code, and we should probably try
+ /// to remove it.
+ pub fn get_transform_for_stacking_ctx(
+ &self,
+ stacking_ctx: &StackingContext,
+ ) -> Result<ValidTransform, RenderingError> {
+ if stacking_ctx.should_isolate() {
+ let affines = CompositingAffines::new(
+ *self.get_transform(),
+ self.initial_viewport.transform,
+ self.cr_stack.borrow().len(),
+ );
+
+ Ok(ValidTransform::try_from(affines.for_temporary_surface)?)
+ } else {
+ Ok(self.get_transform())
+ }
}
pub fn is_measuring(&self) -> bool {