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

Unified Diff: src/pdf/SkDeflate.cpp

Issue 1681603002: SkDeflateWStream: support gzip output (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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 | « src/pdf/SkDeflate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkDeflate.cpp
diff --git a/src/pdf/SkDeflate.cpp b/src/pdf/SkDeflate.cpp
index 0a5b6f964addff736934f481e7c8ebadd51b89b8..3ae0d460684c7db296f4503c5271fcbab4340aa9 100644
--- a/src/pdf/SkDeflate.cpp
+++ b/src/pdf/SkDeflate.cpp
@@ -65,16 +65,23 @@ struct SkDeflateWStream::Impl {
z_stream fZStream;
};
-SkDeflateWStream::SkDeflateWStream(SkWStream* out) : fImpl(new SkDeflateWStream::Impl) {
+SkDeflateWStream::SkDeflateWStream(SkWStream* out,
+ int compressionLevel,
+ bool gzip)
+ : fImpl(new SkDeflateWStream::Impl) {
fImpl->fOut = out;
fImpl->fInBufferIndex = 0;
if (!fImpl->fOut) {
return;
}
+ fImpl->fZStream.next_in = nullptr;
fImpl->fZStream.zalloc = &skia_alloc_func;
fImpl->fZStream.zfree = &skia_free_func;
fImpl->fZStream.opaque = nullptr;
- SkDEBUGCODE(int r =) deflateInit(&fImpl->fZStream, Z_DEFAULT_COMPRESSION);
+ SkASSERT(compressionLevel <= 9 && compressionLevel >= -1);
+ SkDEBUGCODE(int r =) deflateInit2(&fImpl->fZStream, compressionLevel,
+ Z_DEFLATED, gzip ? 0x1F : 0x0F,
+ 8, Z_DEFAULT_STRATEGY);
SkASSERT(Z_OK == r);
}
« no previous file with comments | « src/pdf/SkDeflate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698