diff options
author | Brian Osman <brianosman@google.com> | 2017-11-14 11:13:54 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-11-14 16:33:34 +0000 |
commit | 0387d35f599dca39cb6a5073743c245b3f12ab7d (patch) | |
tree | 8c58a82137fe5318db76be7c1b457438d7959dc0 /gm | |
parent | ccafca0054670b02a02d6d256de490c45e787391 (diff) |
Add SkColorSpace_Base::makeColorSpin
This is a utility that creates a version of an existing XYZ color space
that performs our color spin operation. Assigning this to a source remaps
RGB to GBR. Assigning it to a destination does the opposite (RGB to BRG).
Bug: skia:
Change-Id: I3528698220bd32aa01dcd3db225e60f151a4b5bd
Reviewed-on: https://skia-review.googlesource.com/71280
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'gm')
-rw-r--r-- | gm/color4f.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/gm/color4f.cpp b/gm/color4f.cpp index 2ebe9315a5..36850a1cea 100644 --- a/gm/color4f.cpp +++ b/gm/color4f.cpp @@ -96,11 +96,7 @@ DEF_SIMPLE_GM(color4shader, canvas, 360, 480) { canvas->translate(10, 10); auto srgb = SkColorSpace::MakeSRGB(); - - SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor); - // red -> blue, green -> red, blue -> green (sRGB) - mat.set3x3(0, 0, 1, 1, 0, 0, 0, 1, 0); - mat.postConcat(*as_CSB(srgb)->toXYZD50()); + auto spin = as_CSB(srgb)->makeColorSpin(); // RGB -> GBR const SkColor4f colors[] { { 1, 0, 0, 1 }, @@ -116,8 +112,7 @@ DEF_SIMPLE_GM(color4shader, canvas, 360, 480) { sk_sp<SkShader> shaders[] { SkShader::MakeColorShader(c4, nullptr), SkShader::MakeColorShader(c4, srgb), - SkShader::MakeColorShader(c4, - SkColorSpace::MakeRGB(SkColorSpace::kLinear_RenderTargetGamma, mat)), + SkShader::MakeColorShader(c4, spin), }; canvas->save(); |