Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/pdf/SkPDFDocument.cpp

Issue 1037573005: SkPDF: add canon assert before adding code that might break it (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove TODO message Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pdf/SkPDFDocument.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkPDFCatalog.h" 10 #include "SkPDFCatalog.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 stream->writeText("\nstartxref\n"); 63 stream->writeText("\nstartxref\n");
64 stream->writeBigDecAsText(xRefFileOffset); 64 stream->writeBigDecAsText(xRefFileOffset);
65 stream->writeText("\n%%EOF"); 65 stream->writeText("\n%%EOF");
66 } 66 }
67 67
68 bool SkPDFDocument::EmitPDF(const SkTDArray<SkPDFDevice*>& pageDevices, 68 bool SkPDFDocument::EmitPDF(const SkTDArray<SkPDFDevice*>& pageDevices,
69 SkWStream* stream) { 69 SkWStream* stream) {
70 if (pageDevices.isEmpty()) { 70 if (pageDevices.isEmpty()) {
71 return false; 71 return false;
72 } 72 }
73
73 SkTDArray<SkPDFPage*> pages; 74 SkTDArray<SkPDFPage*> pages;
74 for (int i = 0; i < pageDevices.count(); i++) { 75 for (int i = 0; i < pageDevices.count(); i++) {
75 SkASSERT(pageDevices[i]); 76 SkASSERT(pageDevices[i]);
77 SkASSERT(i == 0 ||
78 pageDevices[i - 1]->getCanon() == pageDevices[i]->getCanon());
76 // Reference from new passed to pages. 79 // Reference from new passed to pages.
77 pages.push(SkNEW_ARGS(SkPDFPage, (pageDevices[i]))); 80 pages.push(SkNEW_ARGS(SkPDFPage, (pageDevices[i])));
78 } 81 }
79 SkPDFCatalog catalog; 82 SkPDFCatalog catalog;
80 83
81 SkTDArray<SkPDFDict*> pageTree; 84 SkTDArray<SkPDFDict*> pageTree;
82 SkAutoTUnref<SkPDFDict> docCatalog(SkNEW_ARGS(SkPDFDict, ("Catalog"))); 85 SkAutoTUnref<SkPDFDict> docCatalog(SkNEW_ARGS(SkPDFDict, ("Catalog")));
83 SkTSet<SkPDFObject*> firstPageResources; 86 SkTSet<SkPDFObject*> firstPageResources;
84 SkTSet<SkPDFObject*> otherPageResources; 87 SkTSet<SkPDFObject*> otherPageResources;
85 SkTDArray<SkPDFObject*> substitutes; 88 SkTDArray<SkPDFObject*> substitutes;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 223 }
221 } 224 }
222 if (notSubsettableCount) { 225 if (notSubsettableCount) {
223 *notSubsettableCount = notSubsettable; 226 *notSubsettableCount = notSubsettable;
224 227
225 } 228 }
226 if (notEmbeddableCount) { 229 if (notEmbeddableCount) {
227 *notEmbeddableCount = notEmbeddable; 230 *notEmbeddableCount = notEmbeddable;
228 } 231 }
229 } 232 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFDocument.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698