From c53db64e63f3268d90f45c00f36f94941796b104 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 9 Oct 2018 11:04:33 +0200 Subject: [PATCH] Return input as is when there is no cropping to be done --- components/canvas/canvas_data.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/canvas/canvas_data.rs b/components/canvas/canvas_data.rs index d4a3bcc9a1a..0ce0b352ccc 100644 --- a/components/canvas/canvas_data.rs +++ b/components/canvas/canvas_data.rs @@ -590,6 +590,9 @@ fn crop_image( // We're going to iterate over a pixel values array so we need integers let crop_rect = crop_rect.to_i32(); let image_size = image_size.to_i32(); + if crop_rect == Rect::from_size(image_size) { + return image_data; + } // Assuming 4 bytes per pixel and row-major order for storage // (consecutive elements in a pixel row of the image are contiguous in memory) let stride = image_size.width * 4;