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

Commit d3e68457 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

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

parents 0acbdda1 2ecdfc2a
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();
}

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