OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #ifndef SkImageGenerator_DEFINED | 8 #ifndef SkImageGenerator_DEFINED |
9 #define SkImageGenerator_DEFINED | 9 #define SkImageGenerator_DEFINED |
10 | 10 |
11 #include "SkColor.h" | 11 #include "SkColor.h" |
12 #include "SkImageInfo.h" | 12 #include "SkImageInfo.h" |
13 | 13 |
14 class SkBitmap; | 14 class SkBitmap; |
15 class SkData; | 15 class SkData; |
16 class SkImageGenerator; | 16 class SkImageGenerator; |
17 | 17 |
18 //#define SK_SUPPORT_LEGACY_OPTIONLESS_GET_PIXELS | |
19 | |
20 /** | 18 /** |
21 * Takes ownership of SkImageGenerator. If this method fails for | 19 * Takes ownership of SkImageGenerator. If this method fails for |
22 * whatever reason, it will return false and immediatetely delete | 20 * whatever reason, it will return false and immediatetely delete |
23 * the generator. If it succeeds, it will modify destination | 21 * the generator. If it succeeds, it will modify destination |
24 * bitmap. | 22 * bitmap. |
25 * | 23 * |
26 * If generator is NULL, will safely return false. | 24 * If generator is NULL, will safely return false. |
27 * | 25 * |
28 * If this fails or when the SkDiscardablePixelRef that is | 26 * If this fails or when the SkDiscardablePixelRef that is |
29 * installed into destination is destroyed, it will call | 27 * installed into destination is destroyed, it will call |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 * this returns a new ImageGenerator for it. Otherwise this returns NULL. E
ither way | 195 * this returns a new ImageGenerator for it. Otherwise this returns NULL. E
ither way |
198 * the caller is still responsible for managing their ownership of the data
. | 196 * the caller is still responsible for managing their ownership of the data
. |
199 */ | 197 */ |
200 static SkImageGenerator* NewFromData(SkData*); | 198 static SkImageGenerator* NewFromData(SkData*); |
201 | 199 |
202 protected: | 200 protected: |
203 SkImageGenerator(const SkImageInfo& info) : fInfo(info) {} | 201 SkImageGenerator(const SkImageInfo& info) : fInfo(info) {} |
204 | 202 |
205 virtual SkData* onRefEncodedData(); | 203 virtual SkData* onRefEncodedData(); |
206 | 204 |
207 #ifdef SK_SUPPORT_LEGACY_OPTIONLESS_GET_PIXELS | |
208 virtual Result onGetPixels(const SkImageInfo& info, | |
209 void* pixels, size_t rowBytes, | |
210 SkPMColor ctable[], int* ctableCount); | |
211 #endif | |
212 virtual Result onGetPixels(const SkImageInfo& info, | 205 virtual Result onGetPixels(const SkImageInfo& info, |
213 void* pixels, size_t rowBytes, const Options&, | 206 void* pixels, size_t rowBytes, const Options&, |
214 SkPMColor ctable[], int* ctableCount); | 207 SkPMColor ctable[], int* ctableCount); |
215 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3]); | 208 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3]); |
216 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3], | 209 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3], |
217 SkYUVColorSpace* colorSpace); | 210 SkYUVColorSpace* colorSpace); |
218 | 211 |
219 private: | 212 private: |
220 const SkImageInfo fInfo; | 213 const SkImageInfo fInfo; |
221 }; | 214 }; |
222 | 215 |
223 #endif // SkImageGenerator_DEFINED | 216 #endif // SkImageGenerator_DEFINED |
OLD | NEW |