| Index: Source/platform/graphics/DecodingImageGenerator.h
|
| diff --git a/Source/platform/graphics/test/MockDiscardablePixelRef.h b/Source/platform/graphics/DecodingImageGenerator.h
|
| similarity index 59%
|
| copy from Source/platform/graphics/test/MockDiscardablePixelRef.h
|
| copy to Source/platform/graphics/DecodingImageGenerator.h
|
| index c1bd7fe21d71d15a94bd881cc323536daf43c256..f23fd4a6fda3f73ef129af20b425fa37e94a601e 100644
|
| --- a/Source/platform/graphics/test/MockDiscardablePixelRef.h
|
| +++ b/Source/platform/graphics/DecodingImageGenerator.h
|
| @@ -23,46 +23,41 @@
|
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -#ifndef MockDiscardablePixelRef_h
|
| +#ifndef DecodingImageGenerator_h
|
| +#define DecodingImageGenerator_h
|
|
|
| -#include "SkBitmap.h"
|
| -#include "SkPixelRef.h"
|
| +#include "SkImageGenerator.h"
|
| +#include "SkImageInfo.h"
|
|
|
| -namespace WebCore {
|
| +#include "wtf/RefPtr.h"
|
|
|
| -class MockDiscardablePixelRef : public SkPixelRef {
|
| -public:
|
| - MockDiscardablePixelRef() : discarded(false) { setURI("discardable"); }
|
| - ~MockDiscardablePixelRef() { }
|
| +class SkData;
|
|
|
| - void discard()
|
| - {
|
| - ASSERT(!m_lockedMemory);
|
| - discarded = true;
|
| - }
|
| +namespace WebCore {
|
|
|
| - SK_DECLARE_UNFLATTENABLE_OBJECT()
|
| +class ImageFrameGenerator;
|
|
|
| -protected:
|
| - // SkPixelRef implementation.
|
| - virtual void* onLockPixels(SkColorTable**)
|
| - {
|
| - if (discarded)
|
| - return 0;
|
| - m_lockedMemory = &discarded;
|
| - return m_lockedMemory;
|
| - }
|
| +// Implements SkImageGenerator and used by SkPixelRef to populate a discardable
|
| +// memory with decoded pixels.
|
| +//
|
| +// This class does not own an ImageDecode. It does not own encoded data. It serves
|
| +// as and adapter to ImageFrameGenerator which actually performs decoding.
|
| +class DecodingImageGenerator : public SkImageGenerator {
|
| +public:
|
| + DecodingImageGenerator(PassRefPtr<ImageFrameGenerator>, const SkImageInfo&, size_t index);
|
| + virtual ~DecodingImageGenerator();
|
|
|
| - virtual void onUnlockPixels()
|
| - {
|
| - m_lockedMemory = 0;
|
| - }
|
| + // SkImageGenerator implementation.
|
| + virtual SkData* refEncodedData();
|
| + virtual bool getInfo(SkImageInfo*);
|
| + virtual bool getPixels(const SkImageInfo&, void* pixels, size_t rowBytes);
|
|
|
| private:
|
| - void* m_lockedMemory;
|
| - bool discarded;
|
| + RefPtr<ImageFrameGenerator> m_frameGenerator;
|
| + SkImageInfo m_imageInfo;
|
| + size_t m_frameIndex;
|
| };
|
|
|
| } // namespace WebCore
|
|
|
| -#endif // MockDiscardablePixelRef_h
|
| +#endif // DecodingImageGenerator_h_
|
|
|