Merge byte swap and unmultiplying loops in ctx.getImageData()

This commit is contained in:
Anthony Ramine 2018-09-13 16:12:47 +02:00
parent 983a914da3
commit b5c469d52e
2 changed files with 6 additions and 10 deletions

View file

@ -458,11 +458,7 @@ impl<'a> CanvasData<'a> {
canvas_size: Size2D<f64>,
chan: IpcSender<ByteBuf>,
) {
let mut dest_data = self.read_pixels(dest_rect, canvas_size);
// bgra -> rgba
byte_swap(&mut dest_data);
chan.send(dest_data.into()).unwrap();
chan.send(self.read_pixels(dest_rect, canvas_size).into()).unwrap();
}
// https://html.spec.whatwg.org/multipage/#dom-context-2d-putimagedata