Chromium Code Reviews| Index: src/lazy/SkLazyPixelRef.h |
| diff --git a/src/lazy/SkLazyPixelRef.h b/src/lazy/SkLazyPixelRef.h |
| index 8f7a751e953693efd0b81cc9e0bafd24dba6154c..c7281d035aa19c4ce8783397931335b201fd73fa 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*); |
| @@ -64,14 +65,25 @@ protected: |
| virtual bool onImplementsDecodeInto() SK_OVERRIDE; |
| virtual bool onDecodeInto(int pow2, SkBitmap*) SK_OVERRIDE; |
| + /** |
| + * 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) { |
| + fAllocator = allocator; |
|
scroggo
2013/10/23 15:27:49
SkBitmap::Allocator inherits from SkRefCnt. Typica
hal.canary
2013/10/23 16:11:52
I'll make that change, unless there is any reason
|
| + } |
| + |
| private: |
| bool fErrorInDecoding; |
| 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; |