OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
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 SkPixelRef_DEFINED | 8 #ifndef SkPixelRef_DEFINED |
9 #define SkPixelRef_DEFINED | 9 #define SkPixelRef_DEFINED |
10 | 10 |
(...skipping 202 matching lines...) Loading... | |
213 */ | 213 */ |
214 bool decodeInto(int pow2, SkBitmap* bitmap) { | 214 bool decodeInto(int pow2, SkBitmap* bitmap) { |
215 SkASSERT(pow2 >= 0); | 215 SkASSERT(pow2 >= 0); |
216 return this->onDecodeInto(pow2, bitmap); | 216 return this->onDecodeInto(pow2, bitmap); |
217 } | 217 } |
218 | 218 |
219 /** Are we really wrapping a texture instead of a bitmap? | 219 /** Are we really wrapping a texture instead of a bitmap? |
220 */ | 220 */ |
221 virtual GrTexture* getTexture() { return NULL; } | 221 virtual GrTexture* getTexture() { return NULL; } |
222 | 222 |
223 enum YUVColorSpace { | |
rileya (GONE FROM CHROMIUM)
2014/09/11 06:59:30
This would probably be better off somewhere else,
| |
224 /** Standard JPEG color space. */ | |
225 kJPEG_YUVColorSpace, | |
226 /** SDTV standard Rec. 601 color space. Uses "studio swing" [16, 235] co lor | |
227 range. See http://en.wikipedia.org/wiki/Rec._601 for details. */ | |
228 kRec601_YUVColorSpace | |
229 }; | |
230 | |
223 /** | 231 /** |
224 * If any planes or rowBytes is NULL, this should output the sizes and retu rn true | 232 * If any planes or rowBytes is NULL, this should output the sizes and retu rn true |
225 * if it can efficiently return YUV planar data. If it cannot, it should re turn false. | 233 * if it can efficiently return YUV planar data. If it cannot, it should re turn false. |
226 * | 234 * |
227 * If all planes and rowBytes are not NULL, then it should copy the associa ted Y,U,V data | 235 * If all planes and rowBytes are not NULL, then it should copy the associa ted Y,U,V data |
228 * into those planes of memory supplied by the caller. It should validate t hat the sizes | 236 * into those planes of memory supplied by the caller. It should validate t hat the sizes |
229 * match what it expected. If the sizes do not match, it should return fals e. | 237 * match what it expected. If the sizes do not match, it should return fals e. |
238 * | |
239 * If colorSpace is not NULL, the YUV color space of the data should be sto red in the address | |
240 * it points at. | |
230 */ | 241 */ |
231 bool getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3]) { | 242 bool getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3], |
232 return this->onGetYUV8Planes(sizes, planes, rowBytes); | 243 YUVColorSpace* colorSpace) { |
244 return this->onGetYUV8Planes(sizes, planes, rowBytes, colorSpace); | |
233 } | 245 } |
234 | 246 |
235 bool readPixels(SkBitmap* dst, const SkIRect* subset = NULL); | 247 bool readPixels(SkBitmap* dst, const SkIRect* subset = NULL); |
236 | 248 |
237 /** | 249 /** |
238 * Makes a deep copy of this PixelRef, respecting the requested config. | 250 * Makes a deep copy of this PixelRef, respecting the requested config. |
239 * @param colorType Desired colortype. | 251 * @param colorType Desired colortype. |
240 * @param subset Subset of this PixelRef to copy. Must be fully contained w ithin the bounds of | 252 * @param subset Subset of this PixelRef to copy. Must be fully contained w ithin the bounds of |
241 * of this PixelRef. | 253 * of this PixelRef. |
242 * @return A new SkPixelRef, or NULL if either there is an error (e.g. the destination could | 254 * @return A new SkPixelRef, or NULL if either there is an error (e.g. the destination could |
(...skipping 69 matching lines...) Loading... | |
312 * able to make a copy of them (e.g. if the pixels are on the GPU). | 324 * able to make a copy of them (e.g. if the pixels are on the GPU). |
313 * | 325 * |
314 * The base class implementation returns false; | 326 * The base class implementation returns false; |
315 */ | 327 */ |
316 virtual bool onReadPixels(SkBitmap* dst, const SkIRect* subsetOrNull); | 328 virtual bool onReadPixels(SkBitmap* dst, const SkIRect* subsetOrNull); |
317 | 329 |
318 // default impl returns NULL. | 330 // default impl returns NULL. |
319 virtual SkData* onRefEncodedData(); | 331 virtual SkData* onRefEncodedData(); |
320 | 332 |
321 // default impl returns false. | 333 // default impl returns false. |
322 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy tes[3]); | 334 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy tes[3], |
335 YUVColorSpace* colorSpace); | |
323 | 336 |
324 /** | 337 /** |
325 * Returns the size (in bytes) of the internally allocated memory. | 338 * Returns the size (in bytes) of the internally allocated memory. |
326 * This should be implemented in all serializable SkPixelRef derived classe s. | 339 * This should be implemented in all serializable SkPixelRef derived classe s. |
327 * SkBitmap::fPixelRefOffset + SkBitmap::getSafeSize() should never overflo w this value, | 340 * SkBitmap::fPixelRefOffset + SkBitmap::getSafeSize() should never overflo w this value, |
328 * otherwise the rendering code may attempt to read memory out of bounds. | 341 * otherwise the rendering code may attempt to read memory out of bounds. |
329 * | 342 * |
330 * @return default impl returns 0. | 343 * @return default impl returns 0. |
331 */ | 344 */ |
332 virtual size_t getAllocatedSizeInBytes() const; | 345 virtual size_t getAllocatedSizeInBytes() const; |
(...skipping 48 matching lines...) Loading... | |
381 /** | 394 /** |
382 * Allocate a new pixelref matching the specified ImageInfo, allocating | 395 * Allocate a new pixelref matching the specified ImageInfo, allocating |
383 * the memory for the pixels. If the ImageInfo requires a ColorTable, | 396 * the memory for the pixels. If the ImageInfo requires a ColorTable, |
384 * the pixelref will ref() the colortable. | 397 * the pixelref will ref() the colortable. |
385 * On failure return NULL. | 398 * On failure return NULL. |
386 */ | 399 */ |
387 virtual SkPixelRef* create(const SkImageInfo&, size_t rowBytes, SkColorTable *) = 0; | 400 virtual SkPixelRef* create(const SkImageInfo&, size_t rowBytes, SkColorTable *) = 0; |
388 }; | 401 }; |
389 | 402 |
390 #endif | 403 #endif |
OLD | NEW |