Chromium Code Reviews| Index: src/codec/SkCodec.cpp |
| diff --git a/src/codec/SkCodec.cpp b/src/codec/SkCodec.cpp |
| index bb7b26529b9af8fe7c106818e5514c47617cdf76..dc45f37aa7399122d4f61304d05e70bf8134c2da 100644 |
| --- a/src/codec/SkCodec.cpp |
| +++ b/src/codec/SkCodec.cpp |
| @@ -11,11 +11,13 @@ |
| #include "SkData.h" |
| #include "SkGifCodec.h" |
| #include "SkIcoCodec.h" |
| +#ifdef SK_CODEC_DECODES_JPEG |
| #include "SkJpegCodec.h" |
|
msarett
2016/02/17 14:34:54
Don't think I can get rid of this ifdef. SkJpegUt
mtklein
2016/02/17 14:57:31
Are you sure SkJpegCodec.h needs to include SkJpeg
msarett
2016/02/17 15:13:47
Ahh thanks! Removing this.
|
| +#endif |
| +#ifdef SK_CODEC_DECODES_PNG |
|
msarett
2016/02/17 14:34:54
Was almost able to get rid of this ifdef by forwar
mtklein
2016/02/17 14:57:31
:/ Sure can't forward declare typedefs.
You can,
msarett
2016/02/17 15:13:47
Gotcha that's cool. I think I prefer this as is t
|
| #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 +28,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 +87,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()); |