Remove Canvas2dMsg::DrawImageSelf

Now that all canvas share the same thread, it's useless to have a separate message
for that.
This commit is contained in:
Anthony Ramine 2018-09-16 22:12:44 +02:00
parent 9f7b746430
commit 36c8cd229e
4 changed files with 11 additions and 51 deletions

View file

@ -85,21 +85,6 @@ impl<'a> CanvasData<'a> {
}
}
pub fn draw_image_self(
&self,
image_size: Size2D<f64>,
dest_rect: Rect<f64>,
source_rect: Rect<f64>,
smoothing_enabled: bool
) {
// Reads pixels from source image
// In this case source and target are the same canvas
let image_data = self.read_pixels(source_rect.to_i32(), image_size);
// The dimensions of image_data are source_rect.size
self.draw_image(image_data, source_rect.size, dest_rect, source_rect, smoothing_enabled);
}
pub fn save_context_state(&mut self) {
self.saved_states.push(self.state.clone());
}

View file

@ -153,19 +153,6 @@ impl<'a> CanvasPaintThread <'a> {
smoothing_enabled,
)
},
Canvas2dMsg::DrawImageSelf(
image_size,
dest_rect,
source_rect,
smoothing_enabled
) => {
self.canvas(canvas_id).draw_image_self(
image_size,
dest_rect,
source_rect,
smoothing_enabled
)
},
Canvas2dMsg::DrawImageInOther(
other_canvas_id,
image_size,
@ -173,9 +160,10 @@ impl<'a> CanvasPaintThread <'a> {
source_rect,
smoothing
) => {
let mut image_data = self.canvas(canvas_id).read_pixels(
source_rect.to_i32(),
image_size);
let image_data = self.canvas(canvas_id).read_pixels(
source_rect.to_i32(),
image_size,
);
self.canvas(other_canvas_id).draw_image(
image_data.into(),
source_rect.size,