diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/pdf/pdf-annot.c | 7 | ||||
-rw-r--r-- | source/pdf/pdf-appearance.c | 2 | ||||
-rw-r--r-- | source/pdf/pdf-op-run.c | 8 | ||||
-rw-r--r-- | source/pdf/pdf-xobject.c | 15 |
4 files changed, 16 insertions, 16 deletions
diff --git a/source/pdf/pdf-annot.c b/source/pdf/pdf-annot.c index 1f6e3c5e..4a34e945 100644 --- a/source/pdf/pdf-annot.c +++ b/source/pdf/pdf-annot.c @@ -406,14 +406,15 @@ pdf_drop_annots(fz_context *ctx, pdf_annot *annot) void pdf_annot_transform(fz_context *ctx, pdf_annot *annot, fz_matrix *annot_ctm) { - fz_rect bbox; - fz_rect rect; + fz_rect bbox, rect; + fz_matrix matrix; float w, h, x, y; pdf_to_rect(ctx, pdf_dict_get(ctx, annot->obj, PDF_NAME_Rect), &rect); pdf_xobject_bbox(ctx, annot->ap, &bbox); + pdf_xobject_matrix(ctx, annot->ap, &matrix); - fz_transform_rect(&bbox, &annot->ap->matrix); + fz_transform_rect(&bbox, &matrix); if (bbox.x1 == bbox.x0) w = 0; else diff --git a/source/pdf/pdf-appearance.c b/source/pdf/pdf-appearance.c index 43095351..e275ca56 100644 --- a/source/pdf/pdf-appearance.c +++ b/source/pdf/pdf-appearance.c @@ -1621,8 +1621,6 @@ void pdf_set_annot_appearance(fz_context *ctx, pdf_document *doc, pdf_annot *ann xobj = pdf_load_xobject(ctx, doc, ap_obj); if (xobj) { - /* Update bounding box and matrix also in the xobject structure */ - xobj->matrix = fz_identity; xobj->iteration++; pdf_drop_xobject(ctx, xobj); } diff --git a/source/pdf/pdf-op-run.c b/source/pdf/pdf-op-run.c index 3d82699f..a2b9e35c 100644 --- a/source/pdf/pdf-op-run.c +++ b/source/pdf/pdf-op-run.c @@ -110,6 +110,7 @@ begin_softmask(fz_context *ctx, pdf_run_processor *pr, softmask_save *save) pdf_xobject *softmask = gstate->softmask; fz_rect mask_bbox; fz_matrix save_tm, save_tlm, save_ctm; + fz_matrix mask_matrix; save->softmask = softmask; if (softmask == NULL) @@ -119,6 +120,7 @@ begin_softmask(fz_context *ctx, pdf_run_processor *pr, softmask_save *save) save_ctm = gstate->ctm; pdf_xobject_bbox(ctx, softmask, &mask_bbox); + pdf_xobject_matrix(ctx, softmask, &mask_matrix); save_tm = pr->tm; save_tlm = pr->tlm; @@ -126,7 +128,7 @@ begin_softmask(fz_context *ctx, pdf_run_processor *pr, softmask_save *save) mask_bbox = fz_infinite_rect; else { - fz_transform_rect(&mask_bbox, &softmask->matrix); + fz_transform_rect(&mask_bbox, &mask_matrix); fz_transform_rect(&mask_bbox, &gstate->softmask_ctm); } gstate->softmask = NULL; @@ -1219,12 +1221,14 @@ pdf_run_xobject(fz_context *ctx, pdf_run_processor *proc, pdf_xobject *xobj, pdf char errmess[256] = ""; pdf_obj *resources; fz_rect xobj_bbox; + fz_matrix xobj_matrix; /* Avoid infinite recursion */ if (xobj == NULL || pdf_mark_obj(ctx, xobj->obj)) return; pdf_xobject_bbox(ctx, xobj, &xobj_bbox); + pdf_xobject_matrix(ctx, xobj, &xobj_matrix); fz_var(cleanup_state); fz_var(gstate); @@ -1241,7 +1245,7 @@ pdf_run_xobject(fz_context *ctx, pdf_run_processor *proc, pdf_xobject *xobj, pdf oldtop = pr->gtop; /* apply xobject's transform matrix */ - fz_concat(&local_transform, &xobj->matrix, &local_transform); + fz_concat(&local_transform, &xobj_matrix, &local_transform); fz_concat(&gstate->ctm, &local_transform, &gstate->ctm); /* The gparent is updated with the modified ctm */ diff --git a/source/pdf/pdf-xobject.c b/source/pdf/pdf-xobject.c index ad2abe09..e921f47f 100644 --- a/source/pdf/pdf-xobject.c +++ b/source/pdf/pdf-xobject.c @@ -43,6 +43,12 @@ pdf_xobject_bbox(fz_context *ctx, pdf_xobject *xobj, fz_rect *bbox) return pdf_to_rect(ctx, pdf_dict_get(ctx, xobj->obj, PDF_NAME_BBox), bbox); } +fz_matrix * +pdf_xobject_matrix(fz_context *ctx, pdf_xobject *xobj, fz_matrix *matrix) +{ + return pdf_to_matrix(ctx, pdf_dict_get(ctx, xobj->obj, PDF_NAME_Matrix), matrix); +} + pdf_xobject * pdf_load_xobject(fz_context *ctx, pdf_document *doc, pdf_obj *dict) { @@ -66,13 +72,6 @@ pdf_load_xobject(fz_context *ctx, pdf_document *doc, pdf_obj *dict) fz_try(ctx) { - - obj = pdf_dict_get(ctx, dict, PDF_NAME_Matrix); - if (obj) - pdf_to_matrix(ctx, obj, &form->matrix); - else - form->matrix = fz_identity; - form->isolated = 0; form->knockout = 0; form->transparency = 0; @@ -156,8 +155,6 @@ pdf_new_xobject(fz_context *ctx, pdf_document *doc, const fz_rect *bbox, const f form->obj = NULL; form->iteration = 0; - form->matrix = *mat; - form->isolated = 0; form->knockout = 0; form->transparency = 0; |