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); |