diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-07-07 13:33:38 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-07-08 12:04:51 +0200 |
commit | 5f11fd5eb7096d15f92abbb9d7d84d0c35eb8f53 (patch) | |
tree | 45850a97e5d251decba95c77a0b0cce2c967a29a /source/pdf | |
parent | e82910771b7896b0cfff98b04d2ffe0a56cae0b4 (diff) | |
download | mupdf-5f11fd5eb7096d15f92abbb9d7d84d0c35eb8f53.tar.xz |
Slim pdf_annot struct: remove cached pagerect field.
Diffstat (limited to 'source/pdf')
-rw-r--r-- | source/pdf/pdf-annot-edit.c | 3 | ||||
-rw-r--r-- | source/pdf/pdf-annot.c | 12 | ||||
-rw-r--r-- | source/pdf/pdf-appearance.c | 2 | ||||
-rw-r--r-- | source/pdf/pdf-form.c | 14 |
4 files changed, 10 insertions, 21 deletions
diff --git a/source/pdf/pdf-annot-edit.c b/source/pdf/pdf-annot-edit.c index 4aa856b0..dc07cd7f 100644 --- a/source/pdf/pdf-annot-edit.c +++ b/source/pdf/pdf-annot-edit.c @@ -122,7 +122,6 @@ pdf_create_annot(fz_context *ctx, pdf_document *doc, pdf_page *page, fz_annot_ty annot = pdf_new_annot(ctx, page, &page_ctm, &inv_page_ctm); annot->rect = rect; - annot->pagerect = rect; annot->ap = NULL; annot->widget_type = PDF_WIDGET_TYPE_NOT_WIDGET; annot->annot_type = type; @@ -260,8 +259,6 @@ pdf_set_markup_annot_quadpoints(fz_context *ctx, pdf_document *doc, pdf_annot *a static void update_rect(fz_context *ctx, pdf_annot *annot) { pdf_to_rect(ctx, pdf_dict_get(ctx, annot->obj, PDF_NAME_Rect), &annot->rect); - annot->pagerect = annot->rect; - fz_transform_rect(&annot->pagerect, &annot->page_ctm); } void diff --git a/source/pdf/pdf-annot.c b/source/pdf/pdf-annot.c index 830e2091..d06d9fa4 100644 --- a/source/pdf/pdf-annot.c +++ b/source/pdf/pdf-annot.c @@ -582,8 +582,6 @@ pdf_load_annots(fz_context *ctx, pdf_document *doc, pdf_page *page, pdf_obj *ann n = pdf_dict_get(ctx, n, as); pdf_to_rect(ctx, rect, &annot->rect); - annot->pagerect = annot->rect; - fz_transform_rect(&annot->pagerect, page_ctm); annot->ap = NULL; annot->annot_type = pdf_annot_obj_type(ctx, obj); annot->widget_type = annot->annot_type == FZ_ANNOT_WIDGET ? pdf_field_type(ctx, doc, obj) : PDF_WIDGET_TYPE_NOT_WIDGET; @@ -639,13 +637,9 @@ pdf_next_annot(fz_context *ctx, pdf_annot *annot) fz_rect * pdf_bound_annot(fz_context *ctx, pdf_annot *annot, fz_rect *rect) { - if (rect == NULL) - return NULL; - - if (annot) - *rect = annot->pagerect; - else - *rect = fz_empty_rect; + pdf_obj *obj = pdf_dict_get(ctx, annot->obj, PDF_NAME_Rect); + pdf_to_rect(ctx, obj, rect); + fz_transform_rect(rect, &annot->page_ctm); return rect; } diff --git a/source/pdf/pdf-appearance.c b/source/pdf/pdf-appearance.c index 234949b4..e073a1db 100644 --- a/source/pdf/pdf-appearance.c +++ b/source/pdf/pdf-appearance.c @@ -1567,8 +1567,6 @@ void pdf_update_text_markup_appearance(fz_context *ctx, pdf_document *doc, pdf_a static void update_rect(fz_context *ctx, pdf_annot *annot) { pdf_to_rect(ctx, pdf_dict_get(ctx, annot->obj, PDF_NAME_Rect), &annot->rect); - annot->pagerect = annot->rect; - fz_transform_rect(&annot->pagerect, &annot->page_ctm); } void pdf_set_annot_appearance(fz_context *ctx, pdf_document *doc, pdf_annot *annot, fz_rect *rect, fz_display_list *disp_list) diff --git a/source/pdf/pdf-form.c b/source/pdf/pdf-form.c index 6889e07f..3e39409e 100644 --- a/source/pdf/pdf-form.c +++ b/source/pdf/pdf-form.c @@ -583,14 +583,16 @@ int pdf_pass_event(fz_context *ctx, pdf_document *doc, pdf_page *page, pdf_ui_ev pdf_hotspot *hp = &doc->hotspot; fz_point *pt = &(ui_event->event.pointer.pt); int changed = 0; + fz_rect bbox; if (page == NULL) return 0; for (annot = page->annots; annot; annot = annot->next) { - if (pt->x >= annot->pagerect.x0 && pt->x <= annot->pagerect.x1) - if (pt->y >= annot->pagerect.y0 && pt->y <= annot->pagerect.y1) + pdf_bound_annot(ctx, annot, &bbox); + if (pt->x >= bbox.x0 && pt->x <= bbox.x1) + if (pt->y >= bbox.y0 && pt->y <= bbox.y1) break; } @@ -1166,11 +1168,9 @@ void pdf_field_set_text_color(fz_context *ctx, pdf_document *doc, pdf_obj *field fz_rect *pdf_bound_widget(fz_context *ctx, pdf_widget *widget, fz_rect *rect) { pdf_annot *annot = (pdf_annot *)widget; - - if (rect == NULL) - return NULL; - *rect = annot->pagerect; - + pdf_obj *obj = pdf_dict_get(ctx, annot->obj, PDF_NAME_Rect); + pdf_to_rect(ctx, obj, rect); + fz_transform_rect(rect, &annot->page_ctm); return rect; } |