mirror of
https://github.com/servo/servo.git
synced 2025-07-16 11:53:39 +01:00
canvas: Use snapshot in canvas backends (#37863)
This removes assumption about pixel format from backend abstraction to actual backend implementation. This is important for vello. Testing: WPT tests --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
8df5e1e74d
commit
e1a891ea96
10 changed files with 174 additions and 292 deletions
|
@ -1186,14 +1186,7 @@ impl CanvasState {
|
|||
let size = snapshot.size();
|
||||
Ok(Some(CanvasPattern::new(
|
||||
global,
|
||||
snapshot
|
||||
.to_vec(
|
||||
Some(SnapshotAlphaMode::Transparent {
|
||||
premultiplied: true,
|
||||
}),
|
||||
Some(SnapshotPixelFormat::BGRA),
|
||||
)
|
||||
.0, // TODO: send snapshot
|
||||
snapshot,
|
||||
size.cast(),
|
||||
rep,
|
||||
self.is_origin_clean(image),
|
||||
|
@ -1703,10 +1696,8 @@ impl CanvasState {
|
|||
};
|
||||
|
||||
// Step 7.
|
||||
let (sender, receiver) = ipc::bytes_channel().unwrap();
|
||||
let pixels = unsafe { &imagedata.get_rect(Rect::new(src_rect.origin, dst_rect.size)) };
|
||||
self.send_canvas_2d_msg(Canvas2dMsg::PutImageData(dst_rect, receiver));
|
||||
sender.send(pixels).unwrap();
|
||||
let snapshot = imagedata.get_snapshot_rect(Rect::new(src_rect.origin, dst_rect.size));
|
||||
self.send_canvas_2d_msg(Canvas2dMsg::PutImageData(dst_rect, snapshot.as_ipc()));
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-drawimage
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue