Use SkColorSpace::isSRGB() in place of pointer comparison
Test: Refactor Change-Id: I26301339fb964c6feca8c92f058524f8b83156ff
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user