mirror of
https://github.com/servo/servo.git
synced 2025-08-11 08:25:32 +01:00
canvas: pop many clips on restore (#38496)
When restoring context/state we need to pop all clips from current state, before we just poped one (even if there was none). Testing: Added new WPT tests --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
c055e8b456
commit
c0cc8484f8
9 changed files with 161 additions and 11 deletions
|
@ -749,8 +749,10 @@ impl<DrawTarget: GenericDrawTarget> CanvasData<DrawTarget> {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn pop_clip(&mut self) {
|
||||
self.drawtarget.pop_clip();
|
||||
pub(crate) fn pop_clips(&mut self, clips: usize) {
|
||||
for _ in 0..clips {
|
||||
self.drawtarget.pop_clip();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -282,7 +282,7 @@ impl CanvasPaintThread {
|
|||
self.canvas(canvas_id).update_image_rendering();
|
||||
sender.send(()).unwrap();
|
||||
},
|
||||
Canvas2dMsg::PopClip => self.canvas(canvas_id).pop_clip(),
|
||||
Canvas2dMsg::PopClips(clips) => self.canvas(canvas_id).pop_clips(clips),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -348,14 +348,14 @@ impl Canvas {
|
|||
}
|
||||
}
|
||||
|
||||
fn pop_clip(&mut self) {
|
||||
fn pop_clips(&mut self, clips: usize) {
|
||||
match self {
|
||||
#[cfg(feature = "raqote")]
|
||||
Canvas::Raqote(canvas_data) => canvas_data.pop_clip(),
|
||||
Canvas::Raqote(canvas_data) => canvas_data.pop_clips(clips),
|
||||
#[cfg(feature = "vello")]
|
||||
Canvas::Vello(canvas_data) => canvas_data.pop_clip(),
|
||||
Canvas::Vello(canvas_data) => canvas_data.pop_clips(clips),
|
||||
#[cfg(feature = "vello_cpu")]
|
||||
Canvas::VelloCPU(canvas_data) => canvas_data.pop_clip(),
|
||||
Canvas::VelloCPU(canvas_data) => canvas_data.pop_clips(clips),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue