aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkLinearBitmapPipeline_sample.h
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2016-07-20 18:10:07 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-20 18:10:07 -0700
commit0c902473d64ef935a64d078f70bdc9334ab51427 (patch)
tree09a423ffe65a60d3571372d455df64068ac754a7 /src/core/SkLinearBitmapPipeline_sample.h
parent456bf30d321292da7f15d1af35fd94fbb6a4bb59 (diff)
Correct sRGB <-> linear everywhere.
This trims the SkPM4fPriv methods down to just foolproof methods. (Anything trying to build these itself is probably wrong.) Things like Sk4f srgb_to_linear(Sk4f) can't really exist anymore, at least not efficiently, so this refactor is somewhat more invasive than you might think. Generally this means things using to_4f() are also making a misstep... that's gone too. It also does not make sense to try to play games with linear floats with 255 bias any more. That hack can't work with real sRGB coding. Rather than update them, I've removed a couple of L32 xfermode fast paths. I'd even rather drop it entirely... BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2163683002 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Review-Url: https://codereview.chromium.org/2163683002
Diffstat (limited to 'src/core/SkLinearBitmapPipeline_sample.h')
-rw-r--r--src/core/SkLinearBitmapPipeline_sample.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/core/SkLinearBitmapPipeline_sample.h b/src/core/SkLinearBitmapPipeline_sample.h
index 86ad6e146f..759075b3e5 100644
--- a/src/core/SkLinearBitmapPipeline_sample.h
+++ b/src/core/SkLinearBitmapPipeline_sample.h
@@ -170,11 +170,10 @@ public:
PixelConverter(const SkPixmap& srcPixmap) { }
Sk4f toSk4f(Element pixel) const {
- float gray = pixel * (1.0f/255.0f);
- Sk4f result = Sk4f{gray, gray, gray, 1.0f};
- return gammaType == kSRGB_SkGammaType
- ? srgb_to_linear(result)
- : result;
+ float gray = (gammaType == kSRGB_SkGammaType)
+ ? sk_linear_from_srgb[pixel]
+ : pixel * (1/255.0f);
+ return {gray, gray, gray, 1.0f};
}
};