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

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

Issue 1526523003: Unify some SkNx code (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: typo Created 5 years 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/effects/SkColorMatrixFilter.cpp ('k') | src/effects/gradients/SkRadialGradient.cpp » ('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 53264e4d8cf014e384d97eb20577c61addd4fc8c..8760029795fa2af063f2aa0c10838d315db1ed5b 100644
--- a/src/effects/gradients/SkLinearGradient.cpp
+++ b/src/effects/gradients/SkLinearGradient.cpp
@@ -150,7 +150,7 @@ SkLinearGradient::LinearGradientContext::LinearGradientContext(
const Sk4f scale(1, 1, 1, paintAlpha);
for (int i = 0; i < count; ++i) {
uint32_t c = SkSwizzle_Color_to_PMColor(shader.fOrigColors[i]);
- rec[i].fColor = Sk4f::FromBytes((const uint8_t*)&c) * scale;
+ rec[i].fColor = SkNx_cast<float>(Sk4b::Load((const uint8_t*)&c)) * scale;
if (i > 0) {
SkASSERT(rec[i - 1].fPos <= rec[i].fPos);
}
@@ -162,7 +162,7 @@ SkLinearGradient::LinearGradientContext::LinearGradientContext(
for (int i = 0; i < count; ++i) {
SkPMColor pmc = SkPreMultiplyColor(shader.fOrigColors[i]);
pmc = SkAlphaMulQ(pmc, alphaScale);
- rec[i].fColor = Sk4f::FromBytes((const uint8_t*)&pmc);
+ rec[i].fColor = SkNx_cast<float>(Sk4b::Load((const uint8_t*)&pmc));
if (i > 0) {
SkASSERT(rec[i - 1].fPos <= rec[i].fPos);
}
@@ -699,7 +699,7 @@ find_backward(const SkLinearGradient::LinearGradientContext::Rec rec[], float ti
template <bool apply_alpha> SkPMColor trunc_from_255(const Sk4f& x) {
SkPMColor c;
- x.toBytes((uint8_t*)&c);
+ SkNx_cast<uint8_t>(x).store((uint8_t*)&c);
if (apply_alpha) {
c = SkPreMultiplyARGB(SkGetPackedA32(c), SkGetPackedR32(c),
SkGetPackedG32(c), SkGetPackedB32(c));
@@ -751,7 +751,7 @@ template <bool apply_alpha> void ramp(SkPMColor dstC[], int n, const Sk4f& c, co
Sk4f cd3 = cd1 + dc2;
while (n >= 4) {
if (!apply_alpha) {
- Sk4f::ToBytes((uint8_t*)dstC, cd0, cd1, cd2, cd3);
+ Sk4f_ToBytes((uint8_t*)dstC, cd0, cd1, cd2, cd3);
dstC += 4;
} else {
*dstC++ = trunc_from_255<apply_alpha>(cd0);
« no previous file with comments | « src/effects/SkColorMatrixFilter.cpp ('k') | src/effects/gradients/SkRadialGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698