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/tools/mudraw.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/tools/mudraw.c')
-rw-r--r-- | source/tools/mudraw.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c index 198e47ce..420ca1dc 100644 --- a/source/tools/mudraw.c +++ b/source/tools/mudraw.c @@ -317,12 +317,22 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) { int iscolor; dev = fz_new_test_device(ctx, &iscolor, 0.02f); - if (list) - fz_run_display_list(list, dev, &fz_identity, &fz_infinite_rect, NULL); - else - fz_run_page(doc, page, dev, &fz_identity, &cookie); - fz_free_device(dev); - dev = NULL; + fz_try(ctx) + { + if (list) + fz_run_display_list(list, dev, &fz_identity, &fz_infinite_rect, NULL); + else + fz_run_page(doc, page, dev, &fz_identity, &cookie); + } + fz_always(ctx) + { + fz_free_device(dev); + dev = NULL; + } + fz_catch(ctx) + { + fz_rethrow(ctx); + } printf(" %s", iscolor ? "color" : "grayscale"); } |