OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkColorPriv.h" | 8 #include "SkColorPriv.h" |
9 #include "SkXfermode.h" | 9 #include "SkXfermode.h" |
10 #include "Test.h" | 10 #include "Test.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 int opaqueCounter2 = 0; | 35 int opaqueCounter2 = 0; |
36 for (i = 0; i <= 255; i++) { | 36 for (i = 0; i <= 255; i++) { |
37 unsigned result0 = test_srcover0(0xFF, i); | 37 unsigned result0 = test_srcover0(0xFF, i); |
38 unsigned result1 = test_srcover1(0xFF, i); | 38 unsigned result1 = test_srcover1(0xFF, i); |
39 unsigned result2 = test_srcover2(0xFF, i); | 39 unsigned result2 = test_srcover2(0xFF, i); |
40 opaqueCounter0 += (result0 == 0xFF); | 40 opaqueCounter0 += (result0 == 0xFF); |
41 opaqueCounter1 += (result1 == 0xFF); | 41 opaqueCounter1 += (result1 == 0xFF); |
42 opaqueCounter2 += (result2 == 0xFF); | 42 opaqueCounter2 += (result2 == 0xFF); |
43 } | 43 } |
44 #if 0 | 44 #if 0 |
45 SkDebugf("---- opaque test: [%d %d %d]\n", | 45 INFOF(reporter, "---- opaque test: [%d %d %d]\n", |
46 opaqueCounter0, opaqueCounter1, opaqueCounter2); | 46 opaqueCounter0, opaqueCounter1, opaqueCounter2); |
47 #endif | 47 #endif |
48 // we acknowledge that technique0 does not always return opaque | 48 // we acknowledge that technique0 does not always return opaque |
49 REPORTER_ASSERT(reporter, opaqueCounter0 == 256); | 49 REPORTER_ASSERT(reporter, opaqueCounter0 == 256); |
50 REPORTER_ASSERT(reporter, opaqueCounter1 == 256); | 50 REPORTER_ASSERT(reporter, opaqueCounter1 == 256); |
51 REPORTER_ASSERT(reporter, opaqueCounter2 == 256); | 51 REPORTER_ASSERT(reporter, opaqueCounter2 == 256); |
52 | 52 |
53 // Now ensure that we never over/underflow a byte | 53 // Now ensure that we never over/underflow a byte |
54 for (i = 0; i <= 255; i++) { | 54 for (i = 0; i <= 255; i++) { |
55 for (unsigned dst = 0; dst <= 255; dst++) { | 55 for (unsigned dst = 0; dst <= 255; dst++) { |
56 unsigned r0 = test_srcover0(dst, i); | 56 unsigned r0 = test_srcover0(dst, i); |
57 unsigned r1 = test_srcover1(dst, i); | 57 unsigned r1 = test_srcover1(dst, i); |
58 unsigned r2 = test_srcover2(dst, i); | 58 unsigned r2 = test_srcover2(dst, i); |
59 unsigned max = SkMax32(dst, i); | 59 unsigned max = SkMax32(dst, i); |
60 // ignore the known failure | 60 // ignore the known failure |
61 if (dst != 255) { | 61 if (dst != 255) { |
62 REPORTER_ASSERT(reporter, r0 <= 255 && r0 >= max); | 62 REPORTER_ASSERT(reporter, r0 <= 255 && r0 >= max); |
63 } | 63 } |
64 REPORTER_ASSERT(reporter, r1 <= 255 && r1 >= max); | 64 REPORTER_ASSERT(reporter, r1 <= 255 && r1 >= max); |
65 REPORTER_ASSERT(reporter, r2 <= 255 && r2 >= max); | 65 REPORTER_ASSERT(reporter, r2 <= 255 && r2 >= max); |
66 | 66 |
67 #if 0 | 67 #if 0 |
68 // this shows where r1 (faster) differs from r2 (more exact) | 68 // this shows where r1 (faster) differs from r2 (more exact) |
69 if (r1 != r2) { | 69 if (r1 != r2) { |
70 SkDebugf("--- dst=%d i=%d r1=%d r2=%d exact=%g\n", | 70 INFOF(reporter, "--- dst=%d i=%d r1=%d r2=%d exact=%g\n", |
71 dst, i, r1, r2, i + dst - dst*i/255.0f); | 71 dst, i, r1, r2, i + dst - dst*i/255.0f); |
72 } | 72 } |
73 #endif | 73 #endif |
74 } | 74 } |
75 } | 75 } |
76 } | 76 } |
OLD | NEW |