diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-07-07 13:54:08 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-07-08 17:21:23 +0200 |
commit | adc4932af62fde5e9eb1106f751659962cb89dc3 (patch) | |
tree | caa6b5bbd4920cfff7174cb81f25dc12e19b58e7 /source/pdf | |
parent | 048948c9705c47b0ccd4ebf835d4612496ce6eb0 (diff) | |
download | mupdf-adc4932af62fde5e9eb1106f751659962cb89dc3.tar.xz |
Slim pdf_annot struct: remove cached matrix field.
Diffstat (limited to 'source/pdf')
-rw-r--r-- | source/pdf/pdf-annot-edit.c | 1 | ||||
-rw-r--r-- | source/pdf/pdf-annot.c | 8 | ||||
-rw-r--r-- | source/pdf/pdf-interpret.c | 9 |
3 files changed, 11 insertions, 7 deletions
diff --git a/source/pdf/pdf-annot-edit.c b/source/pdf/pdf-annot-edit.c index 5427ea3a..f4431414 100644 --- a/source/pdf/pdf-annot-edit.c +++ b/source/pdf/pdf-annot-edit.c @@ -74,7 +74,6 @@ pdf_update_annot(fz_context *ctx, pdf_document *doc, pdf_annot *annot) fz_try(ctx) { annot->ap = pdf_load_xobject(ctx, doc, n); - pdf_transform_annot(ctx, annot); annot->ap_iteration = annot->ap->iteration; } fz_catch(ctx) diff --git a/source/pdf/pdf-annot.c b/source/pdf/pdf-annot.c index c5354c71..00e5b983 100644 --- a/source/pdf/pdf-annot.c +++ b/source/pdf/pdf-annot.c @@ -402,8 +402,9 @@ pdf_drop_annots(fz_context *ctx, pdf_annot *annot) } } +/* Create transform to fit appearance stream to annotation Rect */ void -pdf_transform_annot(fz_context *ctx, pdf_annot *annot) +pdf_annot_transform(fz_context *ctx, pdf_annot *annot, fz_matrix *annot_ctm) { fz_rect bbox = annot->ap->bbox; fz_rect rect; @@ -423,7 +424,7 @@ pdf_transform_annot(fz_context *ctx, pdf_annot *annot) x = rect.x0 - bbox.x0; y = rect.y0 - bbox.y0; - fz_pre_scale(fz_translate(&annot->matrix, x, y), w, h); + fz_pre_scale(fz_translate(annot_ctm, x, y), w, h); } fz_annot_type pdf_annot_obj_type(fz_context *ctx, pdf_obj *obj) @@ -589,9 +590,10 @@ pdf_load_annots(fz_context *ctx, pdf_document *doc, pdf_page *page, pdf_obj *ann if (pdf_is_stream(ctx, n)) { annot->ap = pdf_load_xobject(ctx, doc, n); - pdf_transform_annot(ctx, annot); annot->ap_iteration = annot->ap->iteration; } + else + fz_warn(ctx, "no appearance stream for annotation %d 0 R", pdf_to_num(ctx, annot->obj)); if (obj == doc->focus_obj) doc->focus = annot; diff --git a/source/pdf/pdf-interpret.c b/source/pdf/pdf-interpret.c index f3b875cd..c4dfaf88 100644 --- a/source/pdf/pdf-interpret.c +++ b/source/pdf/pdf-interpret.c @@ -1250,12 +1250,15 @@ pdf_process_annot(fz_context *ctx, pdf_processor *proc, pdf_document *doc, pdf_p if (pdf_is_hidden_ocg(ctx, doc->ocg, NULL, proc->event, pdf_dict_get(ctx, annot->obj, PDF_NAME_OC))) return; - if (proc->op_q && proc->op_cm && proc->op_Do_form && proc->op_Q) + if (proc->op_q && proc->op_cm && proc->op_Do_form && proc->op_Q && annot->ap) { + fz_matrix matrix; + pdf_annot_transform(ctx, annot, &matrix); proc->op_q(ctx, proc); proc->op_cm(ctx, proc, - annot->matrix.a, annot->matrix.b, annot->matrix.c, - annot->matrix.d, annot->matrix.e, annot->matrix.f); + matrix.a, matrix.b, + matrix.c, matrix.d, + matrix.e, matrix.f); proc->op_Do_form(ctx, proc, NULL, annot->ap, pdf_page_resources(ctx, page)); proc->op_Q(ctx, proc); } |