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

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
« no previous file with comments | « src/codec/SkAndroidCodec.cpp ('k') | src/codec/SkGifCodec.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkCodec.cpp
diff --git a/src/codec/SkCodec.cpp b/src/codec/SkCodec.cpp
index bb7b26529b9af8fe7c106818e5514c47617cdf76..c4f7498f7947da2ec93c4d485e764117c065ecee 100644
--- a/src/codec/SkCodec.cpp
+++ b/src/codec/SkCodec.cpp
@@ -12,10 +12,10 @@
#include "SkGifCodec.h"
#include "SkIcoCodec.h"
#include "SkJpegCodec.h"
+#ifdef SK_CODEC_DECODES_PNG
#include "SkPngCodec.h"
-#ifdef SK_CODEC_DECODES_RAW
-#include "SkRawCodec.h"
#endif
+#include "SkRawCodec.h"
#include "SkStream.h"
#include "SkWbmpCodec.h"
#include "SkWebpCodec.h"
@@ -26,10 +26,18 @@ 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_PNG
{ SkIcoCodec::IsIco, SkIcoCodec::NewFromStream },
+#endif
{ SkBmpCodec::IsBmp, SkBmpCodec::NewFromStream },
{ SkWbmpCodec::IsWbmp, SkWbmpCodec::NewFromStream }
};
@@ -77,9 +85,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());
« no previous file with comments | « src/codec/SkAndroidCodec.cpp ('k') | src/codec/SkGifCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698