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 "SkImageGenerator.h" | 10 #include "SkImageGenerator.h" |
11 | 11 |
12 class SkCodecImageGenerator : public SkImageGenerator { | 12 class SkCodecImageGenerator : public SkImageGenerator { |
13 public: | 13 public: |
14 /* | 14 /* |
15 * If this data represents an encoded image that we know how to decode, | 15 * If this data represents an encoded image that we know how to decode, |
16 * return an SkCodecImageGenerator. Otherwise return nullptr. | 16 * return an SkCodecImageGenerator. Otherwise return nullptr. |
17 * | 17 * |
18 * Refs the data if an image generator can be returned. Otherwise does | 18 * Refs the data if an image generator can be returned. Otherwise does |
19 * not affect the data. | 19 * not affect the data. |
20 */ | 20 */ |
21 static SkImageGenerator* NewFromEncodedCodec(SkData* data); | 21 static SkImageGenerator* NewFromEncodedCodec(SkData* data); |
22 | 22 |
23 protected: | 23 protected: |
24 SkData* onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM) override; | 24 SkData* onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM) override; |
25 | 25 |
26 bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkP
MColor ctable[], | 26 bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkP
MColor ctable[], |
27 int* ctableCount) override; | 27 int* ctableCount) override; |
28 | 28 |
29 bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3], | 29 bool onQueryYUV8(SkYUVSizeInfo*, SkYUVColorSpace*) const override; |
30 SkYUVColorSpace* colorSpace) override; | 30 |
| 31 bool onGetYUV8Planes(const SkYUVSizeInfo&, void* planes[3]) override; |
31 | 32 |
32 private: | 33 private: |
33 /* | 34 /* |
34 * Takes ownership of codec | 35 * Takes ownership of codec |
35 * Refs the data | 36 * Refs the data |
36 */ | 37 */ |
37 SkCodecImageGenerator(SkCodec* codec, SkData* data); | 38 SkCodecImageGenerator(SkCodec* codec, SkData* data); |
38 | 39 |
39 SkAutoTDelete<SkCodec> fCodec; | 40 SkAutoTDelete<SkCodec> fCodec; |
40 SkAutoTUnref<SkData> fData; | 41 SkAutoTUnref<SkData> fData; |
41 | 42 |
42 // FIXME: These fields are necessary only until we change the API of SkImage
Generator | |
43 // to match SkCodec. Once the API is changed, they should be removed
. | |
44 int fYWidth; | |
45 int fUWidth; | |
46 int fVWidth; | |
47 | |
48 typedef SkImageGenerator INHERITED; | 43 typedef SkImageGenerator INHERITED; |
49 }; | 44 }; |
OLD | NEW |