| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkDeflate.h" | 8 #include "SkDeflate.h" |
| 9 #include "SkPDFTypes.h" | 9 #include "SkPDFTypes.h" |
| 10 #include "SkPDFUtils.h" | 10 #include "SkPDFUtils.h" |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 } | 466 } |
| 467 | 467 |
| 468 void SkPDFSharedStream::emitObject( | 468 void SkPDFSharedStream::emitObject( |
| 469 SkWStream* stream, | 469 SkWStream* stream, |
| 470 const SkPDFObjNumMap& objNumMap, | 470 const SkPDFObjNumMap& objNumMap, |
| 471 const SkPDFSubstituteMap& substitutes) const { | 471 const SkPDFSubstituteMap& substitutes) const { |
| 472 SkASSERT(!fDumped); | 472 SkASSERT(!fDumped); |
| 473 SkDynamicMemoryWStream buffer; | 473 SkDynamicMemoryWStream buffer; |
| 474 SkDeflateWStream deflateWStream(&buffer); | 474 SkDeflateWStream deflateWStream(&buffer); |
| 475 // Since emitObject is const, this function doesn't change the dictionary. | 475 // Since emitObject is const, this function doesn't change the dictionary. |
| 476 SkAutoTDelete<SkStreamAsset> dup(fAsset->duplicate()); // Cheap copy | 476 std::unique_ptr<SkStreamAsset> dup(fAsset->duplicate()); // Cheap copy |
| 477 SkASSERT(dup); | 477 SkASSERT(dup); |
| 478 SkStreamCopy(&deflateWStream, dup.get()); | 478 SkStreamCopy(&deflateWStream, dup.get()); |
| 479 deflateWStream.finalize(); | 479 deflateWStream.finalize(); |
| 480 size_t length = buffer.bytesWritten(); | 480 size_t length = buffer.bytesWritten(); |
| 481 stream->writeText("<<"); | 481 stream->writeText("<<"); |
| 482 fDict->emitAll(stream, objNumMap, substitutes); | 482 fDict->emitAll(stream, objNumMap, substitutes); |
| 483 stream->writeText("\n"); | 483 stream->writeText("\n"); |
| 484 SkPDFUnion::Name("Length").emitObject(stream, objNumMap, substitutes); | 484 SkPDFUnion::Name("Length").emitObject(stream, objNumMap, substitutes); |
| 485 stream->writeText(" "); | 485 stream->writeText(" "); |
| 486 SkPDFUnion::Int(length).emitObject(stream, objNumMap, substitutes); | 486 SkPDFUnion::Int(length).emitObject(stream, objNumMap, substitutes); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 | 550 |
| 551 void SkPDFImageDumpStats() { | 551 void SkPDFImageDumpStats() { |
| 552 SkDebugf("\ntotal PDF drawImage/drawBitmap calls: %d\n" | 552 SkDebugf("\ntotal PDF drawImage/drawBitmap calls: %d\n" |
| 553 "total PDF jpeg images: %d\n" | 553 "total PDF jpeg images: %d\n" |
| 554 "total PDF regular images: %d\n", | 554 "total PDF regular images: %d\n", |
| 555 gDrawImageCalls.load(), | 555 gDrawImageCalls.load(), |
| 556 gJpegImageObjects.load(), | 556 gJpegImageObjects.load(), |
| 557 gRegularImageObjects.load()); | 557 gRegularImageObjects.load()); |
| 558 } | 558 } |
| 559 #endif // SK_PDF_IMAGE_STATS | 559 #endif // SK_PDF_IMAGE_STATS |
| OLD | NEW |