diff options
author | Mike Klein <mtklein@chromium.org> | 2017-10-31 11:59:52 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-10-31 16:43:24 +0000 |
commit | 5b9a037bf41591e0076843f619ee47c9ad30e42d (patch) | |
tree | 72a16cab98209b9de87dd94ed4ec2eb41e985f73 /dm/DM.cpp | |
parent | b1fc36829de69da5376019403fdd649c06f4cf1b (diff) |
gbr- has been brg- this whole time...
Rewrite things to make that a little clearer.
A red pixel ends up in channel 2, what would naively draw as blue
without a rotation. A green pixel ends up in channel 0, which would
naively draw as red without rotation. A blue pixel ends up in channel
1, which would naively draw as green without this rotation.
So this transformation is:
r -> b
g -> r
b -> g
i.e. rgb_to_brg
Change-Id: I12331ff2622194e34a44f421f656fbe4db5d3dca
Reviewed-on: https://skia-review.googlesource.com/65521
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Diffstat (limited to 'dm/DM.cpp')
-rw-r--r-- | dm/DM.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
@@ -912,26 +912,22 @@ static sk_sp<SkColorSpace> adobe_rgb() { SkColorSpace::kAdobeRGB_Gamut); } -static sk_sp<SkColorSpace> rgb_to_gbr() { - float gbr[9]; - gbr[0] = gSRGB_toXYZD50[1]; - gbr[1] = gSRGB_toXYZD50[2]; - gbr[2] = gSRGB_toXYZD50[0]; - gbr[3] = gSRGB_toXYZD50[4]; - gbr[4] = gSRGB_toXYZD50[5]; - gbr[5] = gSRGB_toXYZD50[3]; - gbr[6] = gSRGB_toXYZD50[7]; - gbr[7] = gSRGB_toXYZD50[8]; - gbr[8] = gSRGB_toXYZD50[6]; +static sk_sp<SkColorSpace> rgb_to_brg() { + auto m = gSRGB_toXYZD50; + float brg[9] = { + m[1], m[2], m[0], + m[4], m[5], m[3], + m[7], m[8], m[6], + }; SkMatrix44 toXYZD50(SkMatrix44::kUninitialized_Constructor); - toXYZD50.set3x3RowMajorf(gbr); + toXYZD50.set3x3RowMajorf(brg); return SkColorSpace::MakeRGB(SkColorSpace::kSRGB_RenderTargetGamma, toXYZD50); } static Sink* create_via(const SkString& tag, Sink* wrapped) { #define VIA(t, via, ...) if (tag.equals(t)) { return new via(__VA_ARGS__); } VIA("adobe", ViaCSXform, wrapped, adobe_rgb(), false); - VIA("gbr", ViaCSXform, wrapped, rgb_to_gbr(), true); + VIA("brg", ViaCSXform, wrapped, rgb_to_brg(), true); VIA("lite", ViaLite, wrapped); VIA("pipe", ViaPipe, wrapped); VIA("twice", ViaTwice, wrapped); |