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

Commit 0a751bba authored by Peiyong Lin's avatar Peiyong Lin Committed by Android (Google) Code Review
Browse files

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

parents 36e3f919 a531a260
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);