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

Unified Diff: src/codec/SkCodec.cpp

Issue 1702533004: Individually enable and disable SkCodecs (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
Index: src/codec/SkCodec.cpp
diff --git a/src/codec/SkCodec.cpp b/src/codec/SkCodec.cpp
index bb7b26529b9af8fe7c106818e5514c47617cdf76..99b0b48860d9850841860ccb7c958a7e2daefe0d 100644
--- a/src/codec/SkCodec.cpp
+++ b/src/codec/SkCodec.cpp
@@ -5,20 +5,35 @@
* found in the LICENSE file.
*/
-#include "SkBmpCodec.h"
#include "SkCodec.h"
#include "SkCodecPriv.h"
#include "SkData.h"
+#include "SkStream.h"
+
+#ifdef SK_CODEC_DECODES_BMP
+#include "SkBmpCodec.h"
+#endif
+#ifdef SK_CODEC_DECODES_GIF
#include "SkGifCodec.h"
+#endif
+#ifdef SK_CODEC_DECODES_ICO
#include "SkIcoCodec.h"
+#endif
+#ifdef SK_CODEC_DECODES_JPEG
#include "SkJpegCodec.h"
+#endif
+#ifdef SK_CODEC_DECODES_PNG
#include "SkPngCodec.h"
+#endif
#ifdef SK_CODEC_DECODES_RAW
#include "SkRawCodec.h"
#endif
-#include "SkStream.h"
+#ifdef SK_CODEC_DECODES_WBMP
#include "SkWbmpCodec.h"
+#endif
+#ifdef SK_CODEC_DECODES_WEBP
#include "SkWebpCodec.h"
+#endif
struct DecoderProc {
bool (*IsFormat)(const void*, size_t);
@@ -26,12 +41,24 @@ struct DecoderProc {
};
static const DecoderProc gDecoderProcs[] = {
+#ifdef SK_CODEC_DECODES_JPEG
{ SkJpegCodec::IsJpeg, SkJpegCodec::NewFromStream },
+#endif
+#ifdef SK_CODEC_DECODES_WEBP
{ SkWebpCodec::IsWebp, SkWebpCodec::NewFromStream },
+#endif
+#ifdef SK_CODEC_DECODES_GIF
{ SkGifCodec::IsGif, SkGifCodec::NewFromStream },
+#endif
+#ifdef SK_CODEC_DECODES_ICO
{ SkIcoCodec::IsIco, SkIcoCodec::NewFromStream },
+#endif
+#ifdef SK_CODEC_DECODES_BMP
{ SkBmpCodec::IsBmp, SkBmpCodec::NewFromStream },
+#endif
+#ifdef SK_CODEC_DECODES_WBMP
{ SkWbmpCodec::IsWbmp, SkWbmpCodec::NewFromStream }
+#endif
};
size_t SkCodec::MinBufferedBytesNeeded() {
@@ -77,9 +104,12 @@ SkCodec* SkCodec::NewFromStream(SkStream* stream,
// PNG is special, since we want to be able to supply an SkPngChunkReader.
// But this code follows the same pattern as the loop.
+#ifdef SK_CODEC_DECODES_PNG
if (SkPngCodec::IsPng(buffer, bytesRead)) {
return SkPngCodec::NewFromStream(streamDeleter.detach(), chunkReader);
- } else {
+ } else
+#endif
+ {
for (DecoderProc proc : gDecoderProcs) {
if (proc.IsFormat(buffer, bytesRead)) {
return proc.NewFromStream(streamDeleter.detach());
« public.bzl ('K') | « src/codec/SkAndroidCodec.cpp ('k') | tests/CodexTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698