OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #include "PathOpsExtendedTest.h" | 7 #include "PathOpsExtendedTest.h" |
8 #include "SkPath.h" | 8 #include "SkPath.h" |
9 #include "SkPathOps.h" | 9 #include "SkPathOps.h" |
10 #include "SkPoint.h" | 10 #include "SkPoint.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 static void fuzz_x2(skiatest::Reporter* reporter, const char* filename) { | 119 static void fuzz_x2(skiatest::Reporter* reporter, const char* filename) { |
120 SkPath path; | 120 SkPath path; |
121 path.moveTo(SkBits2Float(0x00000000), SkBits2Float(0x00000000)); // 0, 0 | 121 path.moveTo(SkBits2Float(0x00000000), SkBits2Float(0x00000000)); // 0, 0 |
122 path.cubicTo(SkBits2Float(0x1931204a), SkBits2Float(0x2ba1a14a), SkBits2Float(0x
4a4a08ff), SkBits2Float(0x4a4a08ff), SkBits2Float(0x4a4a4a34), SkBits2Float(0x4a
4a4a4a)); // 9.15721e-24f, 1.14845e-12f, 3.31014e+06f, 3.31014e+06f, 3.31432e+0
6f, 3.31432e+06f | 122 path.cubicTo(SkBits2Float(0x1931204a), SkBits2Float(0x2ba1a14a), SkBits2Float(0x
4a4a08ff), SkBits2Float(0x4a4a08ff), SkBits2Float(0x4a4a4a34), SkBits2Float(0x4a
4a4a4a)); // 9.15721e-24f, 1.14845e-12f, 3.31014e+06f, 3.31014e+06f, 3.31432e+0
6f, 3.31432e+06f |
123 path.moveTo(SkBits2Float(0x000010a1), SkBits2Float(0x19312000)); // 5.96533e-42
f, 9.15715e-24f | 123 path.moveTo(SkBits2Float(0x000010a1), SkBits2Float(0x19312000)); // 5.96533e-42
f, 9.15715e-24f |
124 path.cubicTo(SkBits2Float(0x4a6a4a4a), SkBits2Float(0x4a4a4a4a), SkBits2Float(0x
a14a4a4a), SkBits2Float(0x08ff2ba1), SkBits2Float(0x08ff4a4a), SkBits2Float(0x4a
344a4a)); // 3.83861e+06f, 3.31432e+06f, -6.85386e-19f, 1.53575e-33f, 1.53647e-
33f, 2.95387e+06f | 124 path.cubicTo(SkBits2Float(0x4a6a4a4a), SkBits2Float(0x4a4a4a4a), SkBits2Float(0x
a14a4a4a), SkBits2Float(0x08ff2ba1), SkBits2Float(0x08ff4a4a), SkBits2Float(0x4a
344a4a)); // 3.83861e+06f, 3.31432e+06f, -6.85386e-19f, 1.53575e-33f, 1.53647e-
33f, 2.95387e+06f |
125 path.cubicTo(SkBits2Float(0x4a4a4a4a), SkBits2Float(0x4a4a4a4a), SkBits2Float(0x
2ba1a14a), SkBits2Float(0x4e4a08ff), SkBits2Float(0x4a4a4a4a), SkBits2Float(0xa1
a181ff)); // 3.31432e+06f, 3.31432e+06f, 1.14845e-12f, 8.47397e+08f, 3.31432e+0
6f, -1.09442e-18f | 125 path.cubicTo(SkBits2Float(0x4a4a4a4a), SkBits2Float(0x4a4a4a4a), SkBits2Float(0x
2ba1a14a), SkBits2Float(0x4e4a08ff), SkBits2Float(0x4a4a4a4a), SkBits2Float(0xa1
a181ff)); // 3.31432e+06f, 3.31432e+06f, 1.14845e-12f, 8.47397e+08f, 3.31432e+0
6f, -1.09442e-18f |
126 testSimplify(reporter, path, filename); | 126 testSimplify(reporter, path, filename); |
127 } | 127 } |
128 | 128 |
| 129 static void fuzz763_1(skiatest::Reporter* reporter, const char* filename) { |
| 130 SkPath path; |
| 131 path.setFillType((SkPath::FillType) 0); |
| 132 path.moveTo(SkBits2Float(0x00000000), SkBits2Float(0x00000000)); // 0, 0 |
| 133 path.cubicTo(SkBits2Float(0xbcb63000), SkBits2Float(0xb6b6b6b7), SkBits2Float(0x
38b6b6b6), SkBits2Float(0xafb63a5a), SkBits2Float(0xca000087), SkBits2Float(0xe9
3ae9e9)); // -0.0222397f, -5.44529e-06f, 8.71247e-05f, -3.31471e-10f, -2.09719e
+06f, -1.41228e+25f |
| 134 path.quadTo(SkBits2Float(0xb6007fb6), SkBits2Float(0xb69fb6b6), SkBits2Float(0xe
9e964b6), SkBits2Float(0xe9e9e9e9)); // -1.91478e-06f, -4.75984e-06f, -3.52694e
+25f, -3.5348e+25f |
| 135 path.quadTo(SkBits2Float(0xb6b6b8b7), SkBits2Float(0xb60000b6), SkBits2Float(0xb
6b6b6b6), SkBits2Float(0xe9e92064)); // -5.44553e-06f, -1.90739e-06f, -5.44529e
-06f, -3.52291e+25f |
| 136 path.quadTo(SkBits2Float(0x000200e9), SkBits2Float(0xe9e9d100), SkBits2Float(0xe
93ae9e9), SkBits2Float(0xe964b6e9)); // 1.83997e-40f, -3.53333e+25f, -1.41228e+
25f, -1.72812e+25f |
| 137 path.quadTo(SkBits2Float(0x40b6e9e9), SkBits2Float(0xe9b60000), SkBits2Float(0x0
0b6b8e9), SkBits2Float(0xe9000001)); // 5.71605f, -2.75031e+25f, 1.67804e-38f,
-9.67141e+24f |
| 138 path.quadTo(SkBits2Float(0xe9d3b6b2), SkBits2Float(0x40404540), SkBits2Float(0x8
03d4043), SkBits2Float(0xe9e9e9ff)); // -3.19933e+25f, 3.00423f, -5.62502e-39f,
-3.53481e+25f |
| 139 path.cubicTo(SkBits2Float(0x00000000), SkBits2Float(0xe8b3b6b6), SkBits2Float(0x
e90a0003), SkBits2Float(0x4040403c), SkBits2Float(0x803d4040), SkBits2Float(0xe9
e80900)); // 0, -6.78939e+24f, -1.0427e+25f, 3.00392f, -5.62501e-39f, -3.50642e
+25f |
| 140 path.quadTo(SkBits2Float(0xe9e910e9), SkBits2Float(0xe9e93ae9), SkBits2Float(0x0
000b6b6), SkBits2Float(0xb6b6aab6)); // -3.52199e+25f, -3.52447e+25f, 6.55443e-
41f, -5.4439e-06f |
| 141 path.moveTo(SkBits2Float(0xe9e92064), SkBits2Float(0xe9e9d106)); // -3.52291e+2
5f, -3.53334e+25f |
| 142 path.quadTo(SkBits2Float(0xe9e93ae9), SkBits2Float(0x0000abb6), SkBits2Float(0xb
6b6bdb6), SkBits2Float(0xe92064b6)); // -3.52447e+25f, 6.15983e-41f, -5.44611e-
06f, -1.2119e+25f |
| 143 path.quadTo(SkBits2Float(0x0000e9e9), SkBits2Float(0xb6b6b6e9), SkBits2Float(0x0
5ffff05), SkBits2Float(0xe9ea06e9)); // 8.39112e-41f, -5.44532e-06f, 2.40738e-3
5f, -3.53652e+25f |
| 144 path.quadTo(SkBits2Float(0xe93ae9e9), SkBits2Float(0x02007fe9), SkBits2Float(0xb
8b7b600), SkBits2Float(0xe9e9b6b6)); // -1.41228e+25f, 9.44066e-38f, -8.76002e-
05f, -3.53178e+25f |
| 145 path.quadTo(SkBits2Float(0xe9e9e9b6), SkBits2Float(0xedb6b6b6), SkBits2Float(0x5
a38a1b6), SkBits2Float(0xe93ae9e9)); // -3.53479e+25f, -7.06839e+27f, 1.29923e+
16f, -1.41228e+25f |
| 146 path.quadTo(SkBits2Float(0x0000b6b6), SkBits2Float(0xb6b6b6b6), SkBits2Float(0xe
9e9e9b6), SkBits2Float(0xe9e9e954)); // 6.55443e-41f, -5.44529e-06f, -3.53479e+
25f, -3.53477e+25f |
| 147 path.quadTo(SkBits2Float(0xb6e9e93a), SkBits2Float(0x375837ff), SkBits2Float(0xc
eb6b6b6), SkBits2Float(0x0039e94f)); // -6.97109e-06f, 1.28876e-05f, -1.53271e+
09f, 5.31832e-39f |
| 148 path.quadTo(SkBits2Float(0xe9e9e9e9), SkBits2Float(0xe9e6e9e9), SkBits2Float(0xb
6b641b6), SkBits2Float(0xede9e9e9)); // -3.5348e+25f, -3.48947e+25f, -5.43167e-
06f, -9.0491e+27f |
| 149 path.moveTo(SkBits2Float(0xb6b6e9e9), SkBits2Float(0xb6b60000)); // -5.45125e-0
6f, -5.42402e-06f |
| 150 path.moveTo(SkBits2Float(0xe9b6b6b6), SkBits2Float(0xe9b6b8e9)); // -2.76109e+2
5f, -2.76122e+25f |
| 151 path.close(); |
| 152 path.moveTo(SkBits2Float(0xe9b6b6b6), SkBits2Float(0xe9b6b8e9)); // -2.76109e+2
5f, -2.76122e+25f |
| 153 path.quadTo(SkBits2Float(0xe93ae9e9), SkBits2Float(0xe964b6e9), SkBits2Float(0x0
000203a), SkBits2Float(0xb6000000)); // -1.41228e+25f, -1.72812e+25f, 1.15607e-
41f, -1.90735e-06f |
| 154 path.moveTo(SkBits2Float(0x64b6b6b6), SkBits2Float(0xe9e9e900)); // 2.69638e+22
f, -3.53475e+25f |
| 155 path.quadTo(SkBits2Float(0xb6b6b6e9), SkBits2Float(0xb6b6b6b6), SkBits2Float(0xe
9e9b6ce), SkBits2Float(0xe9e93ae9)); // -5.44532e-06f, -5.44529e-06f, -3.53179e
+25f, -3.52447e+25f |
| 156 |
| 157 testSimplify(reporter, path, filename); |
| 158 } |
| 159 |
| 160 |
129 #define TEST(test) test(reporter, #test) | 161 #define TEST(test) test(reporter, #test) |
130 | 162 |
131 DEF_TEST(PathOpsSimplifyFail, reporter) { | 163 DEF_TEST(PathOpsSimplifyFail, reporter) { |
| 164 TEST(fuzz763_1), |
132 TEST(fuzz_x2); | 165 TEST(fuzz_x2); |
133 TEST(fuzz_x1); | 166 TEST(fuzz_x1); |
134 TEST(fuzz_59); | 167 TEST(fuzz_59); |
135 for (int index = 0; index < (int) (13 * nonFinitePtsCount * finitePtsCount);
++index) { | 168 for (int index = 0; index < (int) (13 * nonFinitePtsCount * finitePtsCount);
++index) { |
136 failOne(reporter, index); | 169 failOne(reporter, index); |
137 } | 170 } |
138 for (int index = 0; index < (int) (11 * finitePtsCount); ++index) { | 171 for (int index = 0; index < (int) (11 * finitePtsCount); ++index) { |
139 dontFailOne(reporter, index); | 172 dontFailOne(reporter, index); |
140 } | 173 } |
141 } | 174 } |
142 | 175 |
143 #undef TEST | 176 #undef TEST |
144 | 177 |
145 DEF_TEST(PathOpsSimplifyFailOne, reporter) { | 178 DEF_TEST(PathOpsSimplifyFailOne, reporter) { |
146 int index = 0; | 179 int index = 0; |
147 failOne(reporter, index); | 180 failOne(reporter, index); |
148 } | 181 } |
149 | 182 |
150 DEF_TEST(PathOpsSimplifyDontFailOne, reporter) { | 183 DEF_TEST(PathOpsSimplifyDontFailOne, reporter) { |
151 int index = 17; | 184 int index = 17; |
152 dontFailOne(reporter, index); | 185 dontFailOne(reporter, index); |
153 } | 186 } |
OLD | NEW |