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

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

Issue 1035583002: Update 4-at-a-time APIs. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: (C) Created 5 years, 9 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/SkPMFloat_neon.h ('k') | tests/PMFloatTest.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 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
1 inline SkPMFloat& SkPMFloat::operator=(const SkPMFloat& that) { 8 inline SkPMFloat& SkPMFloat::operator=(const SkPMFloat& that) {
2 for (int i = 0; i < 4; i++) { fColor[i] = that.fColor[i]; } 9 for (int i = 0; i < 4; i++) { fColor[i] = that.fColor[i]; }
3 return *this; 10 return *this;
4 } 11 }
5 12
6 inline SkPMFloat::SkPMFloat(SkPMColor c) { 13 inline SkPMFloat::SkPMFloat(SkPMColor c) {
7 *this = SkPMFloat::FromARGB(SkGetPackedA32(c), 14 *this = SkPMFloat::FromARGB(SkGetPackedA32(c),
8 SkGetPackedR32(c), 15 SkGetPackedR32(c),
9 SkGetPackedG32(c), 16 SkGetPackedG32(c),
10 SkGetPackedB32(c)); 17 SkGetPackedB32(c));
(...skipping 10 matching lines...) Expand all
21 r = this->r(), 28 r = this->r(),
22 g = this->g(), 29 g = this->g(),
23 b = this->b(); 30 b = this->b();
24 a = a < 0 ? 0 : (a > 255 ? 255 : a); 31 a = a < 0 ? 0 : (a > 255 ? 255 : a);
25 r = r < 0 ? 0 : (r > 255 ? 255 : r); 32 r = r < 0 ? 0 : (r > 255 ? 255 : r);
26 g = g < 0 ? 0 : (g > 255 ? 255 : g); 33 g = g < 0 ? 0 : (g > 255 ? 255 : g);
27 b = b < 0 ? 0 : (b > 255 ? 255 : b); 34 b = b < 0 ? 0 : (b > 255 ? 255 : b);
28 return SkPackARGB32(a+0.5f, r+0.5f, g+0.5f, b+0.5f); 35 return SkPackARGB32(a+0.5f, r+0.5f, g+0.5f, b+0.5f);
29 } 36 }
30 37
31 inline void SkPMFloat::From4PMColors(SkPMFloat floats[4], const SkPMColor colors [4]) { 38 inline void SkPMFloat::From4PMColors(const SkPMColor colors[4],
32 for (int i = 0; i < 4; i++) { floats[i] = FromPMColor(colors[i]); } 39 SkPMFloat* a, SkPMFloat* b, SkPMFloat* c, S kPMFloat* d) {
40 *a = FromPMColor(colors[0]);
41 *b = FromPMColor(colors[1]);
42 *c = FromPMColor(colors[2]);
43 *d = FromPMColor(colors[3]);
33 } 44 }
34 45
35 inline void SkPMFloat::To4PMColors(SkPMColor colors[4], const SkPMFloat floats[4 ]) { 46 inline void SkPMFloat::To4PMColors(
36 for (int i = 0; i < 4; i++) { colors[i] = floats[i].get(); } 47 const SkPMFloat& a, const SkPMFloat& b, const SkPMFloat&c, const SkPMFlo at& d,
48 SkPMColor colors[4]) {
49 colors[0] = a.get();
50 colors[1] = b.get();
51 colors[2] = c.get();
52 colors[3] = d.get();
37 } 53 }
38 54
39 inline void SkPMFloat::ClampTo4PMColors(SkPMColor colors[4], const SkPMFloat flo ats[4]) { 55 inline void SkPMFloat::ClampTo4PMColors(
40 for (int i = 0; i < 4; i++) { colors[i] = floats[i].clamped(); } 56 const SkPMFloat& a, const SkPMFloat& b, const SkPMFloat&c, const SkPMFlo at& d,
57 SkPMColor colors[4]) {
58 colors[0] = a.clamped();
59 colors[1] = b.clamped();
60 colors[2] = c.clamped();
61 colors[3] = d.clamped();
41 } 62 }
OLDNEW
« no previous file with comments | « src/opts/SkPMFloat_neon.h ('k') | tests/PMFloatTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698