Chromium Code Reviews| 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 |
| 11 #include "SkBitmap.h" | 11 #include "SkBitmap.h" |
| 12 #include "SkDynamicAnnotations.h" | 12 #include "SkDynamicAnnotations.h" |
| 13 #include "SkRefCnt.h" | 13 #include "SkRefCnt.h" |
| 14 #include "SkString.h" | 14 #include "SkString.h" |
| 15 #include "SkFlattenable.h" | 15 #include "SkFlattenable.h" |
| 16 #include "SkImageInfo.h" | 16 #include "SkImageInfo.h" |
| 17 #include "SkSize.h" | |
| 17 #include "SkTDArray.h" | 18 #include "SkTDArray.h" |
| 18 | 19 |
| 19 //#define xed | 20 //#define xed |
| 20 | 21 |
| 21 #ifdef SK_DEBUG | 22 #ifdef SK_DEBUG |
| 22 /** | 23 /** |
| 23 * Defining SK_IGNORE_PIXELREF_SETPRELOCKED will force all pixelref | 24 * Defining SK_IGNORE_PIXELREF_SETPRELOCKED will force all pixelref |
| 24 * subclasses to correctly handle lock/unlock pixels. For performance | 25 * subclasses to correctly handle lock/unlock pixels. For performance |
| 25 * reasons, simple malloc-based subclasses call setPreLocked() to skip | 26 * reasons, simple malloc-based subclasses call setPreLocked() to skip |
| 26 * the overhead of implementing these calls. | 27 * the overhead of implementing these calls. |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 */ | 221 */ |
| 221 bool decodeInto(int pow2, SkBitmap* bitmap) { | 222 bool decodeInto(int pow2, SkBitmap* bitmap) { |
| 222 SkASSERT(pow2 >= 0); | 223 SkASSERT(pow2 >= 0); |
| 223 return this->onDecodeInto(pow2, bitmap); | 224 return this->onDecodeInto(pow2, bitmap); |
| 224 } | 225 } |
| 225 | 226 |
| 226 /** Are we really wrapping a texture instead of a bitmap? | 227 /** Are we really wrapping a texture instead of a bitmap? |
| 227 */ | 228 */ |
| 228 virtual GrTexture* getTexture() { return NULL; } | 229 virtual GrTexture* getTexture() { return NULL; } |
| 229 | 230 |
| 231 /** | |
| 232 * If planes[0] is NULL, this should output the sizes and return true | |
| 233 * if it can efficiently return YUV planar data. If it cannot, it should re turn false. | |
| 234 * | |
| 235 * If planes[0] is not NULL, then it should copy the associated Y,U,V data | |
| 236 * into those planes of memory supplied by the caller. It should validate t hat the sizes | |
| 237 * match what it expected. If the sizes do not match, it should return fals e. | |
| 238 */ | |
| 239 virtual bool getYUV8Planes(SkISize sizes[3], void* planes[3], int rowBytes[3 ]) { | |
|
reed1
2014/07/10 17:15:15
size_t for rowBytes
sugoi1
2014/07/10 17:54:24
Done.
| |
| 240 return false; | |
| 241 } | |
| 242 | |
| 230 bool readPixels(SkBitmap* dst, const SkIRect* subset = NULL); | 243 bool readPixels(SkBitmap* dst, const SkIRect* subset = NULL); |
| 231 | 244 |
| 232 /** | 245 /** |
| 233 * Makes a deep copy of this PixelRef, respecting the requested config. | 246 * Makes a deep copy of this PixelRef, respecting the requested config. |
| 234 * @param colorType Desired colortype. | 247 * @param colorType Desired colortype. |
| 235 * @param subset Subset of this PixelRef to copy. Must be fully contained w ithin the bounds of | 248 * @param subset Subset of this PixelRef to copy. Must be fully contained w ithin the bounds of |
| 236 * of this PixelRef. | 249 * of this PixelRef. |
| 237 * @return A new SkPixelRef, or NULL if either there is an error (e.g. the destination could | 250 * @return A new SkPixelRef, or NULL if either there is an error (e.g. the destination could |
| 238 * not be created with the given config), or this PixelRef does not support deep | 251 * not be created with the given config), or this PixelRef does not support deep |
| 239 * copies. | 252 * copies. |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 384 /** | 397 /** |
| 385 * Allocate a new pixelref matching the specified ImageInfo, allocating | 398 * Allocate a new pixelref matching the specified ImageInfo, allocating |
| 386 * the memory for the pixels. If the ImageInfo requires a ColorTable, | 399 * the memory for the pixels. If the ImageInfo requires a ColorTable, |
| 387 * the pixelref will ref() the colortable. | 400 * the pixelref will ref() the colortable. |
| 388 * On failure return NULL. | 401 * On failure return NULL. |
| 389 */ | 402 */ |
| 390 virtual SkPixelRef* create(const SkImageInfo&, size_t rowBytes, SkColorTable *) = 0; | 403 virtual SkPixelRef* create(const SkImageInfo&, size_t rowBytes, SkColorTable *) = 0; |
| 391 }; | 404 }; |
| 392 | 405 |
| 393 #endif | 406 #endif |
| OLD | NEW |