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

Commit 9aebfd3d authored by Peiyong Lin's avatar Peiyong Lin Committed by android-build-merger
Browse files

Merge "Use SRGB instead of nullptr when create hardware bitmap." into qt-dev am: 0a751bba

am: cb10e0ad

Change-Id: I19171ce33a4ab1196cd2aeed4198d05dc24cb764
parents 84714827 cb10e0ad
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);