aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/codec/SkAndroidCodec.cpp4
-rw-r--r--src/codec/SkBmpCodec.cpp2
-rw-r--r--src/codec/SkGifCodec.cpp2
-rw-r--r--src/codec/SkJpegCodec.cpp2
-rw-r--r--src/codec/SkPngCodec.cpp6
-rw-r--r--src/codec/SkRawCodec.cpp2
-rw-r--r--src/codec/SkWbmpCodec.cpp2
-rw-r--r--src/codec/SkWebpCodec.cpp2
-rw-r--r--src/core/SkColorShader.cpp2
-rw-r--r--src/core/SkColorSpace.cpp48
-rw-r--r--src/core/SkColorSpacePriv.h29
-rw-r--r--src/core/SkColorSpace_A2B.h4
-rw-r--r--src/core/SkColorSpace_Base.h8
-rw-r--r--src/core/SkImageCacherator.cpp2
-rw-r--r--src/core/SkImageInfo.cpp2
-rw-r--r--src/core/SkPM4fPriv.h2
-rw-r--r--src/core/SkShader.cpp2
-rw-r--r--src/effects/gradients/SkGradientShader.cpp6
-rw-r--r--src/gpu/GrRenderTargetContext.cpp2
-rw-r--r--src/gpu/GrTestUtils.cpp10
-rw-r--r--src/gpu/SkGr.cpp2
-rw-r--r--src/views/SkWindow.cpp2
22 files changed, 103 insertions, 40 deletions
diff --git a/src/codec/SkAndroidCodec.cpp b/src/codec/SkAndroidCodec.cpp
index 26b9638c96..5fc7bfc585 100644
--- a/src/codec/SkAndroidCodec.cpp
+++ b/src/codec/SkAndroidCodec.cpp
@@ -131,9 +131,9 @@ sk_sp<SkColorSpace> SkAndroidCodec::computeOutputColorSpace(SkColorType outputCo
case kRGBA_8888_SkColorType:
case kBGRA_8888_SkColorType:
case kIndex_8_SkColorType:
- return SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
+ return SkColorSpace::MakeSRGB();
case kRGBA_F16_SkColorType:
- return SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named);
+ return SkColorSpace::MakeSRGBLinear();
default:
// Color correction not supported for k565 and kGray.
return nullptr;
diff --git a/src/codec/SkBmpCodec.cpp b/src/codec/SkBmpCodec.cpp
index 66ad0caa2b..cd46a5495c 100644
--- a/src/codec/SkBmpCodec.cpp
+++ b/src/codec/SkBmpCodec.cpp
@@ -593,7 +593,7 @@ SkCodec* SkBmpCodec::NewFromStream(SkStream* stream, bool inIco) {
SkBmpCodec::SkBmpCodec(int width, int height, const SkEncodedInfo& info, SkStream* stream,
uint16_t bitsPerPixel, SkCodec::SkScanlineOrder rowOrder)
- : INHERITED(width, height, info, stream, SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named))
+ : INHERITED(width, height, info, stream, SkColorSpace::MakeSRGB())
, fBitsPerPixel(bitsPerPixel)
, fRowOrder(rowOrder)
, fSrcRowBytes(SkAlign4(compute_row_bytes(width, fBitsPerPixel)))
diff --git a/src/codec/SkGifCodec.cpp b/src/codec/SkGifCodec.cpp
index af0e8bc242..2903717b48 100644
--- a/src/codec/SkGifCodec.cpp
+++ b/src/codec/SkGifCodec.cpp
@@ -106,7 +106,7 @@ SkCodec* SkGifCodec::NewFromStream(SkStream* stream) {
const auto imageInfo = SkImageInfo::Make(reader->screenWidth(), reader->screenHeight(),
colorType, alphaType,
- SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named));
+ SkColorSpace::MakeSRGB());
return new SkGifCodec(encodedInfo, imageInfo, reader.release());
}
diff --git a/src/codec/SkJpegCodec.cpp b/src/codec/SkJpegCodec.cpp
index 03a901bed0..995aaa6b96 100644
--- a/src/codec/SkJpegCodec.cpp
+++ b/src/codec/SkJpegCodec.cpp
@@ -252,7 +252,7 @@ bool SkJpegCodec::ReadHeader(SkStream* stream, SkCodec** codecOut,
}
if (!colorSpace) {
// Treat unmarked jpegs as sRGB.
- colorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
+ colorSpace = SkColorSpace::MakeSRGB();
}
const int width = decoderMgr->dinfo()->image_width;
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index 468b0b8731..b6258ab8b0 100644
--- a/src/codec/SkPngCodec.cpp
+++ b/src/codec/SkPngCodec.cpp
@@ -352,7 +352,7 @@ sk_sp<SkColorSpace> read_color_space(png_structp png_ptr, png_infop info_ptr,
// FIXME (msarett): Extract this information from the sRGB chunk once
// we are able to handle this information in
// SkColorSpace.
- return SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
+ return SkColorSpace::MakeSRGB();
}
// Next, check for chromaticities.
@@ -408,7 +408,7 @@ sk_sp<SkColorSpace> read_color_space(png_structp png_ptr, png_infop info_ptr,
// Report that there is no color space information in the PNG.
// Guess sRGB in this case.
- return SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
+ return SkColorSpace::MakeSRGB();
}
void SkPngCodec::allocateStorage(const SkImageInfo& dstInfo) {
@@ -1012,7 +1012,7 @@ void AutoCleanPng::infoCallback() {
const bool unsupportedICC = !colorSpace;
if (!colorSpace) {
// Treat unsupported/invalid color spaces as sRGB.
- colorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
+ colorSpace = SkColorSpace::MakeSRGB();
}
SkEncodedInfo encodedInfo = SkEncodedInfo::Make(color, alpha, bitDepth);
diff --git a/src/codec/SkRawCodec.cpp b/src/codec/SkRawCodec.cpp
index 843ccf0fe5..1684a16884 100644
--- a/src/codec/SkRawCodec.cpp
+++ b/src/codec/SkRawCodec.cpp
@@ -794,5 +794,5 @@ SkRawCodec::~SkRawCodec() {}
SkRawCodec::SkRawCodec(SkDngImage* dngImage)
: INHERITED(dngImage->width(), dngImage->height(), dngImage->getEncodedInfo(), nullptr,
- SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named))
+ SkColorSpace::MakeSRGB())
, fDngImage(dngImage) {}
diff --git a/src/codec/SkWbmpCodec.cpp b/src/codec/SkWbmpCodec.cpp
index 6356e30536..d59789b66e 100644
--- a/src/codec/SkWbmpCodec.cpp
+++ b/src/codec/SkWbmpCodec.cpp
@@ -107,7 +107,7 @@ bool SkWbmpCodec::readRow(uint8_t* row) {
}
SkWbmpCodec::SkWbmpCodec(int width, int height, const SkEncodedInfo& info, SkStream* stream)
- : INHERITED(width, height, info, stream, SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named))
+ : INHERITED(width, height, info, stream, SkColorSpace::MakeSRGB())
, fSrcRowBytes(get_src_row_bytes(this->getInfo().width()))
, fSwizzler(nullptr)
, fColorTable(nullptr)
diff --git a/src/codec/SkWebpCodec.cpp b/src/codec/SkWebpCodec.cpp
index dbc141ebd6..bd69f658e6 100644
--- a/src/codec/SkWebpCodec.cpp
+++ b/src/codec/SkWebpCodec.cpp
@@ -70,7 +70,7 @@ SkCodec* SkWebpCodec::NewFromStream(SkStream* stream) {
}
}
if (!colorSpace) {
- colorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
+ colorSpace = SkColorSpace::MakeSRGB();
}
// Since we do not yet support animation, we get the |width|, |height|, |color|, and |alpha|
diff --git a/src/core/SkColorShader.cpp b/src/core/SkColorShader.cpp
index ed2a26b931..11a26cdace 100644
--- a/src/core/SkColorShader.cpp
+++ b/src/core/SkColorShader.cpp
@@ -319,7 +319,7 @@ bool SkColorShader::onAppendStages(SkRasterPipeline* p,
auto color = scratch->make<SkPM4f>(SkPM4f_from_SkColor(fColor, dst));
p->append(SkRasterPipeline::constant_color, color);
return append_gamut_transform(p, scratch,
- SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named).get(), dst);
+ SkColorSpace::MakeSRGB().get(), dst);
}
bool SkColor4Shader::onAppendStages(SkRasterPipeline* p,
diff --git a/src/core/SkColorSpace.cpp b/src/core/SkColorSpace.cpp
index 3c1ce257f1..645410c496 100644
--- a/src/core/SkColorSpace.cpp
+++ b/src/core/SkColorSpace.cpp
@@ -117,17 +117,17 @@ sk_sp<SkColorSpace> SkColorSpace_Base::MakeRGB(SkGammaNamed gammaNamed, const Sk
switch (gammaNamed) {
case kSRGB_SkGammaNamed:
if (xyz_almost_equal(toXYZD50, gSRGB_toXYZD50)) {
- return SkColorSpace::MakeNamed(kSRGB_Named);
+ return SkColorSpace_Base::MakeNamed(kSRGB_Named);
}
break;
case k2Dot2Curve_SkGammaNamed:
if (xyz_almost_equal(toXYZD50, gAdobeRGB_toXYZD50)) {
- return SkColorSpace::MakeNamed(kAdobeRGB_Named);
+ return SkColorSpace_Base::MakeNamed(kAdobeRGB_Named);
}
break;
case kLinear_SkGammaNamed:
if (xyz_almost_equal(toXYZD50, gSRGB_toXYZD50)) {
- return SkColorSpace::MakeNamed(kSRGBLinear_Named);
+ return SkColorSpace_Base::MakeNamed(kSRGBLinear_Named);
}
break;
case kNonStandard_SkGammaNamed:
@@ -183,11 +183,29 @@ sk_sp<SkColorSpace> SkColorSpace::MakeRGB(const SkColorSpaceTransferFn& coeffs,
std::move(gammas), toXYZD50, nullptr));
}
+sk_sp<SkColorSpace> SkColorSpace::MakeRGB(RenderTargetGamma gamma, Gamut gamut) {
+ SkMatrix44 toXYZD50(SkMatrix44::kUninitialized_Constructor);
+ to_xyz_d50(&toXYZD50, gamut);
+ return SkColorSpace::MakeRGB(gamma, toXYZD50);
+}
+
+sk_sp<SkColorSpace> SkColorSpace::MakeRGB(const SkColorSpaceTransferFn& coeffs, Gamut gamut) {
+ SkMatrix44 toXYZD50(SkMatrix44::kUninitialized_Constructor);
+ to_xyz_d50(&toXYZD50, gamut);
+ return SkColorSpace::MakeRGB(coeffs, toXYZD50);
+}
+
static SkColorSpace* gAdobeRGB;
static SkColorSpace* gSRGB;
static SkColorSpace* gSRGBLinear;
+#ifdef SK_USE_LEGACY_NAMED_COLOR_SPACE
sk_sp<SkColorSpace> SkColorSpace::MakeNamed(Named named) {
+ return SkColorSpace_Base::MakeNamed((SkColorSpace_Base::Named) named);
+}
+#endif
+
+sk_sp<SkColorSpace> SkColorSpace_Base::MakeNamed(Named named) {
static SkOnce sRGBOnce;
static SkOnce adobeRGBOnce;
static SkOnce sRGBLinearOnce;
@@ -232,6 +250,14 @@ sk_sp<SkColorSpace> SkColorSpace::MakeNamed(Named named) {
return nullptr;
}
+sk_sp<SkColorSpace> SkColorSpace::MakeSRGB() {
+ return SkColorSpace_Base::MakeNamed(SkColorSpace_Base::kSRGB_Named);
+}
+
+sk_sp<SkColorSpace> SkColorSpace::MakeSRGBLinear() {
+ return SkColorSpace_Base::MakeNamed(SkColorSpace_Base::kSRGBLinear_Named);
+}
+
///////////////////////////////////////////////////////////////////////////////////////////////////
bool SkColorSpace::gammaCloseToSRGB() const {
@@ -290,7 +316,7 @@ struct ColorSpaceHeader {
SkASSERT(k0_Version == version);
header.fVersion = (uint8_t) version;
- SkASSERT(named <= SkColorSpace::kSRGBLinear_Named);
+ SkASSERT(named <= SkColorSpace_Base::kSRGBLinear_Named);
header.fNamed = (uint8_t) named;
SkASSERT(gammaNamed <= kNonStandard_SkGammaNamed);
@@ -318,20 +344,20 @@ size_t SkColorSpace::writeToMemory(void* memory) const {
const SkGammaNamed gammaNamed = thisXYZ->gammaNamed();
if (this == gSRGB) {
if (memory) {
- *((ColorSpaceHeader*) memory) =
- ColorSpaceHeader::Pack(k0_Version, kSRGB_Named, gammaNamed, 0);
+ *((ColorSpaceHeader*) memory) = ColorSpaceHeader::Pack(
+ k0_Version, SkColorSpace_Base::kSRGB_Named, gammaNamed, 0);
}
return sizeof(ColorSpaceHeader);
} else if (this == gAdobeRGB) {
if (memory) {
- *((ColorSpaceHeader*) memory) =
- ColorSpaceHeader::Pack(k0_Version, kAdobeRGB_Named, gammaNamed, 0);
+ *((ColorSpaceHeader*) memory) = ColorSpaceHeader::Pack(
+ k0_Version, SkColorSpace_Base::kAdobeRGB_Named, gammaNamed, 0);
}
return sizeof(ColorSpaceHeader);
} else if (this == gSRGBLinear) {
if (memory) {
- *((ColorSpaceHeader*) memory) =
- ColorSpaceHeader::Pack(k0_Version, kSRGBLinear_Named, gammaNamed, 0);
+ *((ColorSpaceHeader*) memory) = ColorSpaceHeader::Pack(
+ k0_Version, SkColorSpace_Base::kSRGBLinear_Named, gammaNamed, 0);
}
return sizeof(ColorSpaceHeader);
}
@@ -423,7 +449,7 @@ sk_sp<SkColorSpace> SkColorSpace::Deserialize(const void* data, size_t length) {
data = SkTAddOffset<const void>(data, sizeof(ColorSpaceHeader));
length -= sizeof(ColorSpaceHeader);
if (0 == header.fFlags) {
- return MakeNamed((Named) header.fNamed);
+ return SkColorSpace_Base::MakeNamed((SkColorSpace_Base::Named) header.fNamed);
}
switch ((SkGammaNamed) header.fGammaNamed) {
diff --git a/src/core/SkColorSpacePriv.h b/src/core/SkColorSpacePriv.h
index 5b09036ea8..26ccd5e6ca 100644
--- a/src/core/SkColorSpacePriv.h
+++ b/src/core/SkColorSpacePriv.h
@@ -23,6 +23,35 @@ static constexpr float gAdobeRGB_toXYZD50[] {
0.0194811f, 0.0608902f, 0.7448387f, // Rz, Gz, Bz
};
+static constexpr float gDCIP3_toXYZD50[] {
+ 0.515102f, 0.291965f, 0.157153f, // Rx, Gx, Bx
+ 0.241182f, 0.692236f, 0.0665819f, // Ry, Gy, Gz
+ -0.00104941f, 0.0418818f, 0.784378f, // Rz, Gz, Bz
+};
+
+static constexpr float gRec2020_toXYZD50[] {
+ 0.673459f, 0.165661f, 0.125100f, // Rx, Gx, Bx
+ 0.279033f, 0.675338f, 0.0456288f, // Ry, Gy, Gz
+ -0.00193139f, 0.0299794f, 0.797162f, // Rz, Gz, Bz
+};
+
+static inline void to_xyz_d50(SkMatrix44* toXYZD50, SkColorSpace::Gamut gamut) {
+ switch (gamut) {
+ case SkColorSpace::kSRGB_Gamut:
+ toXYZD50->set3x3RowMajorf(gSRGB_toXYZD50);
+ break;
+ case SkColorSpace::kAdobeRGB_Gamut:
+ toXYZD50->set3x3RowMajorf(gAdobeRGB_toXYZD50);
+ break;
+ case SkColorSpace::kDCIP3_D65_Gamut:
+ toXYZD50->set3x3RowMajorf(gDCIP3_toXYZD50);
+ break;
+ case SkColorSpace::kRec2020_Gamut:
+ toXYZD50->set3x3RowMajorf(gRec2020_toXYZD50);
+ break;
+ }
+}
+
static inline bool color_space_almost_equal(float a, float b) {
return SkTAbs(a - b) < 0.01f;
}
diff --git a/src/core/SkColorSpace_A2B.h b/src/core/SkColorSpace_A2B.h
index 33219450dc..99248b80fd 100644
--- a/src/core/SkColorSpace_A2B.h
+++ b/src/core/SkColorSpace_A2B.h
@@ -55,12 +55,12 @@ public:
sk_sp<SkColorSpace> makeLinearGamma() override {
// TODO: Analyze the extrema of our projection into XYZ and use suitable primaries?
// For now, just fall back to a default, because we don't have a good answer.
- return SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named);
+ return SkColorSpace::MakeSRGBLinear();
}
sk_sp<SkColorSpace> makeSRGBGamma() override {
// See comment in makeLinearGamma
- return SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
+ return SkColorSpace::MakeSRGB();
}
Type type() const override { return Type::kA2B; }
diff --git a/src/core/SkColorSpace_Base.h b/src/core/SkColorSpace_Base.h
index 88905b335d..a3210aa13a 100644
--- a/src/core/SkColorSpace_Base.h
+++ b/src/core/SkColorSpace_Base.h
@@ -194,6 +194,14 @@ public:
static sk_sp<SkColorSpace> MakeRGB(SkGammaNamed gammaNamed, const SkMatrix44& toXYZD50);
+ enum Named : uint8_t {
+ kSRGB_Named,
+ kAdobeRGB_Named,
+ kSRGBLinear_Named,
+ };
+
+ static sk_sp<SkColorSpace> MakeNamed(Named);
+
protected:
SkColorSpace_Base(sk_sp<SkData> profileData);
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp
index 1556683456..8920fc6b8a 100644
--- a/src/core/SkImageCacherator.cpp
+++ b/src/core/SkImageCacherator.cpp
@@ -96,7 +96,7 @@ SkImageCacherator::Validator::Validator(sk_sp<SharedGenerator> gen, const SkIRec
// construct a source-to-dest gamut transformation matrix.
if (fInfo.colorSpace() &&
SkColorSpace_Base::Type::kXYZ != as_CSB(fInfo.colorSpace())->type()) {
- fInfo = fInfo.makeColorSpace(SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named));
+ fInfo = fInfo.makeColorSpace(SkColorSpace::MakeSRGBLinear());
}
}
diff --git a/src/core/SkImageInfo.cpp b/src/core/SkImageInfo.cpp
index 1b7c09b2f9..5d0710dc1f 100644
--- a/src/core/SkImageInfo.cpp
+++ b/src/core/SkImageInfo.cpp
@@ -19,7 +19,7 @@ static bool color_type_is_valid(SkColorType colorType) {
SkImageInfo SkImageInfo::MakeS32(int width, int height, SkAlphaType at) {
return SkImageInfo(width, height, kN32_SkColorType, at,
- SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named));
+ SkColorSpace::MakeSRGB());
}
static const int kColorTypeMask = 0x0F;
diff --git a/src/core/SkPM4fPriv.h b/src/core/SkPM4fPriv.h
index 5a60409d84..821c8822cb 100644
--- a/src/core/SkPM4fPriv.h
+++ b/src/core/SkPM4fPriv.h
@@ -157,7 +157,7 @@ static inline SkColor4f SkColor4f_from_SkColor(SkColor color, SkColorSpace* dst)
if (dst) {
// sRGB gamma, sRGB gamut.
color4f = to_colorspace(SkColor4f::FromColor(color),
- SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named).get(), dst);
+ SkColorSpace::MakeSRGB().get(), dst);
} else {
// Linear gamma, dst gamut.
swizzle_rb(SkNx_cast<float>(Sk4b::Load(&color)) * (1/255.0f)).store(&color4f);
diff --git a/src/core/SkShader.cpp b/src/core/SkShader.cpp
index 9f97a7a74a..1c55df762b 100644
--- a/src/core/SkShader.cpp
+++ b/src/core/SkShader.cpp
@@ -301,7 +301,7 @@ bool SkShader::onAppendStages(SkRasterPipeline* p,
// Legacy shaders aren't aware of color spaces. We can pretty
// safely assume they're in sRGB gamut.
return append_gamut_transform(p, alloc,
- SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named).get(), cs);
+ SkColorSpace::MakeSRGB().get(), cs);
}
return false;
}
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 03a2db0995..f50311b97e 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -217,7 +217,7 @@ SkGradientShaderBase::SkGradientShaderBase(const Descriptor& desc, const SkMatri
if (!desc.fColorSpace) {
// This happens if we were constructed from SkColors, so our colors are really sRGB
- fColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named);
+ fColorSpace = SkColorSpace::MakeSRGBLinear();
} else {
// The color space refers to the float colors, so it must be linear gamma
SkASSERT(desc.fColorSpace->gammaIsLinear());
@@ -740,12 +740,12 @@ void SkGradientShaderBase::getGradientTableBitmap(SkBitmap* bitmap,
case GradientBitmapType::kSRGB:
info = SkImageInfo::Make(kCache32Count, 1, kRGBA_8888_SkColorType,
kPremul_SkAlphaType,
- SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named));
+ SkColorSpace::MakeSRGB());
break;
case GradientBitmapType::kHalfFloat:
info = SkImageInfo::Make(
kCache32Count, 1, kRGBA_F16_SkColorType, kPremul_SkAlphaType,
- SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named));
+ SkColorSpace::MakeSRGBLinear());
break;
default:
SkFAIL("Unexpected bitmap type");
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 8e90b04ee5..918d8d41a9 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -89,7 +89,7 @@ GrRenderTargetContext::GrRenderTargetContext(GrContext* context,
, fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps)) {
if (fColorSpace) {
// sRGB sources are very common (SkColor, etc...), so we cache that gamut transformation
- auto srgbColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
+ auto srgbColorSpace = SkColorSpace::MakeSRGB();
fColorXformFromSRGB = GrColorSpaceXform::Make(srgbColorSpace.get(), fColorSpace.get());
}
SkDEBUGCODE(this->validate();)
diff --git a/src/gpu/GrTestUtils.cpp b/src/gpu/GrTestUtils.cpp
index 35af494c9b..1d3b7756df 100644
--- a/src/gpu/GrTestUtils.cpp
+++ b/src/gpu/GrTestUtils.cpp
@@ -8,7 +8,7 @@
#include "GrTestUtils.h"
#include "GrProcessorUnitTest.h"
#include "GrStyle.h"
-#include "SkColorSpace.h"
+#include "SkColorSpace_Base.h"
#include "SkDashPathPriv.h"
#include "SkMatrix.h"
#include "SkPath.h"
@@ -299,8 +299,8 @@ sk_sp<SkColorSpace> TestColorSpace(SkRandom* random) {
// No color space (legacy mode)
gColorSpaces[0] = nullptr;
// sRGB or Adobe
- gColorSpaces[1] = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
- gColorSpaces[2] = SkColorSpace::MakeNamed(SkColorSpace::kAdobeRGB_Named);
+ gColorSpaces[1] = SkColorSpace::MakeSRGB();
+ gColorSpaces[2] = SkColorSpace_Base::MakeNamed(SkColorSpace_Base::kAdobeRGB_Named);
}
return gColorSpaces[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gColorSpaces)))];
}
@@ -310,8 +310,8 @@ sk_sp<GrColorSpaceXform> TestColorXform(SkRandom* random) {
static bool gOnce;
if (!gOnce) {
gOnce = true;
- sk_sp<SkColorSpace> srgb = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
- sk_sp<SkColorSpace> adobe = SkColorSpace::MakeNamed(SkColorSpace::kAdobeRGB_Named);
+ sk_sp<SkColorSpace> srgb = SkColorSpace::MakeSRGB();
+ sk_sp<SkColorSpace> adobe = SkColorSpace_Base::MakeNamed(SkColorSpace_Base::kAdobeRGB_Named);
// No gamut change
gXforms[0] = nullptr;
// To larger gamut
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index ad43eef76d..0dbe57758b 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -303,7 +303,7 @@ GrColor4f SkColorToPremulGrColor4f(SkColor c, SkColorSpace* dstColorSpace) {
GrColor4f SkColorToUnpremulGrColor4f(SkColor c, SkColorSpace* dstColorSpace) {
if (dstColorSpace) {
- auto srgbColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
+ auto srgbColorSpace = SkColorSpace::MakeSRGB();
auto gamutXform = GrColorSpaceXform::Make(srgbColorSpace.get(), dstColorSpace);
return SkColorToUnpremulGrColor4f(c, true, gamutXform.get());
} else {
diff --git a/src/views/SkWindow.cpp b/src/views/SkWindow.cpp
index e54cfb773c..f86bb9f9ef 100644
--- a/src/views/SkWindow.cpp
+++ b/src/views/SkWindow.cpp
@@ -354,7 +354,7 @@ sk_sp<SkSurface> SkWindow::makeGpuBackedSurface(const AttachmentInfo& attachment
sk_sp<SkColorSpace> colorSpace =
grContext->caps()->srgbSupport() && info().colorSpace()
- ? SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named) : nullptr;
+ ? SkColorSpace::MakeSRGB() : nullptr;
return SkSurface::MakeFromBackendRenderTarget(grContext, desc, colorSpace, &fSurfaceProps);
}