#ifndef SkBitmapRegionDecoder_DEFINED
#define SkBitmapRegionDecoder_DEFINED
#include "SkBitmap.h"
#include "SkBRDAllocator.h"
#include "SkEncodedImageFormat.h"
#include "SkStream.h"
class SK_API SkBitmapRegionDecoder {
public:
enum Strategy {
kAndroidCodec_Strategy, };
static SkBitmapRegionDecoder* Create(sk_sp<SkData>, Strategy strategy);
static SkBitmapRegionDecoder* Create(
SkStreamRewindable* stream, Strategy strategy);
virtual bool decodeRegion(SkBitmap* bitmap, SkBRDAllocator* allocator,
const SkIRect& desiredSubset, int sampleSize,
SkColorType colorType, bool requireUnpremul,
sk_sp<SkColorSpace> prefColorSpace = nullptr) = 0;
virtual SkEncodedImageFormat getEncodedFormat() = 0;
virtual SkColorType computeOutputColorType(SkColorType requestedColorType) = 0;
virtual sk_sp<SkColorSpace> computeOutputColorSpace(SkColorType outputColorType,
sk_sp<SkColorSpace> prefColorSpace = nullptr) = 0;
int width() const { return fWidth; }
int height() const { return fHeight; }
virtual ~SkBitmapRegionDecoder() {}
protected:
SkBitmapRegionDecoder(int width, int height)
: fWidth(width)
, fHeight(height)
{}
private:
const int fWidth;
const int fHeight;
};
#endif