summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-02-28 16:16:50 +0100
committerTor Andersson <tor.andersson@artifex.com>2018-03-16 14:51:40 +0100
commitdf788749fd2377e0c0232bac447e369e59c98b75 (patch)
treea860e7a05317f3c8d7dcb90f1e8ca995c4dbc409 /source
parent187bef3feb8e4ba672bdb8d23d101121a84af557 (diff)
downloadmupdf-df788749fd2377e0c0232bac447e369e59c98b75.tar.xz
Only use BS/W for border width.
The Border property is long since deprecated.
Diffstat (limited to 'source')
-rw-r--r--source/pdf/pdf-annot-edit.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/source/pdf/pdf-annot-edit.c b/source/pdf/pdf-annot-edit.c
index 15541d45..1d042f1f 100644
--- a/source/pdf/pdf-annot-edit.c
+++ b/source/pdf/pdf-annot-edit.c
@@ -460,10 +460,7 @@ pdf_set_annot_line_ending_styles(fz_context *ctx, pdf_annot *annot,
float
pdf_annot_border(fz_context *ctx, pdf_annot *annot)
{
- pdf_obj *border, *bs, *bs_w;
- border = pdf_dict_get(ctx, annot->obj, PDF_NAME_Border);
- if (pdf_is_array(ctx, border))
- return pdf_to_real(ctx, pdf_array_get(ctx, border, 2));
+ pdf_obj *bs, *bs_w;
bs = pdf_dict_get(ctx, annot->obj, PDF_NAME_BS);
bs_w = pdf_dict_get(ctx, bs, PDF_NAME_W);
if (pdf_is_number(ctx, bs_w))
@@ -475,21 +472,10 @@ void
pdf_set_annot_border(fz_context *ctx, pdf_annot *annot, float w)
{
pdf_document *doc = annot->page->doc;
- pdf_obj *border = pdf_dict_get(ctx, annot->obj, PDF_NAME_Border);
- if (pdf_is_array(ctx, border))
- pdf_array_put_drop(ctx, border, 2, pdf_new_real(ctx, doc, w));
- else
- {
- border = pdf_new_array(ctx, doc, 3);
- pdf_array_push_drop(ctx, border, pdf_new_real(ctx, doc, 0));
- pdf_array_push_drop(ctx, border, pdf_new_real(ctx, doc, 0));
- pdf_array_push_drop(ctx, border, pdf_new_real(ctx, doc, w));
- pdf_dict_put_drop(ctx, annot->obj, PDF_NAME_Border, border);
- }
-
- /* Remove border style and effect dictionaries so they won't interfere. */
- pdf_dict_del(ctx, annot->obj, PDF_NAME_BS);
- pdf_dict_del(ctx, annot->obj, PDF_NAME_BE);
+ pdf_obj *bs = pdf_dict_get(ctx, annot->obj, PDF_NAME_BS);
+ if (!pdf_is_dict(ctx, bs))
+ pdf_dict_put_drop(ctx, annot->obj, PDF_NAME_BS, bs = pdf_new_dict(ctx, doc, 1));
+ pdf_dict_put_real(ctx, bs, PDF_NAME_W, w);
pdf_dirty_annot(ctx, annot);
}