OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkCodec.h" | 8 #include "SkCodec.h" |
9 #include "SkData.h" | 9 #include "SkData.h" |
10 #include "SkCodec_libbmp.h" | 10 #include "SkCodec_libbmp.h" |
11 #include "SkCodec_libgif.h" | 11 #include "SkCodec_libgif.h" |
12 #include "SkCodec_libico.h" | 12 #include "SkCodec_libico.h" |
13 #include "SkCodec_libpng.h" | 13 #include "SkCodec_libpng.h" |
14 #include "SkCodec_wbmp.h" | 14 #include "SkCodec_wbmp.h" |
15 #include "SkCodecPriv.h" | 15 #include "SkCodecPriv.h" |
16 #include "SkJpegCodec.h" | 16 #include "SkJpegCodec.h" |
17 #include "SkStream.h" | 17 #include "SkStream.h" |
| 18 #include "SkWebpCodec.h" |
18 | 19 |
19 struct DecoderProc { | 20 struct DecoderProc { |
20 bool (*IsFormat)(SkStream*); | 21 bool (*IsFormat)(SkStream*); |
21 SkCodec* (*NewFromStream)(SkStream*); | 22 SkCodec* (*NewFromStream)(SkStream*); |
22 }; | 23 }; |
23 | 24 |
24 static const DecoderProc gDecoderProcs[] = { | 25 static const DecoderProc gDecoderProcs[] = { |
25 { SkPngCodec::IsPng, SkPngCodec::NewFromStream }, | 26 { SkPngCodec::IsPng, SkPngCodec::NewFromStream }, |
26 { SkJpegCodec::IsJpeg, SkJpegCodec::NewFromStream }, | 27 { SkJpegCodec::IsJpeg, SkJpegCodec::NewFromStream }, |
| 28 { SkWebpCodec::IsWebp, SkWebpCodec::NewFromStream }, |
27 { SkGifCodec::IsGif, SkGifCodec::NewFromStream }, | 29 { SkGifCodec::IsGif, SkGifCodec::NewFromStream }, |
28 { SkIcoCodec::IsIco, SkIcoCodec::NewFromStream }, | 30 { SkIcoCodec::IsIco, SkIcoCodec::NewFromStream }, |
29 { SkBmpCodec::IsBmp, SkBmpCodec::NewFromStream }, | 31 { SkBmpCodec::IsBmp, SkBmpCodec::NewFromStream }, |
30 { SkWbmpCodec::IsWbmp, SkWbmpCodec::NewFromStream } | 32 { SkWbmpCodec::IsWbmp, SkWbmpCodec::NewFromStream } |
31 }; | 33 }; |
32 | 34 |
33 SkCodec* SkCodec::NewFromStream(SkStream* stream) { | 35 SkCodec* SkCodec::NewFromStream(SkStream* stream) { |
34 if (!stream) { | 36 if (!stream) { |
35 return NULL; | 37 return NULL; |
36 } | 38 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 return fScanlineDecoder.get(); | 102 return fScanlineDecoder.get(); |
101 } | 103 } |
102 | 104 |
103 SkScanlineDecoder* SkCodec::getScanlineDecoder(const SkImageInfo& dstInfo) { | 105 SkScanlineDecoder* SkCodec::getScanlineDecoder(const SkImageInfo& dstInfo) { |
104 SkASSERT(kIndex_8_SkColorType != dstInfo.colorType()); | 106 SkASSERT(kIndex_8_SkColorType != dstInfo.colorType()); |
105 if (kIndex_8_SkColorType == dstInfo.colorType()) { | 107 if (kIndex_8_SkColorType == dstInfo.colorType()) { |
106 return NULL; | 108 return NULL; |
107 } | 109 } |
108 return this->getScanlineDecoder(dstInfo, NULL, NULL, NULL); | 110 return this->getScanlineDecoder(dstInfo, NULL, NULL, NULL); |
109 } | 111 } |
OLD | NEW |