#ifndef ImageSource_h
#define ImageSource_h
#include <wtf/Noncopyable.h>
#include <wtf/Vector.h>
#if PLATFORM(WX)
class wxBitmap;
#elif PLATFORM(CG)
typedef struct CGImageSource* CGImageSourceRef;
typedef struct CGImage* CGImageRef;
typedef const struct __CFData* CFDataRef;
#elif PLATFORM(QT)
class QPixmap;
#elif PLATFORM(CAIRO)
struct _cairo_surface;
typedef struct _cairo_surface cairo_surface_t;
#endif
namespace WebCore {
class IntSize;
class SharedBuffer;
#if PLATFORM(WX)
class ImageDecoder;
typedef ImageDecoder* NativeImageSourcePtr;
typedef const Vector<char>* NativeBytePtr;
typedef wxBitmap* NativeImagePtr;
#elif PLATFORM(CG)
typedef CGImageSourceRef NativeImageSourcePtr;
typedef CGImageRef NativeImagePtr;
#elif PLATFORM(QT)
class ImageDecoderQt;
typedef ImageDecoderQt* NativeImageSourcePtr;
typedef QPixmap* NativeImagePtr;
#else
class ImageDecoder;
typedef ImageDecoder* NativeImageSourcePtr;
typedef cairo_surface_t* NativeImagePtr;
#endif
const int cAnimationLoopOnce = -1;
const int cAnimationNone = -2;
class ImageSource : Noncopyable {
public:
ImageSource();
~ImageSource();
void clear();
bool initialized() const;
void setData(SharedBuffer* data, bool allDataReceived);
bool isSizeAvailable();
IntSize size() const;
int repetitionCount();
size_t frameCount() const;
NativeImagePtr createFrameAtIndex(size_t, float scaleHint, float* actualScaleOut, ssize_t* bytesOut);
float frameDurationAtIndex(size_t);
bool frameHasAlphaAtIndex(size_t); bool frameIsCompleteAtIndex(size_t);
private:
NativeImageSourcePtr m_decoder;
mutable int m_baseSubsampling;
mutable bool m_isProgressive;
CFDictionaryRef imageSourceOptions(int subsampling = 0) const;
};
}
#endif