diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2015-12-28 15:18:21 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-01-05 14:47:37 +0100 |
commit | d5394cbcf3a98dcabc49264172d4ce6618535d91 (patch) | |
tree | 9cf89de9fa95ddc14ffdb78d2dd8ff25d7d480cd /source/fitz/document.c | |
parent | cc4bd1b4f82a67f70c7ccad4da874d6e7451eeae (diff) | |
download | mupdf-d5394cbcf3a98dcabc49264172d4ce6618535d91.tar.xz |
Remove fz_page argument from fz_annot function calls.
Diffstat (limited to 'source/fitz/document.c')
-rw-r--r-- | source/fitz/document.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/source/fitz/document.c b/source/fitz/document.c index 61d3091e..abcbfd9c 100644 --- a/source/fitz/document.c +++ b/source/fitz/document.c @@ -275,18 +275,18 @@ fz_first_annot(fz_context *ctx, fz_page *page) } fz_annot * -fz_next_annot(fz_context *ctx, fz_page *page, fz_annot *annot) +fz_next_annot(fz_context *ctx, fz_annot *annot) { - if (page && page->next_annot && annot) - return page->next_annot(ctx, page, annot); + if (annot && annot->next_annot) + return annot->next_annot(ctx, annot); return NULL; } fz_rect * -fz_bound_annot(fz_context *ctx, fz_page *page, fz_annot *annot, fz_rect *rect) +fz_bound_annot(fz_context *ctx, fz_annot *annot, fz_rect *rect) { - if (page && page->bound_annot && annot && rect) - return page->bound_annot(ctx, page, annot, rect); + if (annot && annot->bound_annot && rect) + return annot->bound_annot(ctx, annot, rect); if (rect) *rect = fz_empty_rect; return rect; @@ -310,13 +310,13 @@ fz_run_page_contents(fz_context *ctx, fz_page *page, fz_device *dev, const fz_ma } void -fz_run_annot(fz_context *ctx, fz_page *page, fz_annot *annot, fz_device *dev, const fz_matrix *transform, fz_cookie *cookie) +fz_run_annot(fz_context *ctx, fz_annot *annot, fz_device *dev, const fz_matrix *transform, fz_cookie *cookie) { - if (page && page->run_annot && page && annot) + if (annot && annot->run_annot) { fz_try(ctx) { - page->run_annot(ctx, page, annot, dev, transform, cookie); + annot->run_annot(ctx, annot, dev, transform, cookie); } fz_catch(ctx) { @@ -340,12 +340,12 @@ fz_run_page(fz_context *ctx, fz_page *page, fz_device *dev, const fz_matrix *tra if (cookie && cookie->progress_max != -1) { int count = 1; - for (annot = fz_first_annot(ctx, page); annot; annot = fz_next_annot(ctx, page, annot)) + for (annot = fz_first_annot(ctx, page); annot; annot = fz_next_annot(ctx, annot)) count++; cookie->progress_max += count; } - for (annot = fz_first_annot(ctx, page); annot; annot = fz_next_annot(ctx, page, annot)) + for (annot = fz_first_annot(ctx, page); annot; annot = fz_next_annot(ctx, annot)) { /* Check the cookie for aborting */ if (cookie) @@ -355,13 +355,21 @@ fz_run_page(fz_context *ctx, fz_page *page, fz_device *dev, const fz_matrix *tra cookie->progress++; } - fz_run_annot(ctx, page, annot, dev, transform, cookie); + fz_run_annot(ctx, annot, dev, transform, cookie); } fz_end_page(ctx, dev); } void * +fz_new_annot(fz_context *ctx, int size) +{ + fz_page *page = Memento_label(fz_calloc(ctx, 1, size), "fz_annot"); + page->refs = 1; + return page; +} + +void * fz_new_page(fz_context *ctx, int size) { fz_page *page = Memento_label(fz_calloc(ctx, 1, size), "fz_page"); |