Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Unified Diff: src/effects/gradients/Sk4fLinearGradient.cpp

Issue 2163683002: Correct sRGB <-> linear everywhere. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix! Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/effects/gradients/Sk4fLinearGradient.cpp
diff --git a/src/effects/gradients/Sk4fLinearGradient.cpp b/src/effects/gradients/Sk4fLinearGradient.cpp
index d22dbff8a170aa797e239a93582200b534eb7f38..a59a805f9f8b61bed78244e657f865a1042f24b1 100644
--- a/src/effects/gradients/Sk4fLinearGradient.cpp
+++ b/src/effects/gradients/Sk4fLinearGradient.cpp
@@ -53,13 +53,15 @@ void ramp<DstType::S32, ApplyPremul::False>(const Sk4f& c, const Sk4f& dc, SkPMC
Sk4x4f c4x = Sk4x4f::Transpose(c, c + dc, c + dc * 2, c + dc * 3);
while (n >= 4) {
- const Sk4x4f cx4s32 = {
- c4x.r.rsqrt().invert(),
- c4x.g.rsqrt().invert(),
- c4x.b.rsqrt().invert(),
- c4x.a
- };
- cx4s32.transpose((uint8_t*)dst);
+ auto r = sk_linear_to_srgb(c4x.r),
+ g = sk_linear_to_srgb(c4x.g),
+ b = sk_linear_to_srgb(c4x.b),
+ a = 255.0f * c4x.a ;
+
+ ( Sk4f_round(r) << 0
+ | Sk4f_round(g) << 8
+ | Sk4f_round(b) << 16
+ | Sk4f_round(a) << 24).store(dst);
c4x.r += dc4x.r;
c4x.g += dc4x.g;

Powered by Google App Engine
This is Rietveld 408576698