diff options
author | Paul Gardiner <paulg.artifex@glidos.net> | 2013-02-28 12:48:12 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2013-02-28 17:07:44 +0000 |
commit | 5d63cf651367bee808d653213c7af7a31ad833ce (patch) | |
tree | 5a61752d9b096946d27e9df5944b3119e9cc476d /fitz | |
parent | 215550b73bfaad01b29cda005dd5b0d6b749b381 (diff) | |
download | mupdf-5d63cf651367bee808d653213c7af7a31ad833ce.tar.xz |
Pass bbox to pdf_set_annot_appearance rather than base on display list
Use of the bbox device to derive the area of the display list can lead
to bad results because of heuristics used to handle corners of stroked
paths.
Diffstat (limited to 'fitz')
-rw-r--r-- | fitz/base_geometry.c | 10 | ||||
-rw-r--r-- | fitz/doc_interactive.c | 4 | ||||
-rw-r--r-- | fitz/fitz-internal.h | 2 | ||||
-rw-r--r-- | fitz/fitz.h | 8 |
4 files changed, 21 insertions, 3 deletions
diff --git a/fitz/base_geometry.c b/fitz/base_geometry.c index 378fd266..7f589ff5 100644 --- a/fitz/base_geometry.c +++ b/fitz/base_geometry.c @@ -459,3 +459,13 @@ fz_expand_rect(fz_rect *a, float expand) a->y1 += expand; return a; } + +fz_rect *fz_include_point_in_rect(fz_rect *r, const fz_point *p) +{ + if (p->x < r->x0) r->x0 = p->x; + if (p->x > r->x1) r->x1 = p->x; + if (p->y < r->y0) r->y0 = p->y; + if (p->y > r->y1) r->y1 = p->y; + + return r; +}
\ No newline at end of file diff --git a/fitz/doc_interactive.c b/fitz/doc_interactive.c index c39cf05d..a14b87d6 100644 --- a/fitz/doc_interactive.c +++ b/fitz/doc_interactive.c @@ -96,9 +96,9 @@ void fz_delete_annot(fz_interactive *idoc, fz_page *page, fz_annot *annot) pdf_delete_annot((pdf_document *)idoc, (pdf_page *)page, (pdf_annot *)annot); } -void fz_set_annot_appearance(fz_interactive *idoc, fz_annot *annot, fz_display_list *disp_list) +void fz_set_annot_appearance(fz_interactive *idoc, fz_annot *annot, fz_rect *rect, fz_display_list *disp_list) { - pdf_set_annot_appearance((pdf_document *)idoc, (pdf_annot *)annot, disp_list); + pdf_set_annot_appearance((pdf_document *)idoc, (pdf_annot *)annot, rect, disp_list); } void fz_set_markup_annot_quadpoints(fz_interactive *idoc, fz_annot *annot, fz_point *qp, int n) diff --git a/fitz/fitz-internal.h b/fitz/fitz-internal.h index c1751fe9..d0fc01e2 100644 --- a/fitz/fitz-internal.h +++ b/fitz/fitz-internal.h @@ -1209,7 +1209,7 @@ void fz_delete_annot(fz_interactive *idoc, fz_page *page, fz_annot *annot); fz_set_annot_appearance: update the appearance of an annotation based on a display list. */ -void fz_set_annot_appearance(fz_interactive *idoc, fz_annot *annot, fz_display_list *disp_list); +void fz_set_annot_appearance(fz_interactive *idoc, fz_annot *annot, fz_rect *rect, fz_display_list *disp_list); /* fz_set_markup_annot_quadpoints: set the quadpoints for a text-markup annotation. diff --git a/fitz/fitz.h b/fitz/fitz.h index 4c7022d4..29b9cee4 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -1138,6 +1138,14 @@ fz_rect *fz_rect_from_irect(fz_rect *restrict rect, const fz_irect *restrict bbo fz_rect *fz_expand_rect(fz_rect *b, float expand); /* + fz_include_point_in_rect: Expand a bbox to include a given point. + To create a rectangle that encompasses a sequence of points, the + rectangle must first be set to be the empty rectangle at one of + the points before including the others. +*/ +fz_rect *fz_include_point_in_rect(fz_rect *r, const fz_point *p); + +/* fz_translate_irect: Translate bounding box. Translate a bbox by a given x and y offset. Allows for overflow. |