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

Commit 17154417 authored by Mike Reed's avatar Mike Reed
Browse files

use new setDither on ImageRef to retain that setting for purgeable images

parent 7475be4b
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -314,14 +314,15 @@ static jobject nullObjectReturn(const char msg[]) {
}

static SkPixelRef* installPixelRef(SkBitmap* bitmap, SkStream* stream,
                                   int sampleSize) {
    SkPixelRef* pr;
                                   int sampleSize, bool ditherImage) {
    SkImageRef* pr;
    // only use ashmem for large images, since mmaps come at a price
    if (bitmap->getSize() >= 32 * 1024) {
        pr = new SkImageRef_ashmem(stream, bitmap->config(), sampleSize);
    } else {
        pr = new SkImageRef_GlobalPool(stream, bitmap->config(), sampleSize);
    }
    pr->setDitherImage(ditherImage);
    bitmap->setPixelRef(pr)->unref();
    return pr;
}
@@ -440,7 +441,7 @@ static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding,

    SkPixelRef* pr;
    if (isPurgeable) {
        pr = installPixelRef(bitmap, stream, sampleSize);
        pr = installPixelRef(bitmap, stream, sampleSize, doDither);
    } else {
        // if we get here, we're in kDecodePixels_Mode and will therefore
        // already have a pixelref installed.