aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2016-02-17 08:26:31 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-17 08:26:32 -0800
commit39b2d5a1ac4171aba0e92cb3f9882f62e5730e3e (patch)
treed79532f87a1b9f6b62db61389727d85d9a423fc9 /src
parent46d2aa824c0a0ee8218d90e821786bd51a63be1e (diff)
Individually enable and disable SkCodecs
BUG=skia:4956 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1702533004 CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Ubuntu-GCC-x86_64-Release-CMake-Trybot Review URL: https://codereview.chromium.org/1702533004
Diffstat (limited to 'src')
-rw-r--r--src/codec/SkAndroidCodec.cpp20
-rw-r--r--src/codec/SkCodec.cpp17
-rw-r--r--src/codec/SkGifCodec.cpp2
-rw-r--r--src/codec/SkGifCodec.h3
-rw-r--r--src/codec/SkJpegCodec.h7
-rw-r--r--src/codec/SkJpegDecoderMgr.h1
6 files changed, 33 insertions, 17 deletions
diff --git a/src/codec/SkAndroidCodec.cpp b/src/codec/SkAndroidCodec.cpp
index 6c3113ccfc..7dfd64de75 100644
--- a/src/codec/SkAndroidCodec.cpp
+++ b/src/codec/SkAndroidCodec.cpp
@@ -8,9 +8,7 @@
#include "SkAndroidCodec.h"
#include "SkCodec.h"
#include "SkCodecPriv.h"
-#ifdef SK_CODEC_DECODES_RAW
#include "SkRawAdapterCodec.h"
-#endif
#include "SkSampledCodec.h"
#include "SkWebpAdapterCodec.h"
@@ -31,15 +29,23 @@ SkAndroidCodec* SkAndroidCodec::NewFromStream(SkStream* stream, SkPngChunkReader
}
switch (codec->getEncodedFormat()) {
- case kWEBP_SkEncodedFormat:
- return new SkWebpAdapterCodec((SkWebpCodec*) codec.detach());
+#ifdef SK_CODEC_DECODES_PNG
case kPNG_SkEncodedFormat:
+ case kICO_SkEncodedFormat:
+#endif
+#ifdef SK_CODEC_DECODES_JPEG
case kJPEG_SkEncodedFormat:
- case kWBMP_SkEncodedFormat:
- case kBMP_SkEncodedFormat:
+#endif
+#ifdef SK_CODEC_DECODES_GIF
case kGIF_SkEncodedFormat:
- case kICO_SkEncodedFormat:
+#endif
+ case kBMP_SkEncodedFormat:
+ case kWBMP_SkEncodedFormat:
return new SkSampledCodec(codec.detach());
+#ifdef SK_CODEC_DECODES_WEBP
+ case kWEBP_SkEncodedFormat:
+ return new SkWebpAdapterCodec((SkWebpCodec*) codec.detach());
+#endif
#ifdef SK_CODEC_DECODES_RAW
case kRAW_SkEncodedFormat:
return new SkRawAdapterCodec((SkRawCodec*)codec.detach());
diff --git a/src/codec/SkCodec.cpp b/src/codec/SkCodec.cpp
index bb7b26529b..c4f7498f79 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());
diff --git a/src/codec/SkGifCodec.cpp b/src/codec/SkGifCodec.cpp
index 699554706b..c7b15e7a22 100644
--- a/src/codec/SkGifCodec.cpp
+++ b/src/codec/SkGifCodec.cpp
@@ -13,6 +13,8 @@
#include "SkSwizzler.h"
#include "SkUtils.h"
+#include "gif_lib.h"
+
/*
* Checks the start of the stream to see if the image is a gif
*/
diff --git a/src/codec/SkGifCodec.h b/src/codec/SkGifCodec.h
index 010a344cf5..a46667a375 100644
--- a/src/codec/SkGifCodec.h
+++ b/src/codec/SkGifCodec.h
@@ -10,7 +10,8 @@
#include "SkImageInfo.h"
#include "SkSwizzler.h"
-#include "gif_lib.h"
+struct GifFileType;
+struct SavedImage;
/*
*
diff --git a/src/codec/SkJpegCodec.h b/src/codec/SkJpegCodec.h
index 283dd8fe37..06685cfd4c 100644
--- a/src/codec/SkJpegCodec.h
+++ b/src/codec/SkJpegCodec.h
@@ -10,14 +10,11 @@
#include "SkCodec.h"
#include "SkImageInfo.h"
-#include "SkJpegDecoderMgr.h"
-#include "SkJpegUtility_codec.h"
+#include "SkSwizzler.h"
#include "SkStream.h"
#include "SkTemplates.h"
-extern "C" {
- #include "jpeglib.h"
-}
+class JpegDecoderMgr;
/*
*
diff --git a/src/codec/SkJpegDecoderMgr.h b/src/codec/SkJpegDecoderMgr.h
index 8e938ad535..7d34b67a0c 100644
--- a/src/codec/SkJpegDecoderMgr.h
+++ b/src/codec/SkJpegDecoderMgr.h
@@ -11,7 +11,6 @@
#include "SkCodec.h"
#include "SkCodecPriv.h"
#include "SkJpegUtility_codec.h"
-#include "SkSwizzler.h"
// stdio is needed for jpeglib
#include <stdio.h>