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

Commit a531a260 authored by Peiyong Lin's avatar Peiyong Lin
Browse files

Use SRGB instead of nullptr when create hardware bitmap.

BUG: 132153082
Test: Reproducible steps in the bug no longer reproducible.
Change-Id: I297e7d1f44cfc2157a39cea3d5ce968e5e45e095
parent be9cfb23
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -986,6 +986,11 @@ static jobject android_view_ThreadedRenderer_createHardwareBitmapFromRenderNode(

    SkColorType ct = uirenderer::PixelFormatToColorType(buffer->getPixelFormat());
    sk_sp<SkColorSpace> cs = uirenderer::DataSpaceToColorSpace(bufferItem.mDataSpace);
    if (cs == nullptr) {
        // nullptr is treated as SRGB in Skia, thus explicitly use SRGB in order to make sure
        // the returned bitmap has a color space.
        cs = SkColorSpace::MakeSRGB();
    }
    sk_sp<Bitmap> bitmap = Bitmap::createFrom(buffer, ct, cs);
    return bitmap::createBitmap(env, bitmap.release(),
            android::bitmap::kBitmapCreateFlag_Premultiplied);