Introduce ImageData::get_rect

We use that to send only the pixels that will be actually drawn to the
canvas thread in CanvasRenderingContext2d::PutImageData.

We also make the canvas thread byte swap and premultiply colours in-place.
This commit is contained in:
Anthony Ramine 2018-10-06 01:10:34 +02:00
parent 784fbb2bc1
commit 19f40cdf0b
5 changed files with 52 additions and 55 deletions

View file

@ -241,18 +241,8 @@ impl<'a> CanvasPaintThread <'a> {
Canvas2dMsg::GetImageData(dest_rect, canvas_size, chan) => {
self.canvas(canvas_id).image_data(dest_rect, canvas_size, chan)
},
Canvas2dMsg::PutImageData(
imagedata,
offset,
image_data_size,
dirty_rect,
) => {
self.canvas(canvas_id).put_image_data(
imagedata.into(),
offset,
image_data_size,
dirty_rect,
)
Canvas2dMsg::PutImageData(imagedata, offset, imagedata_size) => {
self.canvas(canvas_id).put_image_data(imagedata.into(), offset, imagedata_size)
},
Canvas2dMsg::SetShadowOffsetX(value) => {
self.canvas(canvas_id).set_shadow_offset_x(value)