Skip to content

Commit 58844b0

Browse files
authored
Add default implementation of push_clip_layer method (#31)
Signed-off-by: Nico Burns <nico@nicoburns.com>
1 parent acde7a5 commit 58844b0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

crates/anyrender/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
//! - [anyrender_vello_cpu](https://docs.rs/anyrender_vello_cpu)
2929
3030
use kurbo::{Affine, Rect, Shape, Stroke};
31-
use peniko::{BlendMode, Color, Fill, FontData, ImageBrushRef, StyleRef};
31+
use peniko::{BlendMode, Color, Fill, FontData, ImageBrushRef, Mix, StyleRef};
3232
use std::sync::Arc;
3333

3434
pub mod wasm_send_sync;
@@ -98,7 +98,10 @@ pub trait PaintScene {
9898
/// Pushes a new clip layer clipped by the specified shape.
9999
/// Every drawing command after this call will be clipped by the shape until the layer is popped.
100100
/// However, the transforms are not saved or modified by the layer stack.
101-
fn push_clip_layer(&mut self, transform: Affine, clip: &impl Shape);
101+
fn push_clip_layer(&mut self, transform: Affine, clip: &impl Shape) {
102+
#[allow(deprecated, reason = "backwards compatibility until the next release")]
103+
self.push_layer(BlendMode::from(Mix::Clip), 1.0, transform, clip);
104+
}
102105

103106
/// Pops the current layer.
104107
fn pop_layer(&mut self);

0 commit comments

Comments
 (0)