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

Commit 9251c344 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 26851 into eclair

* changes:
  use new setDither on ImageRef to retain that setting for purgeable images
parents 1ee4aeaa 17154417
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.