aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_optimization.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2012-07-11 21:29:41 +0200
committerJay Berkenbilt <ejb@ql.org>2012-07-11 21:54:33 +0200
commite7b8f297ba92f4cadf88efcb394830dc24d54738 (patch)
tree4bc25b3928545d81c4b8029fab389af8bccfdbc5 /libqpdf/QPDF_optimization.cc
parent8a217eb3a26931453b4f003c6c18ad8569230cf1 (diff)
downloadqpdf-e7b8f297ba92f4cadf88efcb394830dc24d54738.tar.zst
Support copying objects from another QPDF object
This includes QPDF::copyForeignObject and supporting foreign objects as arguments to addPage*.
Diffstat (limited to 'libqpdf/QPDF_optimization.cc')
-rw-r--r--libqpdf/QPDF_optimization.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/libqpdf/QPDF_optimization.cc b/libqpdf/QPDF_optimization.cc
index e6ad2750..e1fa8e76 100644
--- a/libqpdf/QPDF_optimization.cc
+++ b/libqpdf/QPDF_optimization.cc
@@ -232,6 +232,14 @@ QPDF::pushInheritedAttributesToPage(bool allow_changes, bool warn_skipped_keys)
// Traverse pages tree pushing all inherited resources down to the
// page level.
+ // The record of whether we've done this is cleared by
+ // updateAllPagesCache(). If we're warning for skipped keys,
+ // re-traverse unconditionally.
+ if (this->pushed_inherited_attributes_to_pages && (! warn_skipped_keys))
+ {
+ return;
+ }
+
// key_ancestors is a mapping of page attribute keys to a stack of
// Pages nodes that contain values for them.
std::map<std::string, std::vector<QPDFObjectHandle> > key_ancestors;
@@ -240,6 +248,7 @@ QPDF::pushInheritedAttributesToPage(bool allow_changes, bool warn_skipped_keys)
this->trailer.getKey("/Root").getKey("/Pages"),
key_ancestors, this->all_pages, allow_changes, warn_skipped_keys);
assert(key_ancestors.empty());
+ this->pushed_inherited_attributes_to_pages = true;
}
void