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 | |
50 private: | 52 private: |
51 | 53 |
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 SkTArray. | |
scroggo
2015/12/02 16:27:03
SkTArray is an implementation detail that isn't ne
msarett
2015/12/03 19:19:16
Done.
| |
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 SkTArray. | |
71 */ | |
72 int chooseCodec(const SkISize& requestedSize, int startIndex); | |
73 | |
52 /* | 74 /* |
53 * Constructor called by NewFromStream | 75 * Constructor called by NewFromStream |
54 * @param embeddedCodecs codecs for the embedded images, takes ownership | 76 * @param embeddedCodecs codecs for the embedded images, takes ownership |
55 */ | 77 */ |
56 SkIcoCodec(const SkImageInfo& srcInfo, | 78 SkIcoCodec(const SkImageInfo& srcInfo, SkTArray<SkAutoTDelete<SkCodec>, true >* embeddedCodecs); |
57 SkTArray<SkAutoTDelete<SkCodec>, true>* embeddedCodecs); | |
58 | 79 |
59 SkAutoTDelete<SkTArray<SkAutoTDelete<SkCodec>, true>> | 80 SkAutoTDelete<SkTArray<SkAutoTDelete<SkCodec>, true>> fEmbeddedCodecs; // ow ned |
60 fEmbeddedCodecs; // owned | 81 |
82 // Only used by the scanline decoder. onStartScanlineDecode() will set | |
83 // fCodec to one of the fEmbeddedCodecs, if it can find a codec of the | |
84 // appropriate size. We will use fCodec for subsequent calls to | |
85 // onGetScanlines() or onSkipScanlines(). | |
86 // fCodec is owned by this class, but should not be an SkAutoTDelete. | |
87 // It will be deleted by the destructor of fEmbeddedCodecs. | |
88 SkCodec* fCodec; | |
scroggo
2015/12/02 16:27:03
I think this should have a name that indicates tha
msarett
2015/12/03 19:19:16
Agreed. fCurrScanlineCodec it is...I can't think
| |
61 | 89 |
62 typedef SkCodec INHERITED; | 90 typedef SkCodec INHERITED; |
63 }; | 91 }; |
OLD | NEW |