Chromium Code Reviews| Index: src/lazy/SkLazyPixelRef.h |
| diff --git a/src/lazy/SkLazyPixelRef.h b/src/lazy/SkLazyPixelRef.h |
| index 8f7a751e953693efd0b81cc9e0bafd24dba6154c..284ea3c0dd3ebb468ff98b0c18dccd561d16a7f0 100644 |
| --- a/src/lazy/SkLazyPixelRef.h |
| +++ b/src/lazy/SkLazyPixelRef.h |
| @@ -10,8 +10,10 @@ |
| #include "SkBitmapFactory.h" |
| #include "SkImage.h" |
| +#include "SkImageCache.h" |
| #include "SkPixelRef.h" |
| #include "SkFlattenable.h" |
| +#include "SkScaledImageCache.h" |
| class SkColorTable; |
| class SkData; |
| @@ -33,8 +35,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 +53,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); |
|
reed1
2013/10/25 18:09:47
Why are we introducing this now, and why is it vir
hal.canary
2013/10/25 20:49:38
Okay, I'll remove it.
|
| + |
| // 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 +79,13 @@ private: |
| SkData* fData; |
| SkBitmapFactory::DecodeProc fDecodeProc; |
| SkImageCache* fImageCache; |
| - intptr_t fCacheId; |
| + union { |
| + SkImageCache::ID fCacheId; |
| + SkScaledImageCache::ID* fScaledCacheId; |
| + }; |
| size_t fRowBytes; |
| SkImage::Info fLazilyCachedInfo; |
| + SkBitmap::Allocator* fAllocator; |
| #if LAZY_CACHE_STATS |
| static int32_t gCacheHits; |
| @@ -80,6 +94,9 @@ private: |
| // lazily initialized our cached info. Returns NULL on failure. |
| const SkImage::Info* getCachedInfo(); |
| + void* lockScaledImageCachePixels(); |
| + void* lockImageCachePixels(); |
| + |
| typedef SkPixelRef INHERITED; |
| }; |