summaryrefslogtreecommitdiff
path: root/test/pdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2007-10-16 15:27:33 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2007-10-16 15:57:44 +0100
commitfa9201b9c98b18ea18fbee1e5608f20335a02131 (patch)
treeaa8baa7dfd717068f5df2e54f3ede64fbcf4d34d /test/pdiff
parent3b1cc128dc4223ac88f7824dca223ed0f84df5d9 (diff)
downloadcairo-fa9201b9c98b18ea18fbee1e5608f20335a02131.tar.gz
[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.
Diffstat (limited to 'test/pdiff')
-rw-r--r--test/pdiff/pdiff.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/pdiff/pdiff.c b/test/pdiff/pdiff.c
index b75312dfe..4f3226db3 100644
--- a/test/pdiff/pdiff.c
+++ b/test/pdiff/pdiff.c
@@ -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;