mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-06 10:50:17 +01:00
[pdiff] Check for too small images.
The Laplacian pyramid can only work on images larger than 3x3 due to the size of its convolution kernel. So if the image is too small return an error (-1) before attempting to construction the pyramid.
This commit is contained in:
parent
3b1cc128dc
commit
fa9201b9c9
1 changed files with 3 additions and 0 deletions
|
|
@ -286,6 +286,9 @@ pdiff_compare (cairo_surface_t *surface_a,
|
|||
|
||||
w = cairo_image_surface_get_width (surface_a);
|
||||
h = cairo_image_surface_get_height (surface_a);
|
||||
if (w < 3 || h < 3) /* too small for the Laplacian convolution */
|
||||
return -1;
|
||||
|
||||
for (y = 0; y < h; y++) {
|
||||
for (x = 0; x < w; x++) {
|
||||
float r, g, b, l;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue