summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-appearance.c
diff options
context:
space:
mode:
authorPaul Gardiner <paul.gardiner@artifex.com>2013-11-05 16:48:13 +0000
committerPaul Gardiner <paul.gardiner@artifex.com>2013-11-05 16:48:13 +0000
commit2901c7d78c9880b6fda7ccf9b000d847724071e4 (patch)
treecf287dc755a822f1e3a34e85cf32595d4d9ea995 /source/pdf/pdf-appearance.c
parent1dd2a1ae1f1cb7d93ec2edcc5a6c7e7fd4f0e2ec (diff)
downloadmupdf-2901c7d78c9880b6fda7ccf9b000d847724071e4.tar.xz
Fix bug 694730: Wrong bbox in one-point ink annotation
Zero and one-point case both lead to an empty rectangle, but the one-point case needs expanding but wasn't because fz_expand_rect treats an empty rectangle as a special case (as it should)
Diffstat (limited to 'source/pdf/pdf-appearance.c')
-rw-r--r--source/pdf/pdf-appearance.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/pdf/pdf-appearance.c b/source/pdf/pdf-appearance.c
index 0b1a290a..21cf5ae2 100644
--- a/source/pdf/pdf-appearance.c
+++ b/source/pdf/pdf-appearance.c
@@ -1580,6 +1580,7 @@ void pdf_update_ink_appearance(pdf_document *doc, pdf_annot *annot)
float width;
pdf_obj *list;
int n, m, i, j;
+ int empty = 1;
cs = pdf_to_color(doc, pdf_dict_gets(annot->obj, "C"), color);
if (!cs)
@@ -1620,6 +1621,7 @@ void pdf_update_ink_appearance(pdf_document *doc, pdf_annot *annot)
{
rect.x0 = rect.x1 = pt.x;
rect.y0 = rect.y1 = pt.y;
+ empty = 0;
}
else
{
@@ -1638,6 +1640,19 @@ void pdf_update_ink_appearance(pdf_document *doc, pdf_annot *annot)
fz_stroke_path(dev, path, stroke, page_ctm, cs, color, 1.0f);
fz_expand_rect(&rect, width);
+ /*
+ Expand the rectangle by width all around. We cannot use
+ fz_expand_rect because the rectangle might be empty in the
+ single point case
+ */
+ if (!empty)
+ {
+ rect.x0 -= width;
+ rect.y0 -= width;
+ rect.x1 += width;
+ rect.y1 += width;
+ }
+
fz_transform_rect(&rect, page_ctm);
pdf_set_annot_appearance(doc, annot, &rect, strike_list);