OLD | NEW |
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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Sk4f s = Sk4f::Load(src+i), |
138 d = SkHalfToFloat_01(dst+i), | 138 d = SkHalfToFloat_01(dst[i]), |
139 r = s + d*(1.0f - SkNx_shuffle<3,3,3,3>(s)); | 139 r = s + d*(1.0f - SkNx_shuffle<3,3,3,3>(s)); |
140 if (aa) { | 140 if (aa) { |
141 r = lerp_by_coverage(r, d, aa[i]); | 141 r = lerp_by_coverage(r, d, aa[i]); |
142 } | 142 } |
143 SkFloatToHalf_01(r, dst+i); | 143 dst[i] = SkFloatToHalf_01(r); |
144 } | 144 } |
145 } | 145 } |
146 | 146 |
147 const SkXfermode::F16Proc gProcs_SrcOver[] = { srcover_n, src_n, srcover_1, src_
1 }; | 147 const SkXfermode::F16Proc gProcs_SrcOver[] = { srcover_n, src_n, srcover_1, src_
1 }; |
148 | 148 |
149 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 149 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
150 | 150 |
151 static SkXfermode::F16Proc find_proc(SkXfermode::Mode mode, uint32_t flags) { | 151 static SkXfermode::F16Proc find_proc(SkXfermode::Mode mode, uint32_t flags) { |
152 SkASSERT(0 == (flags & ~3)); | 152 SkASSERT(0 == (flags & ~3)); |
153 flags &= 3; | 153 flags &= 3; |
(...skipping 13 matching lines...) Expand all Loading... |
167 SkASSERT(0 == (flags & ~3)); | 167 SkASSERT(0 == (flags & ~3)); |
168 flags &= 3; | 168 flags &= 3; |
169 | 169 |
170 Mode mode; | 170 Mode mode; |
171 return this->asMode(&mode) ? find_proc(mode, flags) : gProcs_General[flags]; | 171 return this->asMode(&mode) ? find_proc(mode, flags) : gProcs_General[flags]; |
172 } | 172 } |
173 | 173 |
174 SkXfermode::F16Proc SkXfermode::GetF16Proc(SkXfermode* xfer, uint32_t flags) { | 174 SkXfermode::F16Proc SkXfermode::GetF16Proc(SkXfermode* xfer, uint32_t flags) { |
175 return xfer ? xfer->onGetF16Proc(flags) : find_proc(SkXfermode::kSrcOver_Mod
e, flags); | 175 return xfer ? xfer->onGetF16Proc(flags) : find_proc(SkXfermode::kSrcOver_Mod
e, flags); |
176 } | 176 } |
OLD | NEW |