Chromium Code Reviews| Index: include/lazy/SkDiscardablePixelRef.h |
| diff --git a/src/lazy/SkDiscardablePixelRef.h b/include/lazy/SkDiscardablePixelRef.h |
| similarity index 81% |
| rename from src/lazy/SkDiscardablePixelRef.h |
| rename to include/lazy/SkDiscardablePixelRef.h |
| index bbe19b8b20727dc5672bf6dcadcdd9c278a8fc35..6208788e0419a5104d5173e0f76d71d283f7555c 100644 |
| --- a/src/lazy/SkDiscardablePixelRef.h |
| +++ b/include/lazy/SkDiscardablePixelRef.h |
| @@ -8,16 +8,18 @@ |
| #ifndef SkDiscardablePixelRef_DEFINED |
| #define SkDiscardablePixelRef_DEFINED |
| +#include "SkDiscardableMemory.h" |
| #include "SkPixelRef.h" |
| #include "SkImageGenerator.h" |
| #include "SkImageInfo.h" |
| -class SkDiscardableMemory; |
| - |
| /** |
| * An interface that allows a purgable PixelRef to re-decode an image. |
| */ |
| +typedef SkDiscardableMemory* (*SkDiscardableMemoryFactory)(size_t bytes); |
| + |
| + |
| class SkDiscardablePixelRef : public SkPixelRef { |
| public: |
| /** |
| @@ -31,7 +33,9 @@ public: |
| * SkDELETE() on the generator. Therefore, generator should be |
| * allocated with SkNEW() or SkNEW_ARGS(). |
| */ |
| - static bool Install(SkImageGenerator* generator, SkBitmap* destination); |
| + static bool Install(SkImageGenerator* generator, |
| + SkBitmap* destination, |
| + SkDiscardableMemory::Factory* factory = NULL); |
|
scroggo
2013/12/03 23:00:01
Can you add a comment about how the factory is use
hal.canary
2013/12/04 00:01:36
Done.
|
| SK_DECLARE_UNFLATTENABLE_OBJECT() |
| @@ -47,6 +51,7 @@ protected: |
| private: |
| SkImageGenerator* const fGenerator; |
| + SkDiscardableMemory::Factory* const fDMFactory; |
| const SkImageInfo fInfo; |
| const size_t fSize; // size of memory to be allocated |
| const size_t fRowBytes; |
| @@ -59,6 +64,7 @@ private: |
| SkDiscardablePixelRef(SkImageGenerator* generator, |
| const SkImageInfo& info, |
| size_t size, |
| - size_t rowBytes); |
| + size_t rowBytes, |
| + SkDiscardableMemory::Factory* factory); |
| }; |
| #endif // SkDiscardablePixelRef_DEFINED |