#pragma once
#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(AlphaOption, GammaAndColorProfileOption);
static std::unique_ptr<ImageDecoder> create(const SharedBuffer&, AlphaOption alphaOption, GammaAndColorProfileOption gammaAndColorProfileOption)
{
return std::make_unique<ImageDecoder>(alphaOption, gammaAndColorProfileOption);
}
static size_t bytesDecodedToDetermineProperties();
bool isSizeAvailable() const;
size_t frameCount() const;
RepetitionCount repetitionCount() const;
String filenameExtension() const;
std::optional<IntPoint> hotSpot() const;
IntSize frameSizeAtIndex(size_t, SubsamplingLevel = SubsamplingLevel::Default) const;
bool frameIsCompleteAtIndex(size_t) const;
ImageOrientation frameOrientationAtIndex(size_t) const;
float frameDurationAtIndex(size_t) const;
bool frameHasAlphaAtIndex(size_t) const;
bool frameAllowSubsamplingAtIndex(size_t) const;
unsigned frameBytesAtIndex(size_t, SubsamplingLevel = SubsamplingLevel::Default) const;
NativeImagePtr createFrameImageAtIndex(size_t, SubsamplingLevel = SubsamplingLevel::Default, DecodingMode = DecodingMode::OnDemand) const;
void setData(SharedBuffer&, bool allDataReceived);
bool isAllDataReceived() const { return m_isAllDataReceived; }
void clearFrameBufferCache(size_t) { }
protected:
bool m_isAllDataReceived { false };
RetainPtr<CGImageSourceRef> m_nativeDecoder;
};
}