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

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

Issue 1483953002: Add Sk4f::ToBytes(uint8_t[16], Sk4f, Sk4f, Sk4f, Sk4f) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix neon Created 5 years, 1 month 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/SkNx.h ('k') | src/opts/SkNx_neon.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/SkLinearGradient.cpp
diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp
index f47b6ab30e7fa81392abd02afe9a5a89f38d687c..b22447453679a63ee0025cd961a1b44da152f9c4 100644
--- a/src/effects/gradients/SkLinearGradient.cpp
+++ b/src/effects/gradients/SkLinearGradient.cpp
@@ -748,10 +748,15 @@ template <bool apply_alpha> void ramp(SkPMColor dstC[], int n, const Sk4f& c, co
Sk4f cd2 = cd0 + dc2;
Sk4f cd3 = cd1 + dc2;
while (n >= 4) {
- *dstC++ = trunc_from_255<apply_alpha>(cd0);
- *dstC++ = trunc_from_255<apply_alpha>(cd1);
- *dstC++ = trunc_from_255<apply_alpha>(cd2);
- *dstC++ = trunc_from_255<apply_alpha>(cd3);
+ if (!apply_alpha) {
+ Sk4f::ToBytes((uint8_t*)dstC, cd0, cd1, cd2, cd3);
+ dstC += 4;
+ } else {
+ *dstC++ = trunc_from_255<apply_alpha>(cd0);
+ *dstC++ = trunc_from_255<apply_alpha>(cd1);
+ *dstC++ = trunc_from_255<apply_alpha>(cd2);
+ *dstC++ = trunc_from_255<apply_alpha>(cd3);
+ }
cd0 = cd0 + dc4;
cd1 = cd1 + dc4;
cd2 = cd2 + dc4;
@@ -861,7 +866,7 @@ void SkLinearGradient::LinearGradientContext::shade4_dx_clamp(SkPMColor dstC[],
ramp<apply_alpha>(dstC, n, c, dc, dither0, dither1);
dstC += n;
SkASSERT(dstC <= endDstC);
-
+
if (n & 1) {
SkTSwap(dither0, dither1);
}
« no previous file with comments | « src/core/SkNx.h ('k') | src/opts/SkNx_neon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698