mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Fix crop_area_byte_length calculation in crop_image and add tests
This commit is contained in:
parent
e34aac03ff
commit
6f470e497f
8 changed files with 185 additions and 1 deletions
|
@ -746,7 +746,7 @@ fn crop_image(image_data: Vec<u8>,
|
|||
// (consecutive elements in a pixel row of the image are contiguous in memory)
|
||||
let stride = image_size.width * 4;
|
||||
let image_bytes_length = image_size.height * image_size.width * 4;
|
||||
let crop_area_bytes_length = crop_rect.size.height * crop_rect.size.height * 4;
|
||||
let crop_area_bytes_length = crop_rect.size.height * crop_rect.size.width * 4;
|
||||
// If the image size is less or equal than the crop area we do nothing
|
||||
if image_bytes_length <= crop_area_bytes_length {
|
||||
return image_data;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue