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

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

Issue 2231483002: SkPDF: Subset Type3 (fallback) font (Closed) Base URL: https://skia.googlesource.com/skia.git@SkPDF_next3
Patch Set: 2016-08-12 (Friday) 10:20:16 EDT Created 4 years, 4 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/SkPDFFont.cpp ('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 * 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 "SkData.h" 8 #include "SkData.h"
9 #include "SkDeflate.h" 9 #include "SkDeflate.h"
10 #include "SkPDFTypes.h" 10 #include "SkPDFTypes.h"
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 566
567 #ifdef SK_PDF_LESS_COMPRESSION 567 #ifdef SK_PDF_LESS_COMPRESSION
568 fCompressedData = std::move(stream); 568 fCompressedData = std::move(stream);
569 SkASSERT(fCompressedData && fCompressedData->hasLength()); 569 SkASSERT(fCompressedData && fCompressedData->hasLength());
570 fDict.insertInt("Length", fCompressedData->getLength()); 570 fDict.insertInt("Length", fCompressedData->getLength());
571 #else 571 #else
572 572
573 SkASSERT(stream->hasLength()); 573 SkASSERT(stream->hasLength());
574 SkDynamicMemoryWStream compressedData; 574 SkDynamicMemoryWStream compressedData;
575 SkDeflateWStream deflateWStream(&compressedData); 575 SkDeflateWStream deflateWStream(&compressedData);
576 SkStreamCopy(&deflateWStream, stream.get()); 576 if (stream->getLength() > 0) {
577 SkStreamCopy(&deflateWStream, stream.get());
578 }
577 deflateWStream.finalize(); 579 deflateWStream.finalize();
578 size_t compressedLength = compressedData.bytesWritten(); 580 size_t compressedLength = compressedData.bytesWritten();
579 size_t originalLength = stream->getLength(); 581 size_t originalLength = stream->getLength();
580 582
581 if (originalLength <= compressedLength + strlen("/Filter_/FlateDecode_")) { 583 if (originalLength <= compressedLength + strlen("/Filter_/FlateDecode_")) {
582 SkAssertResult(stream->rewind()); 584 SkAssertResult(stream->rewind());
583 fCompressedData = std::move(stream); 585 fCompressedData = std::move(stream);
584 fDict.insertInt("Length", originalLength); 586 fDict.insertInt("Length", originalLength);
585 return; 587 return;
586 } 588 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 642
641 void SkPDFImageDumpStats() { 643 void SkPDFImageDumpStats() {
642 SkDebugf("\ntotal PDF drawImage/drawBitmap calls: %d\n" 644 SkDebugf("\ntotal PDF drawImage/drawBitmap calls: %d\n"
643 "total PDF jpeg images: %d\n" 645 "total PDF jpeg images: %d\n"
644 "total PDF regular images: %d\n", 646 "total PDF regular images: %d\n",
645 gDrawImageCalls.load(), 647 gDrawImageCalls.load(),
646 gJpegImageObjects.load(), 648 gJpegImageObjects.load(),
647 gRegularImageObjects.load()); 649 gRegularImageObjects.load());
648 } 650 }
649 #endif // SK_PDF_IMAGE_STATS 651 #endif // SK_PDF_IMAGE_STATS
OLDNEW
« no previous file with comments | « src/pdf/SkPDFFont.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698