From 9172100d6d9f2f5aa4594aaa130fbfaef7162afd Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Fri, 5 Sep 2014 20:26:41 +0100 Subject: 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. --- source/fitz/document.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'source/fitz/document.c') 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 -- cgit v1.2.3