Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 945a9df6 authored by Mike Reed's avatar Mike Reed
Browse files

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

parent f3685afc
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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[]) {
+2 −2
Original line number Diff line number Diff line
@@ -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) {
+1 −2
Original line number Diff line number Diff line
@@ -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);