mirror of
https://github.com/servo/servo.git
synced 2025-07-16 03:43:38 +01:00
canvas: Add OffscreenCanvas 'transferToImageBitmap' method (#37880)
Follow the HTML speficication and add missing 'transferToImageBitmap' method to OffscreenCanvas interface. https://html.spec.whatwg.org/multipage/#dom-offscreencanvas-transfertoimagebitmap Testing: Improvements in the following tests - html/canvas/offscreen/compositing/2d.composite.grid* - html/canvas/offscreen/fill-and-stroke-styles/2d.gradient* - html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas* - html/canvas/offscreen/reset/2d.reset* - html/canvas/offscreen/text/2d.text* Fixes (partially): #34111 Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
This commit is contained in:
parent
70b0fb840e
commit
9bd8d4f026
46 changed files with 110 additions and 84 deletions
|
@ -292,6 +292,14 @@ impl CanvasState {
|
|||
*self.state.borrow_mut() = CanvasContextState::new();
|
||||
}
|
||||
|
||||
pub(crate) fn reset_bitmap(&self) {
|
||||
if !self.is_paintable() {
|
||||
return;
|
||||
}
|
||||
|
||||
self.send_canvas_2d_msg(Canvas2dMsg::ClearRect(self.size.get().to_f32().into()));
|
||||
}
|
||||
|
||||
fn create_drawable_rect(&self, x: f64, y: f64, w: f64, h: f64) -> Option<Rect<f32>> {
|
||||
if !([x, y, w, h].iter().all(|val| val.is_finite())) {
|
||||
return None;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue