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

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

Issue 1398193002: Revert of SkPDF: Optionally output PDF/A-2b archive format. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 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/SkPDFTypes.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 #include "SkDeflate.h" 9 #include "SkDeflate.h"
10 #include "SkPDFTypes.h" 10 #include "SkPDFTypes.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 case Type::kInt: 170 case Type::kInt:
171 case Type::kBool: 171 case Type::kBool:
172 case Type::kScalar: 172 case Type::kScalar:
173 case Type::kName: 173 case Type::kName:
174 case Type::kString: 174 case Type::kString:
175 case Type::kNameSkS: 175 case Type::kNameSkS:
176 case Type::kStringSkS: 176 case Type::kStringSkS:
177 return; // These have no resources. 177 return; // These have no resources.
178 case Type::kObjRef: { 178 case Type::kObjRef: {
179 SkPDFObject* obj = substituteMap.getSubstitute(fObject); 179 SkPDFObject* obj = substituteMap.getSubstitute(fObject);
180 objNumMap->addObjectRecursively(obj, substituteMap); 180 if (objNumMap->addObject(obj)) {
181 obj->addResources(objNumMap, substituteMap);
182 }
181 return; 183 return;
182 } 184 }
183 case Type::kObject: 185 case Type::kObject:
184 fObject->addResources(objNumMap, substituteMap); 186 fObject->addResources(objNumMap, substituteMap);
185 return; 187 return;
186 default: 188 default:
187 SkDEBUGFAIL("SkPDFUnion::addResources with bad type"); 189 SkDEBUGFAIL("SkPDFUnion::addResources with bad type");
188 } 190 }
189 } 191 }
190 192
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 493
492 bool SkPDFObjNumMap::addObject(SkPDFObject* obj) { 494 bool SkPDFObjNumMap::addObject(SkPDFObject* obj) {
493 if (fObjectNumbers.find(obj)) { 495 if (fObjectNumbers.find(obj)) {
494 return false; 496 return false;
495 } 497 }
496 fObjectNumbers.set(obj, fObjectNumbers.count() + 1); 498 fObjectNumbers.set(obj, fObjectNumbers.count() + 1);
497 fObjects.push(obj); 499 fObjects.push(obj);
498 return true; 500 return true;
499 } 501 }
500 502
501 void SkPDFObjNumMap::addObjectRecursively(SkPDFObject* obj,
502 const SkPDFSubstituteMap& subs) {
503 if (obj && this->addObject(obj)) {
504 obj->addResources(this, subs);
505 }
506 }
507
508 int32_t SkPDFObjNumMap::getObjectNumber(SkPDFObject* obj) const { 503 int32_t SkPDFObjNumMap::getObjectNumber(SkPDFObject* obj) const {
509 int32_t* objectNumberFound = fObjectNumbers.find(obj); 504 int32_t* objectNumberFound = fObjectNumbers.find(obj);
510 SkASSERT(objectNumberFound); 505 SkASSERT(objectNumberFound);
511 return *objectNumberFound; 506 return *objectNumberFound;
512 } 507 }
513 508
514 #ifdef SK_PDF_IMAGE_STATS 509 #ifdef SK_PDF_IMAGE_STATS
515 SkAtomic<int> gDrawImageCalls(0); 510 SkAtomic<int> gDrawImageCalls(0);
516 SkAtomic<int> gJpegImageObjects(0); 511 SkAtomic<int> gJpegImageObjects(0);
517 SkAtomic<int> gRegularImageObjects(0); 512 SkAtomic<int> gRegularImageObjects(0);
518 513
519 void SkPDFImageDumpStats() { 514 void SkPDFImageDumpStats() {
520 SkDebugf("\ntotal PDF drawImage/drawBitmap calls: %d\n" 515 SkDebugf("\ntotal PDF drawImage/drawBitmap calls: %d\n"
521 "total PDF jpeg images: %d\n" 516 "total PDF jpeg images: %d\n"
522 "total PDF regular images: %d\n", 517 "total PDF regular images: %d\n",
523 gDrawImageCalls.load(), 518 gDrawImageCalls.load(),
524 gJpegImageObjects.load(), 519 gJpegImageObjects.load(),
525 gRegularImageObjects.load()); 520 gRegularImageObjects.load());
526 } 521 }
527 #endif // SK_PDF_IMAGE_STATS 522 #endif // SK_PDF_IMAGE_STATS
OLDNEW
« no previous file with comments | « src/pdf/SkPDFTypes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698