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

Side by Side Diff: src/core/SkXfermodeF16.cpp

Issue 1897433002: Revert of skcpu: sse4.1 floor, f16c f16<->f32 (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 unified diff | Download patch
« no previous file with comments | « src/core/SkHalf.h ('k') | src/opts/SkNx_sse.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkHalf.h" 8 #include "SkHalf.h"
9 #include "SkPM4fPriv.h" 9 #include "SkPM4fPriv.h"
10 #include "SkUtils.h" 10 #include "SkUtils.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 dst[i] = SkFloatToHalf_01(lerp_by_coverage(r4, d4, aa[i])); 127 dst[i] = SkFloatToHalf_01(lerp_by_coverage(r4, d4, aa[i]));
128 } else { 128 } else {
129 dst[i] = SkFloatToHalf_01(r4); 129 dst[i] = SkFloatToHalf_01(r4);
130 } 130 }
131 } 131 }
132 } 132 }
133 133
134 static void srcover_n(const SkXfermode*, uint64_t dst[], const SkPM4f src[], int count, 134 static void srcover_n(const SkXfermode*, uint64_t dst[], const SkPM4f src[], int count,
135 const SkAlpha aa[]) { 135 const SkAlpha aa[]) {
136 for (int i = 0; i < count; ++i) { 136 for (int i = 0; i < count; ++i) {
137 Sk4f s = Sk4f::Load(src+i), 137 const Sk4f s4 = Sk4f::Load(src[i].fVec);
138 d = SkHalfToFloat_01(dst+i), 138 const Sk4f dst_scale = Sk4f(1 - get_alpha(s4));
139 r = s + d*(1.0f - SkNx_shuffle<3,3,3,3>(s)); 139 const Sk4f d4 = SkHalfToFloat_01(dst[i]);
140 const Sk4f r4 = s4 + d4 * dst_scale;
140 if (aa) { 141 if (aa) {
141 r = lerp_by_coverage(r, d, aa[i]); 142 dst[i] = SkFloatToHalf_01(lerp_by_coverage(r4, d4, aa[i]));
143 } else {
144 dst[i] = SkFloatToHalf_01(r4);
142 } 145 }
143 SkFloatToHalf_01(r, dst+i);
144 } 146 }
145 } 147 }
146 148
147 const SkXfermode::F16Proc gProcs_SrcOver[] = { srcover_n, src_n, srcover_1, src_ 1 }; 149 const SkXfermode::F16Proc gProcs_SrcOver[] = { srcover_n, src_n, srcover_1, src_ 1 };
148 150
149 //////////////////////////////////////////////////////////////////////////////// /////////////////// 151 //////////////////////////////////////////////////////////////////////////////// ///////////////////
150 152
151 static SkXfermode::F16Proc find_proc(SkXfermode::Mode mode, uint32_t flags) { 153 static SkXfermode::F16Proc find_proc(SkXfermode::Mode mode, uint32_t flags) {
152 SkASSERT(0 == (flags & ~3)); 154 SkASSERT(0 == (flags & ~3));
153 flags &= 3; 155 flags &= 3;
(...skipping 13 matching lines...) Expand all
167 SkASSERT(0 == (flags & ~3)); 169 SkASSERT(0 == (flags & ~3));
168 flags &= 3; 170 flags &= 3;
169 171
170 Mode mode; 172 Mode mode;
171 return this->asMode(&mode) ? find_proc(mode, flags) : gProcs_General[flags]; 173 return this->asMode(&mode) ? find_proc(mode, flags) : gProcs_General[flags];
172 } 174 }
173 175
174 SkXfermode::F16Proc SkXfermode::GetF16Proc(SkXfermode* xfer, uint32_t flags) { 176 SkXfermode::F16Proc SkXfermode::GetF16Proc(SkXfermode* xfer, uint32_t flags) {
175 return xfer ? xfer->onGetF16Proc(flags) : find_proc(SkXfermode::kSrcOver_Mod e, flags); 177 return xfer ? xfer->onGetF16Proc(flags) : find_proc(SkXfermode::kSrcOver_Mod e, flags);
176 } 178 }
OLDNEW
« no previous file with comments | « src/core/SkHalf.h ('k') | src/opts/SkNx_sse.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698