2015-10-22 14:29:19 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2015 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "SkBitmap.h"
|
2015-11-06 16:56:32 +00:00
|
|
|
#include "SkBitmapRegionDecoder.h"
|
2015-10-22 14:29:19 +00:00
|
|
|
#include "SkAndroidCodec.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This class implements SkBitmapRegionDecoder using an SkAndroidCodec.
|
|
|
|
*/
|
2015-11-06 16:56:32 +00:00
|
|
|
class SkBitmapRegionCodec : public SkBitmapRegionDecoder {
|
2015-10-22 14:29:19 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Takes ownership of pointer to codec
|
|
|
|
*/
|
|
|
|
SkBitmapRegionCodec(SkAndroidCodec* codec);
|
|
|
|
|
2015-10-27 19:50:25 +00:00
|
|
|
bool decodeRegion(SkBitmap* bitmap, SkBitmap::Allocator* allocator,
|
|
|
|
const SkIRect& desiredSubset, int sampleSize,
|
|
|
|
SkColorType colorType, bool requireUnpremul) override;
|
2015-10-22 14:29:19 +00:00
|
|
|
|
|
|
|
bool conversionSupported(SkColorType colorType) override;
|
|
|
|
|
2015-10-27 20:12:59 +00:00
|
|
|
SkEncodedFormat getEncodedFormat() override { return fCodec->getEncodedFormat(); }
|
|
|
|
|
2015-10-22 14:29:19 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
SkAutoTDelete<SkAndroidCodec> fCodec;
|
|
|
|
|
2015-11-06 16:56:32 +00:00
|
|
|
typedef SkBitmapRegionDecoder INHERITED;
|
2015-10-22 14:29:19 +00:00
|
|
|
|
|
|
|
};
|