add optional preftable to image codecs, for more control over the resulting bitmap config

This commit is contained in:
Mike Reed
2010-03-03 13:24:37 -05:00
parent f3685afc5d
commit 945a9df6e3
3 changed files with 4 additions and 6 deletions

View File

@@ -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[]) {

View File

@@ -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) {

View File

@@ -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);