diff options
author | Robin Watts <robin.watts@artifex.com> | 2014-09-05 20:26:41 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2014-09-09 15:53:52 +0100 |
commit | 9172100d6d9f2f5aa4594aaa130fbfaef7162afd (patch) | |
tree | 607402c0f0e9a1f7a5e15518515c41e44e3290c1 /source/fitz/test-device.c | |
parent | a55648c9d009cdd94977fc5b7152932e59c975ad (diff) | |
download | mupdf-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.c | 8 |
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; } } |