mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
canvas: Fully stateless backend (#38214)
I think this simplifies canvas backends greatly. Before there were many (needless) hoops from abstract to concrete (backend) and back, now we can do most stuff on abstract types. Testing: Existing WPT tests Fixes: #38022 try run: https://github.com/sagudev/servo/actions/runs/16450978211 Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
86d8317460
commit
d39e701b46
6 changed files with 650 additions and 806 deletions
|
@ -150,7 +150,10 @@ impl CanvasContextState {
|
|||
|
||||
fn text_options(&self) -> TextOptions {
|
||||
TextOptions {
|
||||
font: self.font_style.clone(),
|
||||
font: self
|
||||
.font_style
|
||||
.as_ref()
|
||||
.map(|font| servo_arc::Arc::new(font.clone())),
|
||||
align: self.text_align,
|
||||
baseline: self.text_baseline,
|
||||
}
|
||||
|
@ -1344,7 +1347,6 @@ impl CanvasState {
|
|||
self.saved_states
|
||||
.borrow_mut()
|
||||
.push(self.state.borrow().clone());
|
||||
self.send_canvas_2d_msg(Canvas2dMsg::SaveContext);
|
||||
}
|
||||
|
||||
#[cfg_attr(crown, allow(crown::unrooted_must_root))]
|
||||
|
@ -1353,7 +1355,7 @@ impl CanvasState {
|
|||
let mut saved_states = self.saved_states.borrow_mut();
|
||||
if let Some(state) = saved_states.pop() {
|
||||
self.state.borrow_mut().clone_from(&state);
|
||||
self.send_canvas_2d_msg(Canvas2dMsg::RestoreContext);
|
||||
self.send_canvas_2d_msg(Canvas2dMsg::PopClip);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue