OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "Test.h" | 8 #include "Test.h" |
9 #include "SkFloatBits.h" | 9 #include "SkFloatBits.h" |
10 #include "SkFloatingPoint.h" | 10 #include "SkFloatingPoint.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 // int r0 = blend31(src, dst, a); | 140 // int r0 = blend31(src, dst, a); |
141 // int r0 = blend31_round(src, dst, a); | 141 // int r0 = blend31_round(src, dst, a); |
142 // int r0 = blend31_old(src, dst, a); | 142 // int r0 = blend31_old(src, dst, a); |
143 int r0 = blend31_slow(src, dst, a); | 143 int r0 = blend31_slow(src, dst, a); |
144 | 144 |
145 float f = float_blend(src, dst, a / 31.f); | 145 float f = float_blend(src, dst, a / 31.f); |
146 int r1 = (int)f; | 146 int r1 = (int)f; |
147 int r2 = SkScalarRoundToInt(SkFloatToScalar(f)); | 147 int r2 = SkScalarRoundToInt(SkFloatToScalar(f)); |
148 | 148 |
149 if (r0 != r1 && r0 != r2) { | 149 if (r0 != r1 && r0 != r2) { |
150 printf("src:%d dst:%d a:%d result:%d float:%g\n", | 150 SkDebugf("src:%d dst:%d a:%d result:%d float:%g\n", |
151 src, dst, a, r0, f); | 151 src, dst, a, r0, f); |
152 failed += 1; | 152 failed += 1; |
153 } | 153 } |
154 if (r0 > 255) { | 154 if (r0 > 255) { |
155 death += 1; | 155 death += 1; |
156 printf("death src:%d dst:%d a:%d result:%d float:%g\n", | 156 SkDebugf("death src:%d dst:%d a:%d result:%d float:%g\n", |
157 src, dst, a, r0, f); | 157 src, dst, a, r0, f); |
158 } | 158 } |
159 } | 159 } |
160 } | 160 } |
161 } | 161 } |
162 SkDebugf("---- failed %d death %d\n", failed, death); | 162 SkDebugf("---- failed %d death %d\n", failed, death); |
163 } | 163 } |
164 | 164 |
165 static void test_blend(skiatest::Reporter* reporter) { | 165 static void test_blend(skiatest::Reporter* reporter) { |
166 for (int src = 0; src <= 255; src++) { | 166 for (int src = 0; src <= 255; src++) { |
167 for (int dst = 0; dst <= 255; dst++) { | 167 for (int dst = 0; dst <= 255; dst++) { |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 test_divmod<int16_t>(r); | 755 test_divmod<int16_t>(r); |
756 } | 756 } |
757 | 757 |
758 DEF_TEST(divmod_s32, r) { | 758 DEF_TEST(divmod_s32, r) { |
759 test_divmod<int32_t>(r); | 759 test_divmod<int32_t>(r); |
760 } | 760 } |
761 | 761 |
762 DEF_TEST(divmod_s64, r) { | 762 DEF_TEST(divmod_s64, r) { |
763 test_divmod<int64_t>(r); | 763 test_divmod<int64_t>(r); |
764 } | 764 } |
OLD | NEW |