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

Unified Diff: src/pdf/SkPDFBitmap.cpp

Issue 936403002: PDF: why do we have flags no one uses (or can use)? (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 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 | « no previous file | src/pdf/SkPDFCatalog.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFBitmap.cpp
diff --git a/src/pdf/SkPDFBitmap.cpp b/src/pdf/SkPDFBitmap.cpp
index 26410d7fa3f0342bb4494ad4ce8fe2fdaa6ba94c..b65709cf7c31f8629d187dd70ba56ed7fa08b75c 100644
--- a/src/pdf/SkPDFBitmap.cpp
+++ b/src/pdf/SkPDFBitmap.cpp
@@ -30,14 +30,6 @@ static size_t pixel_count(const SkBitmap& bm) {
return SkToSizeT(bm.width()) * SkToSizeT(bm.height());
}
-static bool skip_compression(SkPDFDocument::Flags flag) {
-#ifndef SK_NO_FLATE
- return SkToBool(flag & SkPDFDocument::kFavorSpeedOverSize_Flags);
-#else
- return true;
-#endif // SK_NO_FLATE
-}
-
// write a single byte to a stream n times.
static void fill_stream(SkWStream* out, char value, size_t n) {
char buffer[4096];
@@ -164,14 +156,6 @@ private:
void PDFAlphaBitmap::emitObject(SkWStream* stream, SkPDFCatalog* catalog) {
SkAutoLockPixels autoLockPixels(fBitmap);
- if (skip_compression(catalog->getDocumentFlags())) {
- this->emitDict(stream, catalog, pixel_count(fBitmap),
- /*deflate=*/false);
- pdf_stream_begin(stream);
- pmcolor_alpha_to_a8(fBitmap, stream);
- pdf_stream_end(stream);
- return;
- }
#ifndef SK_NO_FLATE
// Write to a temporary buffer to get the compressed length.
SkDynamicMemoryWStream buffer;
@@ -184,6 +168,11 @@ void PDFAlphaBitmap::emitObject(SkWStream* stream, SkPDFCatalog* catalog) {
pdf_stream_begin(stream);
stream->writeStream(asset.get(), asset->getLength());
pdf_stream_end(stream);
+#else
+ this->emitDict(stream, catalog, pixel_count(fBitmap), /*deflate=*/false);
+ pdf_stream_begin(stream);
+ pmcolor_alpha_to_a8(fBitmap, stream);
+ pdf_stream_end(stream);
#endif // SK_NO_FLATE
}
@@ -217,14 +206,6 @@ void SkPDFBitmap::addResources(SkTSet<SkPDFObject*>* resourceSet,
void SkPDFBitmap::emitObject(SkWStream* stream, SkPDFCatalog* catalog) {
SkAutoLockPixels autoLockPixels(fBitmap);
- if (skip_compression(catalog->getDocumentFlags())) {
- this->emitDict(stream, catalog, 3 * pixel_count(fBitmap),
- /*deflate=*/false);
- pdf_stream_begin(stream);
- pmcolor_to_rgb24(fBitmap, stream);
- pdf_stream_end(stream);
- return;
- }
#ifndef SK_NO_FLATE
// Write to a temporary buffer to get the compressed length.
SkDynamicMemoryWStream buffer;
@@ -237,6 +218,12 @@ void SkPDFBitmap::emitObject(SkWStream* stream, SkPDFCatalog* catalog) {
pdf_stream_begin(stream);
stream->writeStream(asset.get(), asset->getLength());
pdf_stream_end(stream);
+#else
+ this->emitDict(stream, catalog, 3 * pixel_count(fBitmap), /*deflate=*/false);
+ pdf_stream_begin(stream);
+ pmcolor_to_rgb24(fBitmap, stream);
+ pdf_stream_end(stream);
+ return;
#endif // SK_NO_FLATE
}
« no previous file with comments | « no previous file | src/pdf/SkPDFCatalog.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698