diff options
author | Robin Watts <robin.watts@artifex.com> | 2013-06-25 17:50:39 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2013-06-25 18:28:42 +0100 |
commit | a9e56e9f94515c109a912a50b4bc80466a11b075 (patch) | |
tree | 92d31f23c2c56e86867ff23aa6fbd95ca3251e43 /source/pdf/pdf-object.c | |
parent | 148e6b9dae3900f1acd053df10bc41f06be5c507 (diff) | |
download | mupdf-a9e56e9f94515c109a912a50b4bc80466a11b075.tar.xz |
Rework storing internal flags in PDF objects.
Before we render a page we need to evaluate whether we need
transparency or not. To establish this, we recursively walk the
resources looking for certain markers (blend modes, alpha levels,
smasks etc). To avoid doing this repeatedly we'd like to stash
the results somewhere.
Currently we write a '.useBM' entry into the top level dictionary
object, but with the recent changes to support incremental update
this is not ideal - it has the effect of forcing all resources
into the new section of the xref.
So we avoid that horrible hack and use a different one; we make use
of the new flags word in the pdf_obj structure. 1 bit is used to
indicate whether we have stashed a (boolean) value here, and another
bit is used to indicate what that value was.
Diffstat (limited to 'source/pdf/pdf-object.c')
-rw-r--r-- | source/pdf/pdf-object.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/source/pdf/pdf-object.c b/source/pdf/pdf-object.c index a6b3f1ac..aa20b79e 100644 --- a/source/pdf/pdf-object.c +++ b/source/pdf/pdf-object.c @@ -22,7 +22,9 @@ struct keyval enum { PDF_FLAGS_MARKED = 1, - PDF_FLAGS_SORTED = 2 + PDF_FLAGS_SORTED = 2, + PDF_FLAGS_STASH = 4, + PDF_FLAGS_STASH_BOOL = 8 }; struct pdf_obj_s @@ -1188,6 +1190,25 @@ pdf_obj_unmark(pdf_obj *obj) obj->flags &= ~PDF_FLAGS_MARKED; } +void +pdf_obj_stash(pdf_obj *obj, int stash) +{ + obj->flags |= PDF_FLAGS_STASH; + if (stash) + obj->flags |= PDF_FLAGS_STASH_BOOL; + else + obj->flags &= ~PDF_FLAGS_STASH_BOOL; +} + +int +pdf_obj_stashed(pdf_obj *obj, int *stash) +{ + if (!(obj->flags & PDF_FLAGS_STASH)) + return 0; + *stash = !!(obj->flags & PDF_FLAGS_STASH_BOOL); + return 1; +} + static void pdf_free_array(pdf_obj *obj) { |