summaryrefslogtreecommitdiff
path: root/source/fitz/test-device.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2014-09-05 20:26:41 +0100
committerRobin Watts <robin.watts@artifex.com>2014-09-09 15:53:52 +0100
commit9172100d6d9f2f5aa4594aaa130fbfaef7162afd (patch)
tree607402c0f0e9a1f7a5e15518515c41e44e3290c1 /source/fitz/test-device.c
parenta55648c9d009cdd94977fc5b7152932e59c975ad (diff)
downloadmupdf-9172100d6d9f2f5aa4594aaa130fbfaef7162afd.tar.xz
test-device: Abort interpretation when color found.
Add a new class of errors and use them to abort interpretation when the test device detects a color page.
Diffstat (limited to 'source/fitz/test-device.c')
-rw-r--r--source/fitz/test-device.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/fitz/test-device.c b/source/fitz/test-device.c
index 32d3a5f6..9c778ce1 100644
--- a/source/fitz/test-device.c
+++ b/source/fitz/test-device.c
@@ -38,6 +38,7 @@ fz_test_color(fz_device *dev, fz_colorspace *colorspace, const float *color)
{
*t->is_color = 1;
dev->hints |= FZ_IGNORE_IMAGE;
+ fz_throw(ctx, FZ_ERROR_ABORT, "Page found as color; stopping interpretation");
}
}
else
@@ -48,6 +49,7 @@ fz_test_color(fz_device *dev, fz_colorspace *colorspace, const float *color)
{
*t->is_color = 1;
dev->hints |= FZ_IGNORE_IMAGE;
+ fz_throw(ctx, FZ_ERROR_ABORT, "Page found as color; stopping interpretation");
}
}
}
@@ -150,6 +152,8 @@ fz_test_fill_image(fz_device *dev, fz_image *image, const fz_matrix *ctm, float
{
*t->is_color = 1;
dev->hints |= FZ_IGNORE_IMAGE;
+ fz_close(stream);
+ fz_throw(ctx, FZ_ERROR_ABORT, "Page found as color; stopping interpretation");
break;
}
}
@@ -199,6 +203,8 @@ fz_test_fill_image(fz_device *dev, fz_image *image, const fz_matrix *ctm, float
{
*t->is_color = 1;
dev->hints |= FZ_IGNORE_IMAGE;
+ fz_drop_pixmap(ctx, pix);
+ fz_throw(ctx, FZ_ERROR_ABORT, "Page found as color; stopping interpretation");
break;
}
s += 4;
@@ -226,6 +232,8 @@ fz_test_fill_image(fz_device *dev, fz_image *image, const fz_matrix *ctm, float
{
*t->is_color = 1;
dev->hints |= FZ_IGNORE_IMAGE;
+ fz_drop_pixmap(ctx, pix);
+ fz_throw(ctx, FZ_ERROR_ABORT, "Page found as color; stopping interpretation");
break;
}
}