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 "SkImageInfo.h" | 9 #include "SkImageInfo.h" |
10 #include "SkStream.h" | 10 #include "SkStream.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 /* | 40 /* |
41 * Initiates the Ico decode | 41 * Initiates the Ico decode |
42 */ | 42 */ |
43 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes
, const Options&, | 43 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes
, const Options&, |
44 SkPMColor*, int*, int*) override; | 44 SkPMColor*, int*, int*) override; |
45 | 45 |
46 SkEncodedFormat onGetEncodedFormat() const override { | 46 SkEncodedFormat onGetEncodedFormat() const override { |
47 return kICO_SkEncodedFormat; | 47 return kICO_SkEncodedFormat; |
48 } | 48 } |
49 | 49 |
50 SkScanlineOrder onGetScanlineOrder() const override; | |
51 | |
52 private: | 50 private: |
53 | 51 |
54 Result onStartScanlineDecode(const SkImageInfo& dstInfo, const SkCodec::Opti
ons& options, | |
55 SkPMColor inputColorPtr[], int* inputColorCount) override; | |
56 | |
57 int onGetScanlines(void* dst, int count, size_t rowBytes) override; | |
58 | |
59 bool onSkipScanlines(int count) override; | |
60 | |
61 SkSampler* getSampler(bool createIfNecessary) override; | |
62 | |
63 /* | |
64 * Searches fEmbeddedCodecs for a codec that matches requestedSize. | |
65 * The search starts at startIndex and ends when an appropriate codec | |
66 * is found, or we have reached the end of the array. | |
67 * | |
68 * @return the index of the matching codec or -1 if there is no | |
69 * matching codec between startIndex and the end of | |
70 * the array. | |
71 */ | |
72 int chooseCodec(const SkISize& requestedSize, int startIndex); | |
73 | |
74 /* | 52 /* |
75 * Constructor called by NewFromStream | 53 * Constructor called by NewFromStream |
76 * @param embeddedCodecs codecs for the embedded images, takes ownership | 54 * @param embeddedCodecs codecs for the embedded images, takes ownership |
77 */ | 55 */ |
78 SkIcoCodec(const SkImageInfo& srcInfo, SkTArray<SkAutoTDelete<SkCodec>, true
>* embeddedCodecs); | 56 SkIcoCodec(const SkImageInfo& srcInfo, |
| 57 SkTArray<SkAutoTDelete<SkCodec>, true>* embeddedCodecs); |
79 | 58 |
80 SkAutoTDelete<SkTArray<SkAutoTDelete<SkCodec>, true>> fEmbeddedCodecs; // ow
ned | 59 SkAutoTDelete<SkTArray<SkAutoTDelete<SkCodec>, true>> |
81 | 60 fEmbeddedCodecs; // owned |
82 // Only used by the scanline decoder. onStartScanlineDecode() will set | |
83 // fCurrScanlineCodec to one of the fEmbeddedCodecs, if it can find a | |
84 // codec of the appropriate size. We will use fCurrScanlineCodec for | |
85 // subsequent calls to onGetScanlines() or onSkipScanlines(). | |
86 // fCurrScanlineCodec is owned by this class, but should not be an | |
87 // SkAutoTDelete. It will be deleted by the destructor of fEmbeddedCodecs. | |
88 SkCodec* fCurrScanlineCodec; | |
89 | 61 |
90 typedef SkCodec INHERITED; | 62 typedef SkCodec INHERITED; |
91 }; | 63 }; |
OLD | NEW |