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

Side by Side Diff: src/opts/SkXfermode_opts.h

Issue 1301413006: SkNx_shuffle (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: dup Created 5 years, 3 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/opts/SkColorCubeFilter_opts.h ('k') | no next file » | 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 2015 Google Inc. 2 * Copyright 2015 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 #ifndef Sk4pxXfermode_DEFINED 8 #ifndef Sk4pxXfermode_DEFINED
9 #define Sk4pxXfermode_DEFINED 9 #define Sk4pxXfermode_DEFINED
10 10
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 #undef XFERMODE 110 #undef XFERMODE
111 111
112 // Some xfermodes use math like divide or sqrt that's best done in floats 1 pixe l at a time. 112 // Some xfermodes use math like divide or sqrt that's best done in floats 1 pixe l at a time.
113 #define XFERMODE(Name) static Sk4f SK_VECTORCALL Name(Sk4f d, Sk4f s) 113 #define XFERMODE(Name) static Sk4f SK_VECTORCALL Name(Sk4f d, Sk4f s)
114 114
115 static inline Sk4f a_rgb(const Sk4f& a, const Sk4f& rgb) { 115 static inline Sk4f a_rgb(const Sk4f& a, const Sk4f& rgb) {
116 static_assert(SK_A32_SHIFT == 24, ""); 116 static_assert(SK_A32_SHIFT == 24, "");
117 return a * Sk4f(0,0,0,1) + rgb * Sk4f(1,1,1,0); 117 return a * Sk4f(0,0,0,1) + rgb * Sk4f(1,1,1,0);
118 } 118 }
119 static inline Sk4f alphas(const Sk4f& f) { 119 static inline Sk4f alphas(const Sk4f& f) {
120 return Sk4f(f.kth<SK_A32_SHIFT/8>()); 120 return SkNx_dup<SK_A32_SHIFT/8>(f);
121 } 121 }
122 122
123 XFERMODE(ColorDodge) { 123 XFERMODE(ColorDodge) {
124 auto sa = alphas(s), 124 auto sa = alphas(s),
125 da = alphas(d), 125 da = alphas(d),
126 isa = Sk4f(1)-sa, 126 isa = Sk4f(1)-sa,
127 ida = Sk4f(1)-da; 127 ida = Sk4f(1)-da;
128 128
129 auto srcover = s + d*isa, 129 auto srcover = s + d*isa,
130 dstover = d + s*ida, 130 dstover = d + s*ida,
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 #undef CASE 330 #undef CASE
331 331
332 default: break; 332 default: break;
333 } 333 }
334 return nullptr; 334 return nullptr;
335 } 335 }
336 336
337 } // namespace SK_OPTS_NS 337 } // namespace SK_OPTS_NS
338 338
339 #endif//Sk4pxXfermode_DEFINED 339 #endif//Sk4pxXfermode_DEFINED
OLDNEW
« no previous file with comments | « src/opts/SkColorCubeFilter_opts.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698