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 #include "Sk4px.h" | 8 #include "Sk4px.h" |
9 #include "SkNx.h" | 9 #include "SkNx.h" |
10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 SkPreMultiplyColor(0x00000000), | 201 SkPreMultiplyColor(0x00000000), |
202 }; | 202 }; |
203 auto packed = Sk4px::Load4(colors); | 203 auto packed = Sk4px::Load4(colors); |
204 | 204 |
205 auto wideLo = packed.widenLo(), | 205 auto wideLo = packed.widenLo(), |
206 wideHi = packed.widenHi(), | 206 wideHi = packed.widenHi(), |
207 wideLoHi = packed.widenLoHi(), | 207 wideLoHi = packed.widenLoHi(), |
208 wideLoHiAlt = wideLo + wideHi; | 208 wideLoHiAlt = wideLo + wideHi; |
209 REPORTER_ASSERT(r, 0 == memcmp(&wideLoHi, &wideLoHiAlt, sizeof(wideLoHi))); | 209 REPORTER_ASSERT(r, 0 == memcmp(&wideLoHi, &wideLoHiAlt, sizeof(wideLoHi))); |
210 } | 210 } |
211 | |
212 DEF_TEST(Sk4f_clamps, r) { | |
213 uint8_t bytes[4]; | |
214 Sk4f(-2.0f, -0.7f, 255.9f, 256.0f).toBytes(bytes); | |
215 REPORTER_ASSERT(r, bytes[0] == 0); | |
216 REPORTER_ASSERT(r, bytes[1] == 0); | |
217 REPORTER_ASSERT(r, bytes[2] == 255); | |
218 REPORTER_ASSERT(r, bytes[3] == 255); | |
Noel Gordon
2015/09/01 12:58:31
Thanks for the clamp test. Perhaps add a +0.7f te
mtklein_C
2015/09/01 13:01:15
Done.
| |
219 } | |
OLD | NEW |