add optional preftable to image codecs, for more control over the resulting bitmap config
This commit is contained in:
@@ -32,8 +32,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual bool onDecode(SkStream* stream, SkBitmap* bm,
|
||||
SkBitmap::Config pref, Mode);
|
||||
virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode);
|
||||
};
|
||||
|
||||
int nullObjectReturn(const char msg[]) {
|
||||
|
||||
@@ -97,14 +97,14 @@ OmxJpegImageDecoder::~OmxJpegImageDecoder() {
|
||||
}
|
||||
|
||||
bool OmxJpegImageDecoder::onDecode(SkStream* stream,
|
||||
SkBitmap* bm, SkBitmap::Config pref, Mode mode) {
|
||||
SkBitmap* bm, Mode mode) {
|
||||
sp<MediaSource> source = prepareMediaSource(stream);
|
||||
sp<MetaData> meta = source->getFormat();
|
||||
int width;
|
||||
int height;
|
||||
meta->findInt32(kKeyWidth, &width);
|
||||
meta->findInt32(kKeyHeight, &height);
|
||||
configBitmapSize(bm, pref, width, height);
|
||||
configBitmapSize(bm, getPrefConfig(k32Bit_SrcDepth, false), width, height);
|
||||
|
||||
// mode == DecodeBounds
|
||||
if (mode == SkImageDecoder::kDecodeBounds_Mode) {
|
||||
|
||||
@@ -42,8 +42,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual bool onDecode(SkStream* stream, SkBitmap* bm,
|
||||
SkBitmap::Config pref, Mode mode);
|
||||
virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode mode);
|
||||
|
||||
private:
|
||||
JPEGSource* prepareMediaSource(SkStream* stream);
|
||||
|
||||
Reference in New Issue
Block a user