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 "SkStream.h" | 17 #include "SkStream.h" |
17 | 18 |
18 struct DecoderProc { | 19 struct DecoderProc { |
19 bool (*IsFormat)(SkStream*); | 20 bool (*IsFormat)(SkStream*); |
20 SkCodec* (*NewFromStream)(SkStream*); | 21 SkCodec* (*NewFromStream)(SkStream*); |
21 }; | 22 }; |
22 | 23 |
23 static const DecoderProc gDecoderProcs[] = { | 24 static const DecoderProc gDecoderProcs[] = { |
24 { SkPngCodec::IsPng, SkPngCodec::NewFromStream }, | 25 { SkPngCodec::IsPng, SkPngCodec::NewFromStream }, |
| 26 { SkJpegCodec::IsJpeg, SkJpegCodec::NewFromStream }, |
25 { SkGifCodec::IsGif, SkGifCodec::NewFromStream }, | 27 { SkGifCodec::IsGif, SkGifCodec::NewFromStream }, |
26 { SkIcoCodec::IsIco, SkIcoCodec::NewFromStream }, | 28 { SkIcoCodec::IsIco, SkIcoCodec::NewFromStream }, |
27 { SkBmpCodec::IsBmp, SkBmpCodec::NewFromStream }, | 29 { SkBmpCodec::IsBmp, SkBmpCodec::NewFromStream }, |
28 { SkWbmpCodec::IsWbmp, SkWbmpCodec::NewFromStream } | 30 { SkWbmpCodec::IsWbmp, SkWbmpCodec::NewFromStream } |
29 }; | 31 }; |
30 | 32 |
31 SkCodec* SkCodec::NewFromStream(SkStream* stream) { | 33 SkCodec* SkCodec::NewFromStream(SkStream* stream) { |
32 if (!stream) { | 34 if (!stream) { |
33 return NULL; | 35 return NULL; |
34 } | 36 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 return kNoRewindNecessary_RewindState; | 87 return kNoRewindNecessary_RewindState; |
86 } | 88 } |
87 return fStream->rewind() ? kRewound_RewindState | 89 return fStream->rewind() ? kRewound_RewindState |
88 : kCouldNotRewind_RewindState; | 90 : kCouldNotRewind_RewindState; |
89 } | 91 } |
90 | 92 |
91 SkScanlineDecoder* SkCodec::getScanlineDecoder(const SkImageInfo& dstInfo) { | 93 SkScanlineDecoder* SkCodec::getScanlineDecoder(const SkImageInfo& dstInfo) { |
92 fScanlineDecoder.reset(this->onGetScanlineDecoder(dstInfo)); | 94 fScanlineDecoder.reset(this->onGetScanlineDecoder(dstInfo)); |
93 return fScanlineDecoder.get(); | 95 return fScanlineDecoder.get(); |
94 } | 96 } |
OLD | NEW |