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

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

Issue 2046063002: linear -> sRGB: use fast approximate sqrt() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: found another Created 4 years, 6 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
« no previous file with comments | « src/core/SkXfermode4f.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/Sk4fLinearGradient.cpp
diff --git a/src/effects/gradients/Sk4fLinearGradient.cpp b/src/effects/gradients/Sk4fLinearGradient.cpp
index 090bdaa83555ab5dd6a4cf3b279416c075393da1..ca0ca6da60b7b1dcc71672d67ee7bd1b91248e5a 100644
--- a/src/effects/gradients/Sk4fLinearGradient.cpp
+++ b/src/effects/gradients/Sk4fLinearGradient.cpp
@@ -53,7 +53,12 @@ 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.sqrt(), c4x.g.sqrt(), c4x.b.sqrt(), c4x.a };
+ const Sk4x4f cx4s32 = {
+ c4x.r.rsqrt().invert(),
+ c4x.g.rsqrt().invert(),
+ c4x.b.rsqrt().invert(),
+ c4x.a
+ };
cx4s32.transpose((uint8_t*)dst);
c4x.r += dc4x.r;
« no previous file with comments | « src/core/SkXfermode4f.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698