OLD | NEW |
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 namespace { // See SkPMFloat.h |
| 9 |
8 // For SkPMFloat(SkPMFColor), we widen our 8 bit components (fix8) to 8-bit comp
onents in 16 bits | 10 // For SkPMFloat(SkPMFColor), we widen our 8 bit components (fix8) to 8-bit comp
onents in 16 bits |
9 // (fix8_16), then widen those to 8-bit-in-32-bits (fix8_32), and finally conver
t those to floats. | 11 // (fix8_16), then widen those to 8-bit-in-32-bits (fix8_32), and finally conver
t those to floats. |
10 | 12 |
11 // round() and roundClamp() do the opposite, working from floats to 8-bit-in-32-
bit, | 13 // round() and roundClamp() do the opposite, working from floats to 8-bit-in-32-
bit, |
12 // to 8-bit-in-16-bit, back down to 8-bit components. | 14 // to 8-bit-in-16-bit, back down to 8-bit components. |
13 // roundClamp() uses vqmovn to clamp while narrowing instead of just narrowing w
ith vmovn. | 15 // roundClamp() uses vqmovn to clamp while narrowing instead of just narrowing w
ith vmovn. |
14 | 16 |
15 inline SkPMFloat::SkPMFloat(SkPMColor c) { | 17 inline SkPMFloat::SkPMFloat(SkPMColor c) { |
16 SkPMColorAssert(c); | 18 SkPMColorAssert(c); |
17 uint8x8_t fix8 = (uint8x8_t)vdup_n_u32(c); | 19 uint8x8_t fix8 = (uint8x8_t)vdup_n_u32(c); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } | 65 } |
64 | 66 |
65 inline void SkPMFloat::RoundClampTo4PMColors( | 67 inline void SkPMFloat::RoundClampTo4PMColors( |
66 const SkPMFloat& a, const SkPMFloat& b, const SkPMFloat&c, const SkPMFlo
at& d, | 68 const SkPMFloat& a, const SkPMFloat& b, const SkPMFloat&c, const SkPMFlo
at& d, |
67 SkPMColor colors[4]) { | 69 SkPMColor colors[4]) { |
68 colors[0] = a.roundClamp(); | 70 colors[0] = a.roundClamp(); |
69 colors[1] = b.roundClamp(); | 71 colors[1] = b.roundClamp(); |
70 colors[2] = c.roundClamp(); | 72 colors[2] = c.roundClamp(); |
71 colors[3] = d.roundClamp(); | 73 colors[3] = d.roundClamp(); |
72 } | 74 } |
| 75 |
| 76 } // namespace |
OLD | NEW |