#ifndef ImageDecoderCG_h
#define ImageDecoderCG_h
#include "ImageSourceCG.h"
#include "IntSize.h"
#include <wtf/Optional.h>
typedef struct CGImageSource* CGImageSourceRef;
typedef const struct __CFData* CFDataRef;
namespace WebCore {
class ImageDecoder {
WTF_MAKE_FAST_ALLOCATED;
public:
ImageDecoder();
static std::unique_ptr<ImageDecoder> create(const SharedBuffer&, ImageSource::AlphaOption, ImageSource::GammaAndColorProfileOption)
{
return std::make_unique<ImageDecoder>();
}
static size_t bytesDecodedToDetermineProperties();
String filenameExtension() const;
bool isSizeAvailable() const;
IntSize size() const;
size_t frameCount() const;
int repetitionCount() const;
Optional<IntPoint> hotSpot() const;
IntSize frameSizeAtIndex(size_t, SubsamplingLevel) const;
bool frameIsCompleteAtIndex(size_t) const;
ImageOrientation orientationAtIndex(size_t) const;
float frameDurationAtIndex(size_t) const;
bool frameHasAlphaAtIndex(size_t) const;
bool allowSubsamplingOfFrameAtIndex(size_t) const;
unsigned frameBytesAtIndex(size_t, SubsamplingLevel = 0) const;
NativeImagePtr createFrameImageAtIndex(size_t, SubsamplingLevel) const;
void setData(CFDataRef, bool allDataReceived);
void setData(SharedBuffer&, bool allDataReceived);
void clearFrameBufferCache(size_t) { }
protected:
mutable IntSize m_size;
RetainPtr<CGImageSourceRef> m_nativeDecoder;
};
}
#endif // ImageDecoderCG_h