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

Unified Diff: src/core/SkXfermodeU64.cpp

Issue 1884683002: SkFloatConvert (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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
« src/core/SkOpts.h ('K') | « src/core/SkOpts.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkXfermodeU64.cpp
diff --git a/src/core/SkXfermodeU64.cpp b/src/core/SkXfermodeU64.cpp
index 630a9d068351f103f22a8d9ccb3770bd18a125eb..eaaa2656f0d2db1a00f71a9f6a7d61bc8caec64e 100644
--- a/src/core/SkXfermodeU64.cpp
+++ b/src/core/SkXfermodeU64.cpp
@@ -211,6 +211,20 @@ template <DstType D> void srcover_n(const SkXfermode*, uint64_t dst[],
}
}
+template <> void srcover_n<kF16_Dst>(const SkXfermode*, uint64_t dst[],
+ const SkPM4f src[], int count, const SkAlpha aa[]) {
+ SkFloatConvert fc;
+ for (int i = 0; i < count; ++i) {
+ Sk4f s = Sk4f::Load(src+i),
+ d = fc.halfToFloat(dst[i]),
+ r = s + d * (1.0f - SkNx_shuffle<3,3,3,3>(s));
+ if (aa) {
+ r = lerp_by_coverage(r, d, aa[i]);
+ }
+ dst[i] = fc.floatToHalf(r);
+ }
+}
+
const SkXfermode::D64Proc gProcs_SrcOver[] = {
srcover_n<kU16_Dst>, src_n<kU16_Dst>,
srcover_1<kU16_Dst>, src_1<kU16_Dst>,
« src/core/SkOpts.h ('K') | « src/core/SkOpts.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698