aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Matt Sarett <msarett@google.com>2017-02-07 17:06:09 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-07 17:06:24 +0000
commit1f2fff2544a9dc6a0f169a017d374eca9f04c6b5 (patch)
treee97779c04ea0d2059cbd6291de3cbfbf27c1cc61
parentecaaf6f1c156e5690200322fc2636380c1f63dd8 (diff)
Revert "SkColorSpace: remove named API, add gamut API"
This reverts commit ecaaf6f1c156e5690200322fc2636380c1f63dd8. Reason for revert: Breaks everything Original change's description: > SkColorSpace: remove named API, add gamut API > > BUG=skia: > > Change-Id: I01c5e1874c9a034febc64e25b3aaafb5050393a6 > Reviewed-on: https://skia-review.googlesource.com/8021 > Reviewed-by: Brian Osman <brianosman@google.com> > Reviewed-by: Mike Reed <reed@google.com> > Commit-Queue: Matt Sarett <msarett@google.com> > TBR=msarett@google.com,brianosman@google.com,reed@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Change-Id: Ief5a0a4eeabe75a21f7512e23fc15309151066c4 Reviewed-on: https://skia-review.googlesource.com/8127 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Matt Sarett <msarett@google.com>
-rw-r--r--bench/ColorCodecBench.cpp2
-rw-r--r--bench/GrMipMapBench.cpp2
-rw-r--r--bench/SkLinearBitmapPipelineBench.cpp2
-rw-r--r--bench/nanobench.cpp4
-rw-r--r--dm/DM.cpp4
-rw-r--r--dm/DMSrcSink.cpp2
-rw-r--r--gm/all_bitmap_configs.cpp2
-rw-r--r--gm/color4f.cpp4
-rw-r--r--gm/colorspacexform.cpp4
-rw-r--r--gm/encode-srgb.cpp4
-rw-r--r--gm/gamma.cpp2
-rw-r--r--gm/gamut.cpp4
-rw-r--r--gm/gradients.cpp10
-rw-r--r--gm/image.cpp4
-rw-r--r--gm/image_pict.cpp4
-rw-r--r--gm/image_shader.cpp2
-rw-r--r--gm/mipmap.cpp4
-rw-r--r--gm/pictureimagegenerator.cpp2
-rw-r--r--gm/readpixels.cpp10
-rw-r--r--gm/verylargebitmap.cpp2
-rw-r--r--gn/android_framework_defines.gni1
-rw-r--r--include/core/SkColorSpace.h39
-rw-r--r--samplecode/SampleApp.cpp8
-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
-rw-r--r--tests/ColorSpaceTest.cpp70
-rw-r--r--tests/ColorSpaceXformTest.cpp4
-rw-r--r--tests/ICCTest.cpp8
-rw-r--r--tests/ImageIsOpaqueTest.cpp7
-rw-r--r--tests/ImageTest.cpp2
-rw-r--r--tests/SRGBMipMapTest.cpp2
-rw-r--r--tests/SkBlend_optsTest.cpp2
-rw-r--r--tests/SkResourceCacheTest.cpp2
-rw-r--r--tests/SpecialImageTest.cpp2
-rw-r--r--tests/SurfaceTest.cpp6
-rw-r--r--tests/TestConfigParsing.cpp2
-rw-r--r--tools/colorspaceinfo.cpp5
-rw-r--r--tools/fiddle/fiddle_main.cpp4
-rw-r--r--tools/flags/SkCommonFlagsConfig.cpp4
-rw-r--r--tools/picture_utils.cpp2
-rw-r--r--tools/skiaserve/Request.cpp8
-rw-r--r--tools/viewer/ImageSlide.cpp4
-rw-r--r--tools/viewer/Viewer.cpp2
-rw-r--r--tools/viewer/sk_app/VulkanWindowContext.cpp2
-rw-r--r--tools/viewer/sk_app/WindowContext.cpp4
-rw-r--r--tools/viewer/sk_app/android/GLWindowContext_android.cpp2
66 files changed, 145 insertions, 264 deletions
diff --git a/bench/ColorCodecBench.cpp b/bench/ColorCodecBench.cpp
index 867b8a1418..06afdc6565 100644
--- a/bench/ColorCodecBench.cpp
+++ b/bench/ColorCodecBench.cpp
@@ -67,7 +67,7 @@ void ColorCodecBench::onDelayedSetup() {
fDstSpace = nullptr;
if (FLAGS_srgb) {
- fDstSpace = SkColorSpace::MakeSRGB();
+ fDstSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
} else if (FLAGS_nonstd) {
SkColorSpaceTransferFn gamma;
gamma.fA = 1.0f;
diff --git a/bench/GrMipMapBench.cpp b/bench/GrMipMapBench.cpp
index 2037495bc0..56b66ced25 100644
--- a/bench/GrMipMapBench.cpp
+++ b/bench/GrMipMapBench.cpp
@@ -36,7 +36,7 @@ protected:
if (nullptr == context) {
return;
}
- auto srgb = SkColorSpace::MakeSRGB();
+ auto srgb = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
SkImageInfo info = SkImageInfo::Make(fW, fH, kN32_SkColorType, kPremul_SkAlphaType,
srgb);
fSurface = SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info);
diff --git a/bench/SkLinearBitmapPipelineBench.cpp b/bench/SkLinearBitmapPipelineBench.cpp
index 29f28895bf..039179823b 100644
--- a/bench/SkLinearBitmapPipelineBench.cpp
+++ b/bench/SkLinearBitmapPipelineBench.cpp
@@ -93,7 +93,7 @@ struct CommonBitmapFPBenchmark : public Benchmark {
sk_ignore_unused_variable(trash);
fInfo = SkImageInfo::MakeN32Premul(width, height, fIsSRGB ?
- SkColorSpace::MakeSRGB() : nullptr);
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named) : nullptr);
}
bool isSuitableFor(Backend backend) override {
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 92475d31f8..0f1e4825e2 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -456,10 +456,10 @@ static void create_config(const SkCommandLineConfig* config, SkTArray<Config>* c
kN32_SkColorType, kPremul_SkAlphaType, nullptr)
CPU_CONFIG(565, kRaster_Backend,
kRGB_565_SkColorType, kOpaque_SkAlphaType, nullptr)
- auto srgbColorSpace = SkColorSpace::MakeSRGB();
+ auto srgbColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
CPU_CONFIG(srgb, kRaster_Backend,
kN32_SkColorType, kPremul_SkAlphaType, srgbColorSpace)
- auto srgbLinearColorSpace = SkColorSpace::MakeSRGBLinear();
+ auto srgbLinearColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named);
CPU_CONFIG(f16, kRaster_Backend,
kRGBA_F16_SkColorType, kPremul_SkAlphaType, srgbLinearColorSpace)
}
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 81506a78cc..ca8647f815 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -860,8 +860,8 @@ static Sink* create_sink(const SkCommandLineConfig* config) {
#define SINK(t, sink, ...) if (config->getBackend().equals(t)) { return new sink(__VA_ARGS__); }
if (FLAGS_cpu) {
- auto srgbColorSpace = SkColorSpace::MakeSRGB();
- auto srgbLinearColorSpace = SkColorSpace::MakeSRGBLinear();
+ auto srgbColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
+ auto srgbLinearColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named);
SINK("565", RasterSink, kRGB_565_SkColorType);
SINK("8888", RasterSink, kN32_SkColorType);
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 3b849c14ac..88b1963662 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -1014,7 +1014,7 @@ Error ColorCodecSrc::draw(SkCanvas* canvas) const {
sk_sp<SkColorSpace> dstSpace = nullptr;
if (kDst_sRGB_Mode == fMode) {
- dstSpace = SkColorSpace::MakeSRGB();
+ dstSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
} else if (kDst_HPZR30w_Mode == fMode) {
dstSpace = SkColorSpace::MakeICC(dstData->data(), dstData->size());
}
diff --git a/gm/all_bitmap_configs.cpp b/gm/all_bitmap_configs.cpp
index 227c387f52..e954fc33e5 100644
--- a/gm/all_bitmap_configs.cpp
+++ b/gm/all_bitmap_configs.cpp
@@ -266,7 +266,7 @@ DEF_SIMPLE_GM(all_variants_8888, canvas, 4 * SCALE + 30, 2 * SCALE + 10) {
sk_tool_utils::draw_checkerboard(canvas, SK_ColorLTGRAY, SK_ColorWHITE, 8);
sk_sp<SkColorSpace> colorSpaces[] {
- SkColorSpace::MakeSRGB(),
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named),
nullptr,
};
for (auto colorSpace : colorSpaces) {
diff --git a/gm/color4f.cpp b/gm/color4f.cpp
index 2ebe9315a5..b5cda9fa99 100644
--- a/gm/color4f.cpp
+++ b/gm/color4f.cpp
@@ -76,7 +76,7 @@ DEF_SIMPLE_GM(color4f, canvas, 1024, 260) {
sk_sp<SkColorSpace> colorSpaces[]{
nullptr,
- SkColorSpace::MakeSRGB()
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named)
};
for (auto colorSpace : colorSpaces) {
const SkImageInfo info = SkImageInfo::Make(1024, 100, kN32_SkColorType, kPremul_SkAlphaType,
@@ -95,7 +95,7 @@ DEF_SIMPLE_GM(color4f, canvas, 1024, 260) {
DEF_SIMPLE_GM(color4shader, canvas, 360, 480) {
canvas->translate(10, 10);
- auto srgb = SkColorSpace::MakeSRGB();
+ auto srgb = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor);
// red -> blue, green -> red, blue -> green (sRGB)
diff --git a/gm/colorspacexform.cpp b/gm/colorspacexform.cpp
index dfb343778c..6aea549ea8 100644
--- a/gm/colorspacexform.cpp
+++ b/gm/colorspacexform.cpp
@@ -35,7 +35,7 @@ protected:
SkMatrix44 wideGamut(SkMatrix44::kUninitialized_Constructor);
wideGamut.set3x3RowMajorf(kWideGamutRGB_toXYZD50);
- sk_sp<SkColorSpace> srcSpace = SkColorSpace::MakeSRGB();
+ sk_sp<SkColorSpace> srcSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
sk_sp<SkColorSpace> dstSpace =
SkColorSpace::MakeRGB(SkColorSpace::kLinear_RenderTargetGamma, wideGamut);
std::unique_ptr<SkColorSpaceXform> xform = SkColorSpaceXform::New(srcSpace.get(),
@@ -60,7 +60,7 @@ protected:
canvas->save();
for (int i = 0; i < kNumColors; i++) {
- auto space = SkColorSpace::MakeSRGBLinear();
+ auto space = SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named);
sk_sp<SkShader> s = SkShader::MakeColorShader(colors[i], space);
SkPaint paint;
paint.setShader(s);
diff --git a/gm/encode-srgb.cpp b/gm/encode-srgb.cpp
index 991e6a1c42..ef889c8f82 100644
--- a/gm/encode-srgb.cpp
+++ b/gm/encode-srgb.cpp
@@ -28,7 +28,7 @@ static inline int div_round_up(int a, int b) {
sk_sp<SkColorSpace> fix_for_colortype(sk_sp<SkColorSpace> colorSpace, SkColorType colorType) {
if (kRGBA_F16_SkColorType == colorType) {
if (!colorSpace) {
- return SkColorSpace::MakeSRGBLinear();
+ return SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named);
}
return as_CSB(colorSpace)->makeLinearGamma();
@@ -176,7 +176,7 @@ protected:
kUnpremul_SkAlphaType, kPremul_SkAlphaType, kOpaque_SkAlphaType,
};
const sk_sp<SkColorSpace> colorSpaces[] = {
- nullptr, SkColorSpace::MakeSRGB(),
+ nullptr, SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named),
};
SkBitmap bitmap;
diff --git a/gm/gamma.cpp b/gm/gamma.cpp
index ef93d1b9e5..09f80dd327 100644
--- a/gm/gamma.cpp
+++ b/gm/gamma.cpp
@@ -19,7 +19,7 @@ DEF_SIMPLE_GM(gamma, canvas, 850, 200) {
const SkScalar tx = sz + 15.0f;
const SkRect r = SkRect::MakeXYWH(0, 0, sz, sz);
SkShader::TileMode rpt = SkShader::kRepeat_TileMode;
- auto srgbColorSpace = SkColorSpace::MakeSRGB();
+ auto srgbColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
SkBitmap ditherBmp;
ditherBmp.allocN32Pixels(2, 2);
diff --git a/gm/gamut.cpp b/gm/gamut.cpp
index 3e57377fe9..d513bc65c9 100644
--- a/gm/gamut.cpp
+++ b/gm/gamut.cpp
@@ -133,12 +133,12 @@ static void draw_gamut_grid(SkCanvas* canvas, SkTArray<std::unique_ptr<CellRende
switch (origInfo.colorType()) {
case kRGBA_8888_SkColorType:
case kBGRA_8888_SkColorType:
- srgbCS = SkColorSpace::MakeSRGB();
+ srgbCS = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
wideCS = SkColorSpace::MakeRGB(SkColorSpace::kSRGB_RenderTargetGamma,
wideGamutRGB_toXYZD50);
break;
case kRGBA_F16_SkColorType:
- srgbCS = SkColorSpace::MakeSRGBLinear();
+ srgbCS = SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named);
wideCS = SkColorSpace::MakeRGB(SkColorSpace::kLinear_RenderTargetGamma,
wideGamutRGB_toXYZD50);
break;
diff --git a/gm/gradients.cpp b/gm/gradients.cpp
index 099e7cd712..8ae1dd7901 100644
--- a/gm/gradients.cpp
+++ b/gm/gradients.cpp
@@ -61,7 +61,7 @@ static sk_sp<SkShader> MakeLinear(const SkPoint pts[2], const GradData& data,
static sk_sp<SkShader> MakeLinear4f(const SkPoint pts[2], const GradData& data,
SkShader::TileMode tm, const SkMatrix& localMatrix) {
- auto srgb = SkColorSpace::MakeSRGBLinear();
+ auto srgb = SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named);
return SkGradientShader::MakeLinear(pts, data.fColors4f, srgb, data.fPos, data.fCount, tm, 0,
&localMatrix);
}
@@ -80,7 +80,7 @@ static sk_sp<SkShader> MakeRadial4f(const SkPoint pts[2], const GradData& data,
SkPoint center;
center.set(SkScalarAve(pts[0].fX, pts[1].fX),
SkScalarAve(pts[0].fY, pts[1].fY));
- auto srgb = SkColorSpace::MakeSRGBLinear();
+ auto srgb = SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named);
return SkGradientShader::MakeRadial(center, center.fX, data.fColors4f, srgb, data.fPos,
data.fCount, tm, 0, &localMatrix);
}
@@ -99,7 +99,7 @@ static sk_sp<SkShader> MakeSweep4f(const SkPoint pts[2], const GradData& data,
SkPoint center;
center.set(SkScalarAve(pts[0].fX, pts[1].fX),
SkScalarAve(pts[0].fY, pts[1].fY));
- auto srgb = SkColorSpace::MakeSRGBLinear();
+ auto srgb = SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named);
return SkGradientShader::MakeSweep(center.fX, center.fY, data.fColors4f, srgb, data.fPos,
data.fCount, 0, &localMatrix);
}
@@ -124,7 +124,7 @@ static sk_sp<SkShader> Make2Radial4f(const SkPoint pts[2], const GradData& data,
SkScalarAve(pts[0].fY, pts[1].fY));
center1.set(SkScalarInterp(pts[0].fX, pts[1].fX, SkIntToScalar(3) / 5),
SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1) / 4));
- auto srgb = SkColorSpace::MakeSRGBLinear();
+ auto srgb = SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named);
return SkGradientShader::MakeTwoPointConical(center1, (pts[1].fX - pts[0].fX) / 7,
center0, (pts[1].fX - pts[0].fX) / 2,
data.fColors4f, srgb, data.fPos, data.fCount, tm,
@@ -150,7 +150,7 @@ static sk_sp<SkShader> Make2Conical4f(const SkPoint pts[2], const GradData& data
SkScalar radius1 = (pts[1].fX - pts[0].fX) / 3;
center0.set(pts[0].fX + radius0, pts[0].fY + radius0);
center1.set(pts[1].fX - radius1, pts[1].fY - radius1);
- auto srgb = SkColorSpace::MakeSRGBLinear();
+ auto srgb = SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named);
return SkGradientShader::MakeTwoPointConical(center1, radius1, center0, radius0,
data.fColors4f, srgb, data.fPos,
data.fCount, tm, 0, &localMatrix);
diff --git a/gm/image.cpp b/gm/image.cpp
index e232af3b19..1a4b712491 100644
--- a/gm/image.cpp
+++ b/gm/image.cpp
@@ -247,7 +247,7 @@ static sk_sp<SkImage> make_picture(const SkImageInfo& info, GrContext*, void (*d
draw(recorder.beginRecording(SkRect::MakeIWH(info.width(), info.height())));
return SkImage::MakeFromPicture(recorder.finishRecordingAsPicture(),
info.dimensions(), nullptr, nullptr, SkImage::BitDepth::kU8,
- SkColorSpace::MakeSRGB());
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named));
}
static sk_sp<SkImage> make_codec(const SkImageInfo& info, GrContext*, void (*draw)(SkCanvas*)) {
@@ -346,7 +346,7 @@ static SkImageGenerator* gen_picture(const SkImageInfo& info) {
sk_sp<SkPicture> pict(recorder.finishRecordingAsPicture());
return SkImageGenerator::NewFromPicture(info.dimensions(), pict.get(), nullptr, nullptr,
SkImage::BitDepth::kU8,
- SkColorSpace::MakeSRGB());
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named));
}
static SkImageGenerator* gen_png(const SkImageInfo& info) {
diff --git a/gm/image_pict.cpp b/gm/image_pict.cpp
index 286470d1e9..c168bc9fb9 100644
--- a/gm/image_pict.cpp
+++ b/gm/image_pict.cpp
@@ -62,7 +62,7 @@ protected:
// extract enough just for the oval.
const SkISize size = SkISize::Make(100, 100);
- auto srgbColorSpace = SkColorSpace::MakeSRGB();
+ auto srgbColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
SkMatrix matrix;
matrix.setTranslate(-100, -100);
@@ -112,7 +112,7 @@ static SkImageGenerator* make_pic_generator(GrContext*, SkPicture* pic) {
matrix.setTranslate(-100, -100);
return SkImageGenerator::NewFromPicture(SkISize::Make(100, 100), pic, &matrix, nullptr,
SkImage::BitDepth::kU8,
- SkColorSpace::MakeSRGB());
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named));
}
class RasterGenerator : public SkImageGenerator {
diff --git a/gm/image_shader.cpp b/gm/image_shader.cpp
index 02e667957f..522d37340e 100644
--- a/gm/image_shader.cpp
+++ b/gm/image_shader.cpp
@@ -49,7 +49,7 @@ static sk_sp<SkImage> make_texture(GrContext* ctx, SkPicture* pic, const SkImage
static sk_sp<SkImage> make_pict_gen(GrContext*, SkPicture* pic, const SkImageInfo& info) {
return SkImage::MakeFromPicture(sk_ref_sp(pic), info.dimensions(), nullptr, nullptr,
SkImage::BitDepth::kU8,
- SkColorSpace::MakeSRGB());
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named));
}
static sk_sp<SkImage> make_encode_gen(GrContext* ctx, SkPicture* pic, const SkImageInfo& info) {
diff --git a/gm/mipmap.cpp b/gm/mipmap.cpp
index f7bd715016..fa25828f7d 100644
--- a/gm/mipmap.cpp
+++ b/gm/mipmap.cpp
@@ -89,7 +89,7 @@ static void show_mips(SkCanvas* canvas, SkImage* img) {
*/
DEF_SIMPLE_GM(mipmap_srgb, canvas, 260, 230) {
sk_sp<SkImage> limg = make(nullptr);
- sk_sp<SkImage> simg = make(SkColorSpace::MakeSRGB());
+ sk_sp<SkImage> simg = make(SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named));
canvas->translate(10, 10);
show_mips(canvas, limg.get());
@@ -140,7 +140,7 @@ static void show_mips_only(SkCanvas* canvas, SkImage* img) {
*/
DEF_SIMPLE_GM(mipmap_gray8_srgb, canvas, 260, 230) {
sk_sp<SkImage> limg = make_g8_gradient(nullptr);
- sk_sp<SkImage> simg = make_g8_gradient(SkColorSpace::MakeSRGB());
+ sk_sp<SkImage> simg = make_g8_gradient(SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named));
canvas->translate(10, 10);
show_mips_only(canvas, limg.get());
diff --git a/gm/pictureimagegenerator.cpp b/gm/pictureimagegenerator.cpp
index 3f8553c559..3c59f108d8 100644
--- a/gm/pictureimagegenerator.cpp
+++ b/gm/pictureimagegenerator.cpp
@@ -138,7 +138,7 @@ protected:
{ SkISize::Make(200, 100), -1, -1, 0.5f },
};
- auto srgbColorSpace = SkColorSpace::MakeSRGB();
+ auto srgbColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
const unsigned kDrawsPerRow = 4;
const SkScalar kDrawSize = 250;
diff --git a/gm/readpixels.cpp b/gm/readpixels.cpp
index ad9bf8d4f4..df7fb0751a 100644
--- a/gm/readpixels.cpp
+++ b/gm/readpixels.cpp
@@ -86,7 +86,7 @@ static sk_sp<SkImage> make_tagged_picture_image() {
return SkImage::MakeFromPicture(recorder.finishRecordingAsPicture(),
SkISize::Make(kWidth, kHeight), nullptr, nullptr,
SkImage::BitDepth::kU8,
- SkColorSpace::MakeSRGB());
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named));
}
static sk_sp<SkImage> make_untagged_picture_image() {
@@ -144,7 +144,7 @@ static void draw_image(SkCanvas* canvas, SkImage* image, SkColorType dstColorTyp
// Now that we have called readPixels(), dump the raw pixels into an srgb image.
sk_sp<SkColorSpace> srgb = fix_for_colortype(
- SkColorSpace::MakeSRGB().get(), dstColorType);
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named).get(), dstColorType);
sk_sp<SkImage> raw = SkImage::MakeRasterData(dstInfo.makeColorSpace(srgb), data, rowBytes);
canvas->drawImage(raw.get(), 0.0f, 0.0f, nullptr);
}
@@ -179,7 +179,7 @@ protected:
};
const sk_sp<SkColorSpace> colorSpaces[] = {
make_wide_gamut(),
- SkColorSpace::MakeSRGB(),
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named),
make_small_gamut(),
};
@@ -237,7 +237,7 @@ protected:
};
const sk_sp<SkColorSpace> colorSpaces[] = {
make_wide_gamut(),
- SkColorSpace::MakeSRGB(),
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named),
make_small_gamut(),
};
const SkImage::CachingHint hints[] = {
@@ -304,7 +304,7 @@ protected:
};
const sk_sp<SkColorSpace> colorSpaces[] = {
make_wide_gamut(),
- SkColorSpace::MakeSRGB(),
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named),
make_small_gamut(),
};
const SkImage::CachingHint hints[] = {
diff --git a/gm/verylargebitmap.cpp b/gm/verylargebitmap.cpp
index 0d7cab150d..449b22985c 100644
--- a/gm/verylargebitmap.cpp
+++ b/gm/verylargebitmap.cpp
@@ -34,7 +34,7 @@ static sk_sp<SkImage> make_picture_image(int width, int height, SkColor colors[2
return SkImage::MakeFromPicture(recorder.finishRecordingAsPicture(),
SkISize::Make(width, height), nullptr, nullptr,
SkImage::BitDepth::kU8,
- SkColorSpace::MakeSRGB());
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named));
}
typedef sk_sp<SkImage> (*ImageMakerProc)(int width, int height, SkColor colors[2]);
diff --git a/gn/android_framework_defines.gni b/gn/android_framework_defines.gni
index 45241d8e6b..b693d2808d 100644
--- a/gn/android_framework_defines.gni
+++ b/gn/android_framework_defines.gni
@@ -16,5 +16,4 @@ android_framework_defines = [
"SK_SUPPORT_LEGACY_SHADER_ISABITMAP",
"SK_SUPPORT_LEGACY_EMBOSSMASKFILTER",
"SK_SUPPORT_EXOTIC_CLIPOPS",
- "SK_USE_LEGACY_NAMED_COLOR_SPACE",
]
diff --git a/include/core/SkColorSpace.h b/include/core/SkColorSpace.h
index 0399ca8c72..1bcb44fbc5 100644
--- a/include/core/SkColorSpace.h
+++ b/include/core/SkColorSpace.h
@@ -53,7 +53,6 @@ struct SK_API SkColorSpaceTransferFn {
class SK_API SkColorSpace : public SkRefCnt {
public:
-#ifdef SK_USE_LEGACY_NAMED_COLOR_SPACE
/**
* Common, named profiles that we can recognize.
*/
@@ -77,23 +76,6 @@ public:
kSRGBLinear_Named,
};
- /**
- * Create a common, named SkColorSpace.
- */
- static sk_sp<SkColorSpace> MakeNamed(Named);
-#endif
-
- /**
- * Create the sRGB color space.
- */
- static sk_sp<SkColorSpace> MakeSRGB();
-
- /**
- * Colorspace with the sRGB primaries, but a linear (1.0) gamma. Commonly used for
- * half-float surfaces, and high precision individual colors (gradient stops, etc...)
- */
- static sk_sp<SkColorSpace> MakeSRGBLinear();
-
enum RenderTargetGamma : uint8_t {
kLinear_RenderTargetGamma,
@@ -104,24 +86,21 @@ public:
kSRGB_RenderTargetGamma,
};
- enum Gamut {
- kSRGB_Gamut,
- kAdobeRGB_Gamut,
- kDCIP3_D65_Gamut,
- kRec2020_Gamut,
- };
-
/**
* Create an SkColorSpace from a transfer function and a color gamut.
*
- * Transfer function can be specified as an enum or as the coefficients to an equation.
- * Gamut can be specified as an enum or as the matrix transformation to XYZ D50.
+ * Transfer function can be specified as a render target, as the coefficients to an equation,
+ * or as three exponents (R, G, B).
+ * Gamut is specified using the matrix transformation to XYZ D50.
*/
- static sk_sp<SkColorSpace> MakeRGB(RenderTargetGamma gamma, Gamut gamut);
static sk_sp<SkColorSpace> MakeRGB(RenderTargetGamma gamma, const SkMatrix44& toXYZD50);
- static sk_sp<SkColorSpace> MakeRGB(const SkColorSpaceTransferFn& coeffs, Gamut gamut);
static sk_sp<SkColorSpace> MakeRGB(const SkColorSpaceTransferFn& coeffs,
- const SkMatrix44& toXYZD50);
+ const SkMatrix44& toXYZD50);
+
+ /**
+ * Create a common, named SkColorSpace.
+ */
+ static sk_sp<SkColorSpace> MakeNamed(Named);
/**
* Create an SkColorSpace from an ICC profile.
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 81a8fe8fed..5b0b9d605d 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -342,8 +342,8 @@ public:
// the "correct" output (because we generated the pixel values we wanted in the
// offscreen canvas).
auto colorSpace = kRGBA_F16_SkColorType == info.colorType()
- ? SkColorSpace::MakeSRGBLinear()
- : SkColorSpace::MakeSRGB();
+ ? SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named)
+ : SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
auto offscreenImage = SkImage::MakeRasterData(info.makeColorSpace(colorSpace), data,
rowBytes);
@@ -1659,7 +1659,7 @@ bool SampleWindow::onEvent(const SkEvent& evt) {
sk_sp<SkColorSpace> colorSpace = nullptr;
switch (gConfig[selected].fColorSpace) {
case kSRGB_OutputColorSpace:
- colorSpace = SkColorSpace::MakeSRGB();
+ colorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
break;
case kNarrow_OutputColorSpace:
{
@@ -1680,7 +1680,7 @@ bool SampleWindow::onEvent(const SkEvent& evt) {
colorSpace = getMonitorColorSpace();
if (!colorSpace) {
// Fallback for platforms / machines where we can't get a monitor profile
- colorSpace = SkColorSpace::MakeSRGB();
+ colorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
}
break;
case kLegacy_OutputColorSpace:
diff --git a/src/codec/SkAndroidCodec.cpp b/src/codec/SkAndroidCodec.cpp
index 5fc7bfc585..26b9638c96 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::MakeSRGB();
+ return SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
case kRGBA_F16_SkColorType:
- return SkColorSpace::MakeSRGBLinear();
+ return SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named);
default:
// Color correction not supported for k565 and kGray.
return nullptr;
diff --git a/src/codec/SkBmpCodec.cpp b/src/codec/SkBmpCodec.cpp
index cd46a5495c..66ad0caa2b 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::MakeSRGB())
+ : INHERITED(width, height, info, stream, SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named))
, fBitsPerPixel(bitsPerPixel)
, fRowOrder(rowOrder)
, fSrcRowBytes(SkAlign4(compute_row_bytes(width, fBitsPerPixel)))
diff --git a/src/codec/SkGifCodec.cpp b/src/codec/SkGifCodec.cpp
index 2903717b48..af0e8bc242 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::MakeSRGB());
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named));
return new SkGifCodec(encodedInfo, imageInfo, reader.release());
}
diff --git a/src/codec/SkJpegCodec.cpp b/src/codec/SkJpegCodec.cpp
index 995aaa6b96..03a901bed0 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::MakeSRGB();
+ colorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
}
const int width = decoderMgr->dinfo()->image_width;
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index b6258ab8b0..468b0b8731 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::MakeSRGB();
+ return SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
}
// 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::MakeSRGB();
+ return SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
}
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::MakeSRGB();
+ colorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
}
SkEncodedInfo encodedInfo = SkEncodedInfo::Make(color, alpha, bitDepth);
diff --git a/src/codec/SkRawCodec.cpp b/src/codec/SkRawCodec.cpp
index 1684a16884..843ccf0fe5 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::MakeSRGB())
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named))
, fDngImage(dngImage) {}
diff --git a/src/codec/SkWbmpCodec.cpp b/src/codec/SkWbmpCodec.cpp
index d59789b66e..6356e30536 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::MakeSRGB())
+ : INHERITED(width, height, info, stream, SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named))
, 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 bd69f658e6..dbc141ebd6 100644
--- a/src/codec/SkWebpCodec.cpp
+++ b/src/codec/SkWebpCodec.cpp
@@ -70,7 +70,7 @@ SkCodec* SkWebpCodec::NewFromStream(SkStream* stream) {
}
}
if (!colorSpace) {
- colorSpace = SkColorSpace::MakeSRGB();
+ colorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
}
// 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 5c8bde6ee1..32d9b430c7 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::MakeSRGB().get(), dst);
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named).get(), dst);
}
bool SkColor4Shader::onAppendStages(SkRasterPipeline* p,
diff --git a/src/core/SkColorSpace.cpp b/src/core/SkColorSpace.cpp
index 645410c496..3c1ce257f1 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_Base::MakeNamed(kSRGB_Named);
+ return SkColorSpace::MakeNamed(kSRGB_Named);
}
break;
case k2Dot2Curve_SkGammaNamed:
if (xyz_almost_equal(toXYZD50, gAdobeRGB_toXYZD50)) {
- return SkColorSpace_Base::MakeNamed(kAdobeRGB_Named);
+ return SkColorSpace::MakeNamed(kAdobeRGB_Named);
}
break;
case kLinear_SkGammaNamed:
if (xyz_almost_equal(toXYZD50, gSRGB_toXYZD50)) {
- return SkColorSpace_Base::MakeNamed(kSRGBLinear_Named);
+ return SkColorSpace::MakeNamed(kSRGBLinear_Named);
}
break;
case kNonStandard_SkGammaNamed:
@@ -183,29 +183,11 @@ 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;
@@ -250,14 +232,6 @@ sk_sp<SkColorSpace> SkColorSpace_Base::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 {
@@ -316,7 +290,7 @@ struct ColorSpaceHeader {
SkASSERT(k0_Version == version);
header.fVersion = (uint8_t) version;
- SkASSERT(named <= SkColorSpace_Base::kSRGBLinear_Named);
+ SkASSERT(named <= SkColorSpace::kSRGBLinear_Named);
header.fNamed = (uint8_t) named;
SkASSERT(gammaNamed <= kNonStandard_SkGammaNamed);
@@ -344,20 +318,20 @@ size_t SkColorSpace::writeToMemory(void* memory) const {
const SkGammaNamed gammaNamed = thisXYZ->gammaNamed();
if (this == gSRGB) {
if (memory) {
- *((ColorSpaceHeader*) memory) = ColorSpaceHeader::Pack(
- k0_Version, SkColorSpace_Base::kSRGB_Named, gammaNamed, 0);
+ *((ColorSpaceHeader*) memory) =
+ ColorSpaceHeader::Pack(k0_Version, kSRGB_Named, gammaNamed, 0);
}
return sizeof(ColorSpaceHeader);
} else if (this == gAdobeRGB) {
if (memory) {
- *((ColorSpaceHeader*) memory) = ColorSpaceHeader::Pack(
- k0_Version, SkColorSpace_Base::kAdobeRGB_Named, gammaNamed, 0);
+ *((ColorSpaceHeader*) memory) =
+ ColorSpaceHeader::Pack(k0_Version, kAdobeRGB_Named, gammaNamed, 0);
}
return sizeof(ColorSpaceHeader);
} else if (this == gSRGBLinear) {
if (memory) {
- *((ColorSpaceHeader*) memory) = ColorSpaceHeader::Pack(
- k0_Version, SkColorSpace_Base::kSRGBLinear_Named, gammaNamed, 0);
+ *((ColorSpaceHeader*) memory) =
+ ColorSpaceHeader::Pack(k0_Version, kSRGBLinear_Named, gammaNamed, 0);
}
return sizeof(ColorSpaceHeader);
}
@@ -449,7 +423,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 SkColorSpace_Base::MakeNamed((SkColorSpace_Base::Named) header.fNamed);
+ return MakeNamed((Named) header.fNamed);
}
switch ((SkGammaNamed) header.fGammaNamed) {
diff --git a/src/core/SkColorSpacePriv.h b/src/core/SkColorSpacePriv.h
index 26ccd5e6ca..5b09036ea8 100644
--- a/src/core/SkColorSpacePriv.h
+++ b/src/core/SkColorSpacePriv.h
@@ -23,35 +23,6 @@ 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 99248b80fd..33219450dc 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::MakeSRGBLinear();
+ return SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named);
}
sk_sp<SkColorSpace> makeSRGBGamma() override {
// See comment in makeLinearGamma
- return SkColorSpace::MakeSRGB();
+ return SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
}
Type type() const override { return Type::kA2B; }
diff --git a/src/core/SkColorSpace_Base.h b/src/core/SkColorSpace_Base.h
index a3210aa13a..88905b335d 100644
--- a/src/core/SkColorSpace_Base.h
+++ b/src/core/SkColorSpace_Base.h
@@ -194,14 +194,6 @@ 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 8920fc6b8a..1556683456 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::MakeSRGBLinear());
+ fInfo = fInfo.makeColorSpace(SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named));
}
}
diff --git a/src/core/SkImageInfo.cpp b/src/core/SkImageInfo.cpp
index 5d0710dc1f..1b7c09b2f9 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::MakeSRGB());
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named));
}
static const int kColorTypeMask = 0x0F;
diff --git a/src/core/SkPM4fPriv.h b/src/core/SkPM4fPriv.h
index 821c8822cb..5a60409d84 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::MakeSRGB().get(), dst);
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named).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 81aae116d5..9da760f843 100644
--- a/src/core/SkShader.cpp
+++ b/src/core/SkShader.cpp
@@ -280,7 +280,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::MakeSRGB().get(), cs);
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named).get(), cs);
}
return false;
}
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index f50311b97e..03a2db0995 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::MakeSRGBLinear();
+ fColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named);
} 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::MakeSRGB());
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named));
break;
case GradientBitmapType::kHalfFloat:
info = SkImageInfo::Make(
kCache32Count, 1, kRGBA_F16_SkColorType, kPremul_SkAlphaType,
- SkColorSpace::MakeSRGBLinear());
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named));
break;
default:
SkFAIL("Unexpected bitmap type");
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 918d8d41a9..8e90b04ee5 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::MakeSRGB();
+ auto srgbColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
fColorXformFromSRGB = GrColorSpaceXform::Make(srgbColorSpace.get(), fColorSpace.get());
}
SkDEBUGCODE(this->validate();)
diff --git a/src/gpu/GrTestUtils.cpp b/src/gpu/GrTestUtils.cpp
index 1d3b7756df..35af494c9b 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_Base.h"
+#include "SkColorSpace.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::MakeSRGB();
- gColorSpaces[2] = SkColorSpace_Base::MakeNamed(SkColorSpace_Base::kAdobeRGB_Named);
+ gColorSpaces[1] = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
+ gColorSpaces[2] = SkColorSpace::MakeNamed(SkColorSpace::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::MakeSRGB();
- sk_sp<SkColorSpace> adobe = SkColorSpace_Base::MakeNamed(SkColorSpace_Base::kAdobeRGB_Named);
+ sk_sp<SkColorSpace> srgb = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
+ sk_sp<SkColorSpace> adobe = SkColorSpace::MakeNamed(SkColorSpace::kAdobeRGB_Named);
// No gamut change
gXforms[0] = nullptr;
// To larger gamut
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 0dbe57758b..ad43eef76d 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::MakeSRGB();
+ auto srgbColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
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 f86bb9f9ef..e54cfb773c 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::MakeSRGB() : nullptr;
+ ? SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named) : nullptr;
return SkSurface::MakeFromBackendRenderTarget(grContext, desc, colorSpace, &fSurfaceProps);
}
diff --git a/tests/ColorSpaceTest.cpp b/tests/ColorSpaceTest.cpp
index 2bc735aaef..65e0450892 100644
--- a/tests/ColorSpaceTest.cpp
+++ b/tests/ColorSpaceTest.cpp
@@ -74,7 +74,7 @@ static constexpr float g_sRGB_G[]{ 0.3853f, 0.7170f, 0.0971f };
static constexpr float g_sRGB_B[]{ 0.1430f, 0.0606f, 0.7139f };
DEF_TEST(ColorSpace_sRGB, r) {
- test_space(r, SkColorSpace::MakeSRGB().get(),
+ test_space(r, SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named).get(),
g_sRGB_R, g_sRGB_G, g_sRGB_B, kSRGB_SkGammaNamed);
}
@@ -103,7 +103,7 @@ DEF_TEST(ColorSpaceParseICCProfiles, r) {
DEF_TEST(ColorSpaceSRGBCompare, r) {
// Create an sRGB color space by name
- sk_sp<SkColorSpace> namedColorSpace = SkColorSpace::MakeSRGB();
+ sk_sp<SkColorSpace> namedColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
// Create an sRGB color space by value
SkMatrix44 srgbToxyzD50(SkMatrix44::kUninitialized_Constructor);
@@ -132,10 +132,10 @@ DEF_TEST(ColorSpaceSRGBCompare, r) {
DEF_TEST(ColorSpaceSRGBLinearCompare, r) {
// Create the linear sRGB color space by name
- sk_sp<SkColorSpace> namedColorSpace = SkColorSpace::MakeSRGBLinear();
+ sk_sp<SkColorSpace> namedColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named);
// Create the linear sRGB color space via the sRGB color space's makeLinearGamma()
- auto srgb = SkColorSpace::MakeSRGB();
+ auto srgb = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
auto srgbXYZ = static_cast<SkColorSpace_XYZ*>(srgb.get());
sk_sp<SkColorSpace> viaSrgbColorSpace = srgbXYZ->makeLinearGamma();
REPORTER_ASSERT(r, namedColorSpace == viaSrgbColorSpace);
@@ -178,8 +178,7 @@ DEF_TEST(ColorSpaceSRGBLinearCompare, r) {
DEF_TEST(ColorSpaceAdobeCompare, r) {
// Create an sRGB color space by name
- sk_sp<SkColorSpace> namedColorSpace =
- SkColorSpace_Base::MakeNamed(SkColorSpace_Base::kAdobeRGB_Named);
+ sk_sp<SkColorSpace> namedColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kAdobeRGB_Named);
// Create an sRGB color space by value
SkMatrix44 adobeToxyzD50(SkMatrix44::kUninitialized_Constructor);
@@ -199,16 +198,16 @@ DEF_TEST(ColorSpaceAdobeCompare, r) {
DEF_TEST(ColorSpace_Named, r) {
const struct {
- SkColorSpace_Base::Named fNamed;
- SkGammaNamed fExpectedGamma;
+ SkColorSpace::Named fNamed;
+ SkGammaNamed fExpectedGamma;
} recs[] {
- { SkColorSpace_Base::kSRGB_Named, kSRGB_SkGammaNamed },
- { SkColorSpace_Base::kAdobeRGB_Named, k2Dot2Curve_SkGammaNamed },
- { SkColorSpace_Base::kSRGBLinear_Named, kLinear_SkGammaNamed },
+ { SkColorSpace::kSRGB_Named, kSRGB_SkGammaNamed },
+ { SkColorSpace::kAdobeRGB_Named, k2Dot2Curve_SkGammaNamed },
+ { SkColorSpace::kSRGBLinear_Named, kLinear_SkGammaNamed },
};
for (auto rec : recs) {
- auto cs = SkColorSpace_Base::MakeNamed(rec.fNamed);
+ auto cs = SkColorSpace::MakeNamed(rec.fNamed);
REPORTER_ASSERT(r, cs);
if (cs) {
SkASSERT(SkColorSpace_Base::Type::kXYZ == as_CSB(cs)->type());
@@ -241,9 +240,9 @@ static void test_serialize(skiatest::Reporter* r, SkColorSpace* space, bool isNa
}
DEF_TEST(ColorSpace_Serialize, r) {
- test_serialize(r, SkColorSpace::MakeSRGB().get(), true);
- test_serialize(r, SkColorSpace_Base::MakeNamed(SkColorSpace_Base::kAdobeRGB_Named).get(), true);
- test_serialize(r, SkColorSpace::MakeSRGBLinear().get(), true);
+ test_serialize(r, SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named).get(), true);
+ test_serialize(r, SkColorSpace::MakeNamed(SkColorSpace::kAdobeRGB_Named).get(), true);
+ test_serialize(r, SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named).get(), true);
sk_sp<SkData> monitorData = SkData::MakeFromFileName(
GetResourcePath("icc_profiles/HP_ZR30w.icc").c_str());
@@ -268,8 +267,8 @@ DEF_TEST(ColorSpace_Serialize, r) {
}
DEF_TEST(ColorSpace_Equals, r) {
- sk_sp<SkColorSpace> srgb = SkColorSpace::MakeSRGB();
- sk_sp<SkColorSpace> adobe = SkColorSpace_Base::MakeNamed(SkColorSpace_Base::kAdobeRGB_Named);
+ sk_sp<SkColorSpace> srgb = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
+ sk_sp<SkColorSpace> adobe = SkColorSpace::MakeNamed(SkColorSpace::kAdobeRGB_Named);
sk_sp<SkData> data = SkData::MakeFromFileName(
GetResourcePath("icc_profiles/HP_ZR30w.icc").c_str());
sk_sp<SkColorSpace> z30 = SkColorSpace::MakeICC(data->data(), data->size());
@@ -357,7 +356,7 @@ DEF_TEST(ColorSpace_Primaries, r) {
sk_sp<SkColorSpace> space = SkColorSpace::MakeRGB(SkColorSpace::kSRGB_RenderTargetGamma,
srgbToXYZ);
- REPORTER_ASSERT(r, SkColorSpace::MakeSRGB() == space);
+ REPORTER_ASSERT(r, SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named) == space);
// AdobeRGB primaries (D65)
SkColorSpacePrimaries adobe;
@@ -378,7 +377,7 @@ DEF_TEST(ColorSpace_Primaries, r) {
fn.fB = fn.fC = fn.fD = fn.fE = fn.fF = 0.0f;
fn.fG = 2.2f;
space = SkColorSpace::MakeRGB(fn, adobeToXYZ);
- REPORTER_ASSERT(r, SkColorSpace_Base::MakeNamed(SkColorSpace_Base::kAdobeRGB_Named) == space);
+ REPORTER_ASSERT(r, SkColorSpace::MakeNamed(SkColorSpace::kAdobeRGB_Named) == space);
// ProPhoto (D50)
SkColorSpacePrimaries proPhoto;
@@ -411,37 +410,6 @@ DEF_TEST(ColorSpace_Primaries, r) {
0.1852204f, 0.5915984f, 0.0555518f,
0.1446290f, 0.0974520f, 0.7708399f);
check_primaries(r, ntsc, ntscToXYZ);
-
- // DCI P3 (D65)
- SkColorSpacePrimaries p3;
- p3.fRX = 0.680f;
- p3.fRY = 0.320f;
- p3.fGX = 0.265f;
- p3.fGY = 0.690f;
- p3.fBX = 0.150f;
- p3.fBY = 0.060f;
- p3.fWX = 0.3127f;
- p3.fWY = 0.3290f;
- space = SkColorSpace::MakeRGB(SkColorSpace::kSRGB_RenderTargetGamma,
- SkColorSpace::kDCIP3_D65_Gamut);
- SkMatrix44 reference(SkMatrix44::kUninitialized_Constructor);
- SkAssertResult(space->toXYZD50(&reference));
- check_primaries(r, p3, reference);
-
- // Rec 2020 (D65)
- SkColorSpacePrimaries rec2020;
- rec2020.fRX = 0.708f;
- rec2020.fRY = 0.292f;
- rec2020.fGX = 0.170f;
- rec2020.fGY = 0.797f;
- rec2020.fBX = 0.131f;
- rec2020.fBY = 0.046f;
- rec2020.fWX = 0.3127f;
- rec2020.fWY = 0.3290f;
- space = SkColorSpace::MakeRGB(SkColorSpace::kSRGB_RenderTargetGamma,
- SkColorSpace::kRec2020_Gamut);
- SkAssertResult(space->toXYZD50(&reference));
- check_primaries(r, rec2020, reference);
}
DEF_TEST(ColorSpace_InvalidICC, r) {
@@ -453,7 +421,7 @@ DEF_TEST(ColorSpace_InvalidICC, r) {
}
DEF_TEST(ColorSpace_MatrixHash, r) {
- sk_sp<SkColorSpace> srgb = SkColorSpace::MakeSRGB();
+ sk_sp<SkColorSpace> srgb = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
SkColorSpaceTransferFn fn;
fn.fA = 1.0f;
diff --git a/tests/ColorSpaceXformTest.cpp b/tests/ColorSpaceXformTest.cpp
index f8a5c8fec4..bdcdd3e1a4 100644
--- a/tests/ColorSpaceXformTest.cpp
+++ b/tests/ColorSpaceXformTest.cpp
@@ -326,8 +326,8 @@ DEF_TEST(SkColorSpaceXform_LoadTail, r) {
std::unique_ptr<uint64_t[]> srcPixel(new uint64_t[1]);
srcPixel[0] = 0;
uint32_t dstPixel;
- sk_sp<SkColorSpace> adobe = SkColorSpace_Base::MakeNamed(SkColorSpace_Base::kAdobeRGB_Named);
- sk_sp<SkColorSpace> srgb = SkColorSpace::MakeSRGB();
+ sk_sp<SkColorSpace> adobe = SkColorSpace::MakeNamed(SkColorSpace::kAdobeRGB_Named);
+ sk_sp<SkColorSpace> srgb = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
std::unique_ptr<SkColorSpaceXform> xform = SkColorSpaceXform::New(adobe.get(), srgb.get());
// ASAN will catch us if we read past the tail.
diff --git a/tests/ICCTest.cpp b/tests/ICCTest.cpp
index 5d541bdc27..794483c682 100644
--- a/tests/ICCTest.cpp
+++ b/tests/ICCTest.cpp
@@ -124,7 +124,7 @@ DEF_TEST(ICC_WriteICC, r) {
SkMatrix44 adobeMatrix(SkMatrix44::kUninitialized_Constructor);
adobeMatrix.set3x3RowMajorf(gAdobeRGB_toXYZD50);
test_write_icc(r, adobeFn, adobeMatrix,
- SkColorSpace_Base::MakeNamed(SkColorSpace_Base::kAdobeRGB_Named).get(), false);
+ SkColorSpace::MakeNamed(SkColorSpace::kAdobeRGB_Named).get(), false);
SkColorSpaceTransferFn srgbFn;
srgbFn.fA = 1.0f / 1.055f;
@@ -136,7 +136,7 @@ DEF_TEST(ICC_WriteICC, r) {
srgbFn.fG = 2.4f;
SkMatrix44 srgbMatrix(SkMatrix44::kUninitialized_Constructor);
srgbMatrix.set3x3RowMajorf(gSRGB_toXYZD50);
- test_write_icc(r, srgbFn, srgbMatrix, SkColorSpace::MakeSRGB().get(),
+ test_write_icc(r, srgbFn, srgbMatrix, SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named).get(),
false);
}
@@ -166,11 +166,11 @@ public:
};
DEF_TEST(ICC_RawTransferFns, r) {
- sk_sp<SkICC> srgb = ICCTest::MakeICC(SkColorSpace::MakeSRGB());
+ sk_sp<SkICC> srgb = ICCTest::MakeICC(SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named));
test_raw_transfer_fn(r, srgb.get());
sk_sp<SkICC> adobe =
- ICCTest::MakeICC(SkColorSpace_Base::MakeNamed(SkColorSpace_Base::kAdobeRGB_Named));
+ ICCTest::MakeICC(SkColorSpace::MakeNamed(SkColorSpace::kAdobeRGB_Named));
test_raw_transfer_fn(r, adobe.get());
// Lookup-table based gamma curves
diff --git a/tests/ImageIsOpaqueTest.cpp b/tests/ImageIsOpaqueTest.cpp
index 81f1d76609..cbbe331c5b 100644
--- a/tests/ImageIsOpaqueTest.cpp
+++ b/tests/ImageIsOpaqueTest.cpp
@@ -12,7 +12,6 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
#endif
-#include "SkColorSpace_Base.h"
#include "SkImage.h"
#include "SkSurface.h"
#include "SkReadBuffer.h"
@@ -51,8 +50,8 @@ DEF_TEST(ImageInfo_flattening, reporter) {
sk_sp<SkColorSpace> spaces[] = {
nullptr,
- SkColorSpace::MakeSRGB(),
- SkColorSpace_Base::MakeNamed(SkColorSpace_Base::kAdobeRGB_Named),
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named),
+ SkColorSpace::MakeNamed(SkColorSpace::kAdobeRGB_Named),
space0,
space1,
space2,
@@ -127,7 +126,7 @@ DEF_TEST(Image_isAlphaOnly, reporter) {
GetResourceAsImage("color_wheel.jpg"),
SkImage::MakeFromPicture(make_picture(), { 10, 10 }, nullptr, nullptr,
SkImage::BitDepth::kU8,
- SkColorSpace::MakeSRGB()),
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named)),
})
{
REPORTER_ASSERT(reporter, image->isAlphaOnly() == false);
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index 14f605719d..500efef0d6 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -131,7 +131,7 @@ static sk_sp<SkImage> create_picture_image() {
canvas->clear(SK_ColorCYAN);
return SkImage::MakeFromPicture(recorder.finishRecordingAsPicture(), SkISize::Make(10, 10),
nullptr, nullptr, SkImage::BitDepth::kU8,
- SkColorSpace::MakeSRGB());
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named));
};
#endif
// Want to ensure that our Release is called when the owning image is destroyed
diff --git a/tests/SRGBMipMapTest.cpp b/tests/SRGBMipMapTest.cpp
index dbdcaeccab..22d68903eb 100644
--- a/tests/SRGBMipMapTest.cpp
+++ b/tests/SRGBMipMapTest.cpp
@@ -121,7 +121,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) {
sk_sp<GrTexture> texture(texProvider->createTexture(desc, SkBudgeted::kNo, texData, 0));
// Create two render target contexts (L32 and S32)
- sk_sp<SkColorSpace> srgbColorSpace = SkColorSpace::MakeSRGB();
+ sk_sp<SkColorSpace> srgbColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
sk_sp<GrRenderTargetContext> l32RenderTargetContext = context->makeRenderTargetContext(
SkBackingFit::kExact, rtS, rtS, kRGBA_8888_GrPixelConfig, nullptr);
sk_sp<GrRenderTargetContext> s32RenderTargetContext = context->makeRenderTargetContext(
diff --git a/tests/SkBlend_optsTest.cpp b/tests/SkBlend_optsTest.cpp
index f8cf2d83de..554818adec 100644
--- a/tests/SkBlend_optsTest.cpp
+++ b/tests/SkBlend_optsTest.cpp
@@ -52,7 +52,7 @@ static void test_blender(std::string resourceName, skiatest::Reporter* reporter)
return;
}
SkBitmap bm;
- sk_sp<SkColorSpace> srgbColorSpace = SkColorSpace::MakeSRGB();
+ sk_sp<SkColorSpace> srgbColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
if (!as_IB(image)->getROPixels(&bm, srgbColorSpace.get())) {
ERRORF(reporter, "Could not read resource");
return;
diff --git a/tests/SkResourceCacheTest.cpp b/tests/SkResourceCacheTest.cpp
index 2141885b11..922aceff25 100644
--- a/tests/SkResourceCacheTest.cpp
+++ b/tests/SkResourceCacheTest.cpp
@@ -331,7 +331,7 @@ DEF_TEST(BitmapCache_discarded_image, reporter) {
return SkImage::MakeFromPicture(recorder.finishRecordingAsPicture(),
SkISize::Make(10, 10), nullptr, nullptr,
SkImage::BitDepth::kU8,
- SkColorSpace::MakeSRGB());
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named));
});
}
}
diff --git a/tests/SpecialImageTest.cpp b/tests/SpecialImageTest.cpp
index 94683a0cdf..551efff6c5 100644
--- a/tests/SpecialImageTest.cpp
+++ b/tests/SpecialImageTest.cpp
@@ -184,7 +184,7 @@ DEF_TEST(SpecialImage_Image_Legacy, reporter) {
}
DEF_TEST(SpecialImage_Image_ColorSpaceAware, reporter) {
- sk_sp<SkColorSpace> srgbColorSpace = SkColorSpace::MakeSRGB();
+ sk_sp<SkColorSpace> srgbColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
test_specialimage_image(reporter, srgbColorSpace.get());
}
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index dd71943dd9..2097ab3fa6 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -807,8 +807,8 @@ static void test_surface_creation_and_snapshot_with_color_space(
bool f16Support,
std::function<sk_sp<SkSurface>(const SkImageInfo&)> surfaceMaker) {
- auto srgbColorSpace = SkColorSpace::MakeSRGB();
- auto adobeColorSpace = SkColorSpace_Base::MakeNamed(SkColorSpace_Base::kAdobeRGB_Named);
+ auto srgbColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
+ auto adobeColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kAdobeRGB_Named);
const SkMatrix44* srgbMatrix = as_CSB(srgbColorSpace)->toXYZD50();
SkASSERT(srgbMatrix);
SkColorSpaceTransferFn oddGamma;
@@ -816,7 +816,7 @@ static void test_surface_creation_and_snapshot_with_color_space(
oddGamma.fB = oddGamma.fC = oddGamma.fD = oddGamma.fE = oddGamma.fF = 0.0f;
oddGamma.fG = 4.0f;
auto oddColorSpace = SkColorSpace::MakeRGB(oddGamma, *srgbMatrix);
- auto linearColorSpace = SkColorSpace::MakeSRGBLinear();
+ auto linearColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named);
const struct {
SkColorType fColorType;
diff --git a/tests/TestConfigParsing.cpp b/tests/TestConfigParsing.cpp
index 70fe0e2ff9..9675eedbc9 100644
--- a/tests/TestConfigParsing.cpp
+++ b/tests/TestConfigParsing.cpp
@@ -86,7 +86,7 @@ DEF_TEST(ParseConfigs_DefaultConfigs, reporter) {
SkCommandLineConfigArray configs;
ParseConfigs(config1, &configs);
- auto srgbColorSpace = SkColorSpace::MakeSRGB();
+ auto srgbColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
REPORTER_ASSERT(reporter, configs.count() == config1.count());
for (int i = 0; i < config1.count(); ++i) {
diff --git a/tools/colorspaceinfo.cpp b/tools/colorspaceinfo.cpp
index 73d6d2b5b1..c2b33b0a39 100644
--- a/tools/colorspaceinfo.cpp
+++ b/tools/colorspaceinfo.cpp
@@ -311,7 +311,7 @@ int main(int argc, char** argv) {
// Draw the sRGB gamut if requested.
if (FLAGS_sRGB_gamut) {
- sk_sp<SkColorSpace> sRGBSpace = SkColorSpace::MakeSRGB();
+ sk_sp<SkColorSpace> sRGBSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
const SkMatrix44* mat = as_CSB(sRGBSpace)->toXYZD50();
SkASSERT(mat);
draw_gamut(&gamutCanvas, *mat, "sRGB", 0xFFFF9394, false);
@@ -319,8 +319,7 @@ int main(int argc, char** argv) {
// Draw the Adobe RGB gamut if requested.
if (FLAGS_adobeRGB) {
- sk_sp<SkColorSpace> adobeRGBSpace =
- SkColorSpace_Base::MakeNamed(SkColorSpace_Base::kAdobeRGB_Named);
+ sk_sp<SkColorSpace> adobeRGBSpace = SkColorSpace::MakeNamed(SkColorSpace::kAdobeRGB_Named);
const SkMatrix44* mat = as_CSB(adobeRGBSpace)->toXYZD50();
SkASSERT(mat);
draw_gamut(&gamutCanvas, *mat, "Adobe RGB", 0xFF31a9e1, false);
diff --git a/tools/fiddle/fiddle_main.cpp b/tools/fiddle/fiddle_main.cpp
index 329900693e..2e3d37b08f 100644
--- a/tools/fiddle/fiddle_main.cpp
+++ b/tools/fiddle/fiddle_main.cpp
@@ -110,9 +110,9 @@ int main() {
if (options.f16) {
SkASSERT(options.srgb);
colorType = kRGBA_F16_SkColorType;
- colorSpace = SkColorSpace::MakeSRGBLinear();
+ colorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named);
} else if (options.srgb) {
- colorSpace = SkColorSpace::MakeSRGB();
+ colorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
}
SkImageInfo info = SkImageInfo::Make(options.size.width(), options.size.height(), colorType,
kPremul_SkAlphaType, colorSpace);
diff --git a/tools/flags/SkCommonFlagsConfig.cpp b/tools/flags/SkCommonFlagsConfig.cpp
index 65ba372d7c..6dcb2f104d 100644
--- a/tools/flags/SkCommonFlagsConfig.cpp
+++ b/tools/flags/SkCommonFlagsConfig.cpp
@@ -291,8 +291,8 @@ static bool parse_option_gpu_color(const SkString& value,
// First, figure out color gamut that we'll work in (default to sRGB)
const bool linearGamma = commands[0].equals("f16");
- *outColorSpace = linearGamma ? SkColorSpace::MakeSRGBLinear()
- : SkColorSpace::MakeSRGB();
+ *outColorSpace = SkColorSpace::MakeNamed(linearGamma ? SkColorSpace::kSRGBLinear_Named
+ : SkColorSpace::kSRGB_Named);
if (commands.count() == 2) {
if (commands[1].equals("srgb")) {
// sRGB gamut (which is our default)
diff --git a/tools/picture_utils.cpp b/tools/picture_utils.cpp
index b0fd224a94..84925b4dad 100644
--- a/tools/picture_utils.cpp
+++ b/tools/picture_utils.cpp
@@ -82,7 +82,7 @@ namespace sk_tools {
SkAutoTMalloc<uint32_t> rgba(w*h);
- auto srgbColorSpace = SkColorSpace::MakeSRGB();
+ auto srgbColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
if (bitmap. colorType() == kN32_SkColorType &&
bitmap.colorSpace() == srgbColorSpace.get()) {
// These are premul sRGB 8-bit pixels in SkPMColor order.
diff --git a/tools/skiaserve/Request.cpp b/tools/skiaserve/Request.cpp
index 0fbccc39b3..ff8849ad96 100644
--- a/tools/skiaserve/Request.cpp
+++ b/tools/skiaserve/Request.cpp
@@ -179,8 +179,8 @@ SkSurface* Request::createCPUSurface() {
SkIRect bounds = this->getBounds();
ColorAndProfile cap = ColorModes[fColorMode];
auto colorSpace = kRGBA_F16_SkColorType == cap.fColorType
- ? SkColorSpace::MakeSRGBLinear()
- : SkColorSpace::MakeSRGB();
+ ? SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named)
+ : SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
SkImageInfo info = SkImageInfo::Make(bounds.width(), bounds.height(), cap.fColorType,
kPremul_SkAlphaType, cap.fSRGB ? colorSpace : nullptr);
return SkSurface::MakeRaster(info).release();
@@ -191,8 +191,8 @@ SkSurface* Request::createGPUSurface() {
SkIRect bounds = this->getBounds();
ColorAndProfile cap = ColorModes[fColorMode];
auto colorSpace = kRGBA_F16_SkColorType == cap.fColorType
- ? SkColorSpace::MakeSRGBLinear()
- : SkColorSpace::MakeSRGB();
+ ? SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named)
+ : SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
SkImageInfo info = SkImageInfo::Make(bounds.width(), bounds.height(), cap.fColorType,
kPremul_SkAlphaType, cap.fSRGB ? colorSpace: nullptr);
SkSurface* surface = SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info).release();
diff --git a/tools/viewer/ImageSlide.cpp b/tools/viewer/ImageSlide.cpp
index 0b52a81ddc..0ffd4ea080 100644
--- a/tools/viewer/ImageSlide.cpp
+++ b/tools/viewer/ImageSlide.cpp
@@ -10,7 +10,7 @@
#include "SkBitmap.h"
#include "SkCodec.h"
#include "SkColorSpaceXform.h"
-#include "SkColorSpace_Base.h"
+#include "SkColorSpace.h"
#include "SkCanvas.h"
#include "SkData.h"
#include "SkImage.h"
@@ -46,7 +46,7 @@ void ImageSlide::load(SkScalar, SkScalar) {
codec->getPixels(codec->getInfo(), fOriginalBitmap.getPixels(), fOriginalBitmap.rowBytes());
SkImageInfo xformedInfo = codec->getInfo().makeColorSpace(
- SkColorSpace_Base::MakeNamed(SkColorSpace_Base::kAdobeRGB_Named));
+ SkColorSpace::MakeNamed(SkColorSpace::kAdobeRGB_Named));
fXformedBitmap.allocPixels(xformedInfo);
codec->getPixels(xformedInfo, fXformedBitmap.getPixels(), fXformedBitmap.rowBytes());
}
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index 0b93afc2b1..49a331bcf4 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -165,7 +165,7 @@ Viewer::Viewer(int argc, char** argv, void* platformData)
fCommands.addCommand('c', "Modes", "Toggle sRGB color mode", [this]() {
DisplayParams params = fWindow->getDisplayParams();
params.fColorSpace = (nullptr == params.fColorSpace)
- ? SkColorSpace::MakeSRGB() : nullptr;
+ ? SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named) : nullptr;
fWindow->setDisplayParams(params);
this->updateTitle();
fWindow->inval();
diff --git a/tools/viewer/sk_app/VulkanWindowContext.cpp b/tools/viewer/sk_app/VulkanWindowContext.cpp
index 898710f109..4802e214b4 100644
--- a/tools/viewer/sk_app/VulkanWindowContext.cpp
+++ b/tools/viewer/sk_app/VulkanWindowContext.cpp
@@ -171,7 +171,7 @@ bool VulkanWindowContext::createSwapchain(int width, int height,
// Pick our surface format. For now, just make sure it matches our sRGB request:
VkFormat surfaceFormat = VK_FORMAT_UNDEFINED;
VkColorSpaceKHR colorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR;
- auto srgbColorSpace = SkColorSpace::MakeSRGB();
+ auto srgbColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
bool wantSRGB = srgbColorSpace == params.fColorSpace;
for (uint32_t i = 0; i < surfaceFormatCount; ++i) {
GrPixelConfig config;
diff --git a/tools/viewer/sk_app/WindowContext.cpp b/tools/viewer/sk_app/WindowContext.cpp
index 8efe9bd24a..3da8dd1532 100644
--- a/tools/viewer/sk_app/WindowContext.cpp
+++ b/tools/viewer/sk_app/WindowContext.cpp
@@ -43,7 +43,7 @@ sk_sp<SkSurface> WindowContext::createSurface(
fWidth, fHeight,
fDisplayParams.fColorType,
kPremul_SkAlphaType,
- forceSRGB ? SkColorSpace::MakeSRGB()
+ forceSRGB ? SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named)
: fDisplayParams.fColorSpace
);
if (this->isGpuContext()) {
@@ -54,7 +54,7 @@ sk_sp<SkSurface> WindowContext::createSurface(
}
} else {
sk_sp<SkColorSpace> colorSpace = GrPixelConfigIsSRGB(rtDesc->fConfig)
- ? SkColorSpace::MakeSRGB() : nullptr;
+ ? SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named) : nullptr;
return SkSurface::MakeFromBackendRenderTarget(fContext, *rtDesc, colorSpace,
&fSurfaceProps);
}
diff --git a/tools/viewer/sk_app/android/GLWindowContext_android.cpp b/tools/viewer/sk_app/android/GLWindowContext_android.cpp
index 20a76314fd..9f683968c6 100644
--- a/tools/viewer/sk_app/android/GLWindowContext_android.cpp
+++ b/tools/viewer/sk_app/android/GLWindowContext_android.cpp
@@ -102,7 +102,7 @@ void GLWindowContext_android::onInitializeContext() {
EGL_NONE,
};
const EGLint* windowAttribs = nullptr;
- auto srgbColorSpace = SkColorSpace::MakeSRGB();
+ auto srgbColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
if (srgbColorSpace == fDisplayParams.fColorSpace && majorVersion == 1 && minorVersion >= 2) {
windowAttribs = srgbWindowAttribs;
}