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

Unified Diff: src/pdf/SkPDFStream.cpp

Issue 1840103002: SkPDF: skia_pdf_less_compression - for debugging only (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-03-29 (Tuesday) 12:43:26 EDT Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gyp/pdf.gyp ('k') | src/pdf/SkPDFTypes.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFStream.cpp
diff --git a/src/pdf/SkPDFStream.cpp b/src/pdf/SkPDFStream.cpp
index 10fc77b58769d50d2aa9a7cd06e7ce75c99f0103..bfe33a84655861d8061b8d7d91b29cd5fa441b00 100644
--- a/src/pdf/SkPDFStream.cpp
+++ b/src/pdf/SkPDFStream.cpp
@@ -33,11 +33,21 @@ void SkPDFStream::emitObject(SkWStream* stream,
stream->writeText("\nendstream");
}
+
void SkPDFStream::setData(SkStream* stream) {
SkASSERT(!fCompressedData); // Only call this function once.
SkASSERT(stream);
// Code assumes that the stream starts at the beginning.
+ #ifdef SK_PDF_LESS_COMPRESSION
+ std::unique_ptr<SkStreamRewindable> duplicate(stream->duplicate());
+ if (duplicate && duplicate->hasLength()) {
+ this->insertInt("Length", duplicate->getLength());
+ fCompressedData.reset(duplicate.release());
+ return;
+ }
+ #endif
+
SkDynamicMemoryWStream compressedData;
SkDeflateWStream deflateWStream(&compressedData);
SkStreamCopy(&deflateWStream, stream);
« no previous file with comments | « gyp/pdf.gyp ('k') | src/pdf/SkPDFTypes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698