aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2018-07-11 13:56:06 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-11 18:34:08 +0000
commit3ae98ffc96fe410f8594dbd7160c05c5ebd6de57 (patch)
tree04455876d5563ac96bc482c68b2bc2ea29e8d681
parentad77dce5e145b684b826238b8c65d89f6cce60a6 (diff)
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>
-rw-r--r--src/core/SkColorSpaceXformSteps.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/SkColorSpaceXformSteps.cpp b/src/core/SkColorSpaceXformSteps.cpp
index d2f3881a1d..77a9c6b05d 100644
--- a/src/core/SkColorSpaceXformSteps.cpp
+++ b/src/core/SkColorSpaceXformSteps.cpp
@@ -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);