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

Commit cb10e0ad 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

Change-Id: I20767e1efcb82dce8c8f1aa478f97a861fd35fbc
parents 79e5e418 0a751bba
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);