Chromium Code Reviews| Index: src/lazy/SkLazyPixelRef.h |
| diff --git a/src/lazy/SkLazyPixelRef.h b/src/lazy/SkLazyPixelRef.h |
| index 8f7a751e953693efd0b81cc9e0bafd24dba6154c..b6e0454b1e93cd8ff08ccdf4cb7c3ba8fb2b008d 100644 |
| --- a/src/lazy/SkLazyPixelRef.h |
| +++ b/src/lazy/SkLazyPixelRef.h |
| @@ -33,8 +33,9 @@ public: |
| * Create a new SkLazyPixelRef. |
| * @param SkData Encoded data representing the pixels. |
| * @param DecodeProc Called to decode the pixels when needed. Must be non-NULL. |
| - * @param SkImageCache Object that handles allocating and freeing the pixel memory, as needed. |
| - * Must not be NULL. |
| + * @param SkImageCache Object that handles allocating and freeing |
| + * the pixel memory, as needed. If NULL, use the global |
| + * SkScaledImageCache. |
| */ |
| SkLazyPixelRef(SkData*, SkBitmapFactory::DecodeProc, SkImageCache*); |
| @@ -50,6 +51,13 @@ public: |
| static void ResetCacheStats() { gCacheHits = gCacheMisses = 0; } |
| #endif |
| + /** |
| + * The allocator is used when (fImageCache==NULL) to allocate |
| + * concrete PixelRefs as needed. If NULL, use the default allocator. |
| + * This is passed directly into SkBitmap::allocPixels(). |
| + */ |
| + virtual void setAllocator(SkBitmap::Allocator * allocator = NULL); |
|
mtklein
2013/10/24 17:03:25
*
|
| + |
| // No need to flatten this object. When flattening an SkBitmap, SkOrderedWriteBuffer will check |
| // the encoded data and write that instead. |
| // Future implementations of SkFlattenableWriteBuffer will need to special case for |
| @@ -69,9 +77,11 @@ private: |
| SkData* fData; |
| SkBitmapFactory::DecodeProc fDecodeProc; |
| SkImageCache* fImageCache; |
| + // fCacheId is a (SkScaledImageCache::ID*) or a (SkImageCache::ID). |
| intptr_t fCacheId; |
| size_t fRowBytes; |
| SkImage::Info fLazilyCachedInfo; |
| + SkBitmap::Allocator* fAllocator; |
| #if LAZY_CACHE_STATS |
| static int32_t gCacheHits; |
| @@ -80,6 +90,9 @@ private: |
| // lazily initialized our cached info. Returns NULL on failure. |
| const SkImage::Info* getCachedInfo(); |
| + void* lockScaledImageCachePixels(); |
| + void* lockImageCachePixels(); |
| + |
| typedef SkPixelRef INHERITED; |
| }; |