might as well use SkRasterPipeline::gamma too

This is a pretty good speedup over parametric_* when we hit it.
It's both less math and fewer stages to hop through.

Change-Id: I97b6e6b6c290441238f0f61bea47786eacc2a9c7
Reviewed-on: https://skia-review.googlesource.com/140569
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
Mike Klein 2018-07-11 13:56:06 -04:00 committed by Skia Commit-Bot
parent ad77dce5e1
commit 3ae98ffc96

View File

@ -107,6 +107,13 @@ void SkColorSpaceXformSteps::apply(SkRasterPipeline* p) const {
if (flags.linearize) {
if (srcTF_is_sRGB) {
p->append(SkRasterPipeline::from_srgb);
} else if (srcTF.fA == 1 &&
srcTF.fB == 0 &&
srcTF.fC == 0 &&
srcTF.fD == 0 &&
srcTF.fE == 0 &&
srcTF.fF == 0) {
p->append(SkRasterPipeline::gamma, &srcTF.fG);
} else {
p->append(SkRasterPipeline::parametric_r, &srcTF);
p->append(SkRasterPipeline::parametric_g, &srcTF);
@ -119,6 +126,13 @@ void SkColorSpaceXformSteps::apply(SkRasterPipeline* p) const {
if (flags.encode) {
if (dstTF_is_sRGB) {
p->append(SkRasterPipeline::to_srgb);
} else if (dstTFInv.fA == 1 &&
dstTFInv.fB == 0 &&
dstTFInv.fC == 0 &&
dstTFInv.fD == 0 &&
dstTFInv.fE == 0 &&
dstTFInv.fF == 0) {
p->append(SkRasterPipeline::gamma, &dstTFInv.fG);
} else {
p->append(SkRasterPipeline::parametric_r, &dstTFInv);
p->append(SkRasterPipeline::parametric_g, &dstTFInv);