diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2018-07-06 14:20:26 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2018-08-10 12:09:10 +0200 |
commit | 0abcccc4aab4d893ac2a0ef116ff1f0c006fbc30 (patch) | |
tree | 8fe312208afaf28e2d759f4a1c53ec4ef131124f /platform/x11 | |
parent | 6f8cb5606e426084160eaec82e9c11966e7fb5f4 (diff) | |
download | mupdf-0abcccc4aab4d893ac2a0ef116ff1f0c006fbc30.tar.xz |
Rejig pdf_update_page and pdf_update_annot.
The intent is for a user to iterate over the annotations on a page calling
pdf_update_annot for each one. If this function returns true, then the
annotation has changed since the last time it was called, and the user
needs to re-render.
pdf_update_page is a simple loop over the annotations on a page, for use
if you only care about page level granularity.
Users should no longer look at or change the pdf_annot.has_new_ap field.
Diffstat (limited to 'platform/x11')
-rw-r--r-- | platform/x11/pdfapp.c | 39 |
1 files changed, 7 insertions, 32 deletions
diff --git a/platform/x11/pdfapp.c b/platform/x11/pdfapp.c index 01011b2b..22fb7f1b 100644 --- a/platform/x11/pdfapp.c +++ b/platform/x11/pdfapp.c @@ -799,40 +799,15 @@ static void pdfapp_runpage(pdfapp_t *app, fz_device *dev, const fz_matrix ctm, f static void pdfapp_updatepage(pdfapp_t *app) { - fz_device *idev; - fz_matrix ctm; - pdf_annot *pannot; - - pdfapp_viewctm(&ctm, app); - pdf_update_page(app->ctx, (pdf_page *)app->page); - pdfapp_recreate_annotationslist(app); - - for (pannot = pdf_first_annot(app->ctx, (pdf_page*)app->page); pannot; pannot = pdf_next_annot(app->ctx, pannot)) + if (pdf_update_page(app->ctx, (pdf_page*)app->page)) { - if (pannot->has_new_ap) - { - fz_annot *annot = (fz_annot*)pannot; - fz_rect bounds; - fz_irect ibounds; - bounds = fz_transform_rect(fz_bound_annot(app->ctx, annot), ctm); - ibounds = fz_round_rect(bounds); - bounds = fz_rect_from_irect(ibounds); - fz_clear_pixmap_rect_with_value(app->ctx, app->image, 255, ibounds); - idev = fz_new_draw_device_with_bbox(app->ctx, fz_identity, app->image, &ibounds); - fz_try(app->ctx) - { - pdfapp_runpage(app, idev, ctm, bounds, NULL); - fz_close_device(app->ctx, idev); - } - fz_always(app->ctx) - fz_drop_device(app->ctx, idev); - fz_catch(app->ctx) - fz_rethrow(app->ctx); - pannot->has_new_ap = 0; - } + pdfapp_recreate_annotationslist(app); + pdfapp_showpage(app, 0, 1, 1, 0, 0); + } + else + { + pdfapp_showpage(app, 0, 0, 1, 0, 0); } - - pdfapp_showpage(app, 0, 0, 1, 0, 0); } void pdfapp_reloadpage(pdfapp_t *app) |