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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 */ | 220 */ |
221 virtual GrTexture* getTexture() { return NULL; } | 221 virtual GrTexture* getTexture() { return NULL; } |
222 | 222 |
223 /** | 223 /** |
224 * If any planes or rowBytes is NULL, this should output the sizes and retu
rn true | 224 * 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. | 225 * if it can efficiently return YUV planar data. If it cannot, it should re
turn false. |
226 * | 226 * |
227 * If all planes and rowBytes are not NULL, then it should copy the associa
ted Y,U,V data | 227 * 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 | 228 * 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. | 229 * match what it expected. If the sizes do not match, it should return fals
e. |
| 230 * |
| 231 * If colorSpace is not NULL, the YUV color space of the data should be sto
red in the address |
| 232 * it points at. |
230 */ | 233 */ |
231 bool getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3]) { | 234 bool getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3], |
232 return this->onGetYUV8Planes(sizes, planes, rowBytes); | 235 SkYUVColorSpace* colorSpace) { |
| 236 return this->onGetYUV8Planes(sizes, planes, rowBytes, colorSpace); |
233 } | 237 } |
234 | 238 |
235 bool readPixels(SkBitmap* dst, const SkIRect* subset = NULL); | 239 bool readPixels(SkBitmap* dst, const SkIRect* subset = NULL); |
236 | 240 |
237 /** | 241 /** |
238 * Makes a deep copy of this PixelRef, respecting the requested config. | 242 * Makes a deep copy of this PixelRef, respecting the requested config. |
239 * @param colorType Desired colortype. | 243 * @param colorType Desired colortype. |
240 * @param subset Subset of this PixelRef to copy. Must be fully contained w
ithin the bounds of | 244 * @param subset Subset of this PixelRef to copy. Must be fully contained w
ithin the bounds of |
241 * of this PixelRef. | 245 * of this PixelRef. |
242 * @return A new SkPixelRef, or NULL if either there is an error (e.g. the
destination could | 246 * @return A new SkPixelRef, or NULL if either there is an error (e.g. the
destination could |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 * able to make a copy of them (e.g. if the pixels are on the GPU). | 316 * able to make a copy of them (e.g. if the pixels are on the GPU). |
313 * | 317 * |
314 * The base class implementation returns false; | 318 * The base class implementation returns false; |
315 */ | 319 */ |
316 virtual bool onReadPixels(SkBitmap* dst, const SkIRect* subsetOrNull); | 320 virtual bool onReadPixels(SkBitmap* dst, const SkIRect* subsetOrNull); |
317 | 321 |
318 // default impl returns NULL. | 322 // default impl returns NULL. |
319 virtual SkData* onRefEncodedData(); | 323 virtual SkData* onRefEncodedData(); |
320 | 324 |
321 // default impl returns false. | 325 // default impl returns false. |
322 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3]); | 326 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3], |
| 327 SkYUVColorSpace* colorSpace); |
323 | 328 |
324 /** | 329 /** |
325 * Returns the size (in bytes) of the internally allocated memory. | 330 * Returns the size (in bytes) of the internally allocated memory. |
326 * This should be implemented in all serializable SkPixelRef derived classe
s. | 331 * This should be implemented in all serializable SkPixelRef derived classe
s. |
327 * SkBitmap::fPixelRefOffset + SkBitmap::getSafeSize() should never overflo
w this value, | 332 * SkBitmap::fPixelRefOffset + SkBitmap::getSafeSize() should never overflo
w this value, |
328 * otherwise the rendering code may attempt to read memory out of bounds. | 333 * otherwise the rendering code may attempt to read memory out of bounds. |
329 * | 334 * |
330 * @return default impl returns 0. | 335 * @return default impl returns 0. |
331 */ | 336 */ |
332 virtual size_t getAllocatedSizeInBytes() const; | 337 virtual size_t getAllocatedSizeInBytes() const; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 /** | 386 /** |
382 * Allocate a new pixelref matching the specified ImageInfo, allocating | 387 * Allocate a new pixelref matching the specified ImageInfo, allocating |
383 * the memory for the pixels. If the ImageInfo requires a ColorTable, | 388 * the memory for the pixels. If the ImageInfo requires a ColorTable, |
384 * the pixelref will ref() the colortable. | 389 * the pixelref will ref() the colortable. |
385 * On failure return NULL. | 390 * On failure return NULL. |
386 */ | 391 */ |
387 virtual SkPixelRef* create(const SkImageInfo&, size_t rowBytes, SkColorTable
*) = 0; | 392 virtual SkPixelRef* create(const SkImageInfo&, size_t rowBytes, SkColorTable
*) = 0; |
388 }; | 393 }; |
389 | 394 |
390 #endif | 395 #endif |
OLD | NEW |