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

Commit 2ecdfc2a authored by Matt Sarett's avatar Matt Sarett
Browse files

Use SkColorSpace::isSRGB() in place of pointer comparison

Test: Refactor

Change-Id: I26301339fb964c6feca8c92f058524f8b83156ff
parent a3518ae9
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -417,11 +417,7 @@ static jobject doDecode(JNIEnv* env, SkStreamRewindable* stream, jobject padding
    // For wide gamut images, we will leave the color space on the SkBitmap.  Otherwise,
    // use the default.
    SkImageInfo bitmapInfo = decodeInfo;
    sk_sp<SkColorSpace> srgb =
            SkColorSpace::MakeRGB(SkColorSpace::kSRGB_RenderTargetGamma,
                                  SkColorSpace::kSRGB_Gamut,
                                  SkColorSpace::kNonLinearBlending_ColorSpaceFlag);
    if (decodeInfo.colorSpace() == srgb.get()) {
    if (decodeInfo.colorSpace() && decodeInfo.colorSpace()->isSRGB()) {
        bitmapInfo = bitmapInfo.makeColorSpace(GraphicsJNI::colorSpaceForType(decodeColorType));
    }

+1 −6
Original line number Diff line number Diff line
@@ -461,12 +461,7 @@ sk_sp<SkColorSpace> GraphicsJNI::colorSpaceForType(SkColorType type) {
}

bool GraphicsJNI::isColorSpaceSRGB(SkColorSpace* colorSpace) {
    return colorSpace == nullptr
            || colorSpace == SkColorSpace::MakeSRGB().get()
            || colorSpace == SkColorSpace::MakeRGB(
                  SkColorSpace::kSRGB_RenderTargetGamma,
                  SkColorSpace::kSRGB_Gamut,
                  SkColorSpace::kNonLinearBlending_ColorSpaceFlag).get();
    return colorSpace == nullptr || colorSpace->isSRGB();
}

///////////////////////////////////////////////////////////////////////////////