#include "config.h"
#include "ImageDecoder.h"
#if USE(CG)
#include "ImageDecoderCG.h"
#elif USE(DIRECT2D)
#include "ImageDecoderDirect2D.h"
#else
#include "ScalableImageDecoder.h"
#endif
#if HAVE(AVASSETREADER)
#include "ImageDecoderAVFObjC.h"
#endif
namespace WebCore {
RefPtr<ImageDecoder> ImageDecoder::create(SharedBuffer& data, const String& mimeType, AlphaOption alphaOption, GammaAndColorProfileOption gammaAndColorProfileOption)
{
#if HAVE(AVASSETREADER)
if (ImageDecoderAVFObjC::canDecodeType(mimeType))
return ImageDecoderAVFObjC::create(data, mimeType, alphaOption, gammaAndColorProfileOption);
#else
UNUSED_PARAM(mimeType);
#endif
#if USE(CG)
return ImageDecoderCG::create(data, alphaOption, gammaAndColorProfileOption);
#elif USE(DIRECT2D)
return ImageDecoderDirect2D::create(data, alphaOption, gammaAndColorProfileOption);
#else
return ScalableImageDecoder::create(data, alphaOption, gammaAndColorProfileOption);
#endif
}
bool ImageDecoder::supportsMediaType(MediaType type)
{
bool supports = false;
#if HAVE(AVASSETREADER)
if (ImageDecoderAVFObjC::supportsMediaType(type))
supports = true;
#endif
#if USE(CG)
if (ImageDecoderCG::supportsMediaType(type))
supports = true;
#elif USE(DIRECT2D)
if (ImageDecoderDirect2D::supportsMediaType(type))
supports = true;
#else
if (ScalableImageDecoder::supportsMediaType(type))
supports = true;
#endif
return supports;
}
}