aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf/SkPDFDocument.cpp
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2015-03-25 08:38:03 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-03-25 08:38:03 -0700
commit26b5d15dab81883fac05a2d3685ca6e3a3459678 (patch)
tree8a55365ba9445dd9c457273e5868c237901e112a /src/pdf/SkPDFDocument.cpp
parent7a0118465a2dd1783d7b19b026bedd7e13afadf2 (diff)
SkPDF: add canon assert before adding code that might break it
Motivation: We can write subsets (by page) of pdf documents (but this in't yet exposed in the public API), but it is a bad idea to mix pages from multiple documents (de-duping will break). This assert verifies that we don't do this by accident in the future. BUG=skia:3585 Review URL: https://codereview.chromium.org/1037573005
Diffstat (limited to 'src/pdf/SkPDFDocument.cpp')
-rw-r--r--src/pdf/SkPDFDocument.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/pdf/SkPDFDocument.cpp b/src/pdf/SkPDFDocument.cpp
index 57eab950ed..6d49e68584 100644
--- a/src/pdf/SkPDFDocument.cpp
+++ b/src/pdf/SkPDFDocument.cpp
@@ -70,9 +70,12 @@ bool SkPDFDocument::EmitPDF(const SkTDArray<SkPDFDevice*>& pageDevices,
if (pageDevices.isEmpty()) {
return false;
}
+
SkTDArray<SkPDFPage*> pages;
for (int i = 0; i < pageDevices.count(); i++) {
SkASSERT(pageDevices[i]);
+ SkASSERT(i == 0 ||
+ pageDevices[i - 1]->getCanon() == pageDevices[i]->getCanon());
// Reference from new passed to pages.
pages.push(SkNEW_ARGS(SkPDFPage, (pageDevices[i])));
}