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/document.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/document.c')
-rw-r--r-- | source/fitz/document.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/source/fitz/document.c b/source/fitz/document.c index 45da7e90..4bde820c 100644 --- a/source/fitz/document.c +++ b/source/fitz/document.c @@ -244,14 +244,38 @@ void fz_run_page_contents(fz_document *doc, fz_page *page, fz_device *dev, const fz_matrix *transform, fz_cookie *cookie) { if (doc && doc->run_page_contents && page) - doc->run_page_contents(doc, page, dev, transform, cookie); + { + fz_context *ctx = dev->ctx; + + fz_try(ctx) + { + doc->run_page_contents(doc, page, dev, transform, cookie); + } + fz_catch(ctx) + { + if (fz_caught(ctx) != FZ_ERROR_ABORT) + fz_rethrow(ctx); + } + } } void fz_run_annot(fz_document *doc, fz_page *page, fz_annot *annot, fz_device *dev, const fz_matrix *transform, fz_cookie *cookie) { if (doc && doc->run_annot && page && annot) - doc->run_annot(doc, page, annot, dev, transform, cookie); + { + fz_context *ctx = dev->ctx; + + fz_try(ctx) + { + doc->run_annot(doc, page, annot, dev, transform, cookie); + } + fz_catch(ctx) + { + if (fz_caught(ctx) != FZ_ERROR_ABORT) + fz_rethrow(ctx); + } + } } void |