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 the 2nd argument is NULL, this should output the sizes and return tru e | |
233 * if it can efficiently return YUV planar data. If it cannot, it should re turn false. | |
234 * | |
235 * If the 2nd argument 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 */ | |
robertphillips
2014/07/10 12:47:20
SkISize sizes[3], void* planes[3], int rowBytes[3]
sugoi1
2014/07/10 16:10:52
Done.
| |
239 virtual bool getYUV8Planes(SkISize*, void*) { return false; } | |
240 | |
230 bool readPixels(SkBitmap* dst, const SkIRect* subset = NULL); | 241 bool readPixels(SkBitmap* dst, const SkIRect* subset = NULL); |
231 | 242 |
232 /** | 243 /** |
233 * Makes a deep copy of this PixelRef, respecting the requested config. | 244 * Makes a deep copy of this PixelRef, respecting the requested config. |
234 * @param colorType Desired colortype. | 245 * @param colorType Desired colortype. |
235 * @param subset Subset of this PixelRef to copy. Must be fully contained w ithin the bounds of | 246 * @param subset Subset of this PixelRef to copy. Must be fully contained w ithin the bounds of |
236 * of this PixelRef. | 247 * of this PixelRef. |
237 * @return A new SkPixelRef, or NULL if either there is an error (e.g. the destination could | 248 * @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 | 249 * not be created with the given config), or this PixelRef does not support deep |
239 * copies. | 250 * copies. |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
384 /** | 395 /** |
385 * Allocate a new pixelref matching the specified ImageInfo, allocating | 396 * Allocate a new pixelref matching the specified ImageInfo, allocating |
386 * the memory for the pixels. If the ImageInfo requires a ColorTable, | 397 * the memory for the pixels. If the ImageInfo requires a ColorTable, |
387 * the pixelref will ref() the colortable. | 398 * the pixelref will ref() the colortable. |
388 * On failure return NULL. | 399 * On failure return NULL. |
389 */ | 400 */ |
390 virtual SkPixelRef* create(const SkImageInfo&, size_t rowBytes, SkColorTable *) = 0; | 401 virtual SkPixelRef* create(const SkImageInfo&, size_t rowBytes, SkColorTable *) = 0; |
391 }; | 402 }; |
392 | 403 |
393 #endif | 404 #endif |
OLD | NEW |