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

Side by Side Diff: src/core/SkNx.h

Issue 1483953002: Add Sk4f::ToBytes(uint8_t[16], Sk4f, Sk4f, Sk4f, Sk4f) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix neon 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 unified diff | Download patch
« no previous file with comments | « bench/Sk4fBench.cpp ('k') | src/effects/gradients/SkLinearGradient.cpp » ('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 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 SkNx_DEFINED 8 #ifndef SkNx_DEFINED
9 #define SkNx_DEFINED 9 #define SkNx_DEFINED
10 10
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 fLo.store(vals); 106 fLo.store(vals);
107 fHi.store(vals+N/2); 107 fHi.store(vals+N/2);
108 } 108 }
109 // Please see note on FromBytes(). 109 // Please see note on FromBytes().
110 // Clamps to [0.0,255.0] floats and truncates to [0,255] bytes. 110 // Clamps to [0.0,255.0] floats and truncates to [0,255] bytes.
111 void toBytes(uint8_t bytes[N]) const { 111 void toBytes(uint8_t bytes[N]) const {
112 fLo.toBytes(bytes); 112 fLo.toBytes(bytes);
113 fHi.toBytes(bytes+N/2); 113 fHi.toBytes(bytes+N/2);
114 } 114 }
115 115
116 // Some implementations can do this faster.
117 static void ToBytes(uint8_t bytes[4*N],
118 const SkNx& a, const SkNx& b, const SkNx& c, const SkNx& d) {
119 a.toBytes(bytes+0*N);
120 b.toBytes(bytes+1*N);
121 c.toBytes(bytes+2*N);
122 d.toBytes(bytes+3*N);
123 }
124
116 SkNx operator + (const SkNx& o) const { return SkNx(fLo + o.fLo, fHi + o.fHi ); } 125 SkNx operator + (const SkNx& o) const { return SkNx(fLo + o.fLo, fHi + o.fHi ); }
117 SkNx operator - (const SkNx& o) const { return SkNx(fLo - o.fLo, fHi - o.fHi ); } 126 SkNx operator - (const SkNx& o) const { return SkNx(fLo - o.fLo, fHi - o.fHi ); }
118 SkNx operator * (const SkNx& o) const { return SkNx(fLo * o.fLo, fHi * o.fHi ); } 127 SkNx operator * (const SkNx& o) const { return SkNx(fLo * o.fLo, fHi * o.fHi ); }
119 SkNx operator / (const SkNx& o) const { return SkNx(fLo / o.fLo, fHi / o.fHi ); } 128 SkNx operator / (const SkNx& o) const { return SkNx(fLo / o.fLo, fHi / o.fHi ); }
120 129
121 SkNx operator == (const SkNx& o) const { return SkNx(fLo == o.fLo, fHi == o. fHi); } 130 SkNx operator == (const SkNx& o) const { return SkNx(fLo == o.fLo, fHi == o. fHi); }
122 SkNx operator != (const SkNx& o) const { return SkNx(fLo != o.fLo, fHi != o. fHi); } 131 SkNx operator != (const SkNx& o) const { return SkNx(fLo != o.fLo, fHi != o. fHi); }
123 SkNx operator < (const SkNx& o) const { return SkNx(fLo < o.fLo, fHi < o. fHi); } 132 SkNx operator < (const SkNx& o) const { return SkNx(fLo < o.fLo, fHi < o. fHi); }
124 SkNx operator > (const SkNx& o) const { return SkNx(fLo > o.fLo, fHi > o. fHi); } 133 SkNx operator > (const SkNx& o) const { return SkNx(fLo > o.fLo, fHi > o. fHi); }
125 SkNx operator <= (const SkNx& o) const { return SkNx(fLo <= o.fLo, fHi <= o. fHi); } 134 SkNx operator <= (const SkNx& o) const { return SkNx(fLo <= o.fLo, fHi <= o. fHi); }
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 typedef SkNx<8, float> Sk8f; 327 typedef SkNx<8, float> Sk8f;
319 typedef SkNx<8, float> Sk8s; 328 typedef SkNx<8, float> Sk8s;
320 329
321 typedef SkNx<8, uint16_t> Sk8h; 330 typedef SkNx<8, uint16_t> Sk8h;
322 typedef SkNx<16, uint16_t> Sk16h; 331 typedef SkNx<16, uint16_t> Sk16h;
323 typedef SkNx<16, uint8_t> Sk16b; 332 typedef SkNx<16, uint8_t> Sk16b;
324 333
325 typedef SkNx<4, int> Sk4i; 334 typedef SkNx<4, int> Sk4i;
326 335
327 #endif//SkNx_DEFINED 336 #endif//SkNx_DEFINED
OLDNEW
« no previous file with comments | « bench/Sk4fBench.cpp ('k') | src/effects/gradients/SkLinearGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698