diff --git a/gm/color4f.cpp b/gm/color4f.cpp index 715229d207..c1535cc629 100644 --- a/gm/color4f.cpp +++ b/gm/color4f.cpp @@ -8,6 +8,7 @@ #include "gm.h" #include "SkCanvas.h" #include "SkColorPriv.h" +#include "SkColorSpace_Base.h" #include "SkShader.h" #include "SkSurface.h" @@ -91,12 +92,15 @@ DEF_SIMPLE_GM(color4f, canvas, 1024, 260) { /////////////////////////////////////////////////////////////////////////////////////////////////// #include "SkColorSpace.h" -DEF_SIMPLE_GM(color4shader, canvas, 1024, 260) { +DEF_SIMPLE_GM(color4shader, canvas, 360, 480) { canvas->translate(10, 10); + auto srgb = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named); + SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor); - // red -> blue, green -> red, blue -> green + // red -> blue, green -> red, blue -> green (sRGB) mat.set3x3(0, 0, 1, 1, 0, 0, 0, 1, 0); + mat.postConcat(*as_CSB(srgb)->toXYZD50()); const SkColor4f colors[] { { 1, 0, 0, 1 }, @@ -111,7 +115,7 @@ DEF_SIMPLE_GM(color4shader, canvas, 1024, 260) { for (const auto& c4 : colors) { sk_sp shaders[] { SkShader::MakeColorShader(c4, nullptr), - SkShader::MakeColorShader(c4, SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named)), + SkShader::MakeColorShader(c4, srgb), SkShader::MakeColorShader(c4, SkColorSpace::MakeRGB(SkColorSpace::kLinear_RenderTargetGamma, mat)), };