[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:
Chris Wilson 2007-10-16 15:27:33 +01:00
parent 3b1cc128dc
commit fa9201b9c9

View file

@ -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;