OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 | 8 |
9 #define TEST(name) { name, #name } | 9 #define TEST(name) { name, #name } |
10 | 10 |
(...skipping 5238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5249 } | 5249 } |
5250 tiger8a_x(reporter, filename, testlines); | 5250 tiger8a_x(reporter, filename, testlines); |
5251 } | 5251 } |
5252 } | 5252 } |
5253 } | 5253 } |
5254 | 5254 |
5255 static void tiger8a_h_1(skiatest::Reporter* reporter, const char* filename) { | 5255 static void tiger8a_h_1(skiatest::Reporter* reporter, const char* filename) { |
5256 #if DEBUG_UNDER_DEVELOPMENT // tiger | 5256 #if DEBUG_UNDER_DEVELOPMENT // tiger |
5257 return; | 5257 return; |
5258 #endif | 5258 #endif |
5259 uint64_t testlines = 0x0000001d14c14bb1; // best so far: 0x0000001d14c14bb1
; | 5259 uint64_t testlines = 0x0000000a01900c00; // best so far: 0x0000001d14c14bb1
; |
5260 tiger8a_x(reporter, filename, testlines); | 5260 tiger8a_x(reporter, filename, testlines); |
5261 } | 5261 } |
5262 | 5262 |
| 5263 static void tiger8b_x(skiatest::Reporter* reporter, const char* filename, uint64
_t testlines) { |
| 5264 #if DEBUG_UNDER_DEVELOPMENT // tiger |
| 5265 return; |
| 5266 #endif |
| 5267 SkPath path; |
| 5268 uint64_t i = 0; |
| 5269 if (testlines & (1LL << i++)) path.moveTo(SkBits2Float(0x43f72ca1), SkBits2Float
(0x43609572)); // 494.349f, 224.584f |
| 5270 if (testlines & (1LL << i++)) path.conicTo(SkBits2Float(0x43f72ebd), SkBits2Floa
t(0x4360a219), SkBits2Float(0x43f7302e), SkBits2Float(0x4360af1f), SkBits2Float(
0x3f7fa741)); // 494.365f, 224.633f, 494.376f, 224.684f, 0.998646f |
| 5271 if (testlines & (1LL << i++)) path.lineTo(SkBits2Float(0x43f63333), SkBits2Float
(0x4360e667)); // 492.4f, 224.9f |
| 5272 if (testlines & (1LL << i++)) path.quadTo(SkBits2Float(0x43f63333), SkBits2Float
(0x4360ca4b), SkBits2Float(0x43f6363f), SkBits2Float(0x4360aede)); // 492.4f, 2
24.79f, 492.424f, 224.683f |
| 5273 if (testlines & (1LL << i++)) path.quadTo(SkBits2Float(0x43f64377), SkBits2Float
(0x436037ee), SkBits2Float(0x43f679f5), SkBits2Float(0x4360016e)); // 492.527f,
224.218f, 492.953f, 224.006f |
| 5274 if (testlines & (1LL << i++)) path.quadTo(SkBits2Float(0x43f6df06), SkBits2Float
(0x435f9c5c), SkBits2Float(0x43f71db4), SkBits2Float(0x43605866)); // 493.742f,
223.611f, 494.232f, 224.345f |
| 5275 if (testlines & (1LL << i++)) path.quadTo(SkBits2Float(0x43f722f8), SkBits2Float
(0x43606830), SkBits2Float(0x43f72704), SkBits2Float(0x43607966)); // 494.273f,
224.407f, 494.305f, 224.474f |
| 5276 if (testlines & (1LL << i++)) path.quadTo(SkBits2Float(0x43f72ae0), SkBits2Float
(0x436089cd), SkBits2Float(0x43f72d8a), SkBits2Float(0x43609b1e)); // 494.335f,
224.538f, 494.356f, 224.606f |
| 5277 if (testlines & (1LL << i++)) path.quadTo(SkBits2Float(0x43f72e8e), SkBits2Float
(0x4360a1b8), SkBits2Float(0x43f72f61), SkBits2Float(0x4360a850)); // 494.364f,
224.632f, 494.37f, 224.657f |
| 5278 if (testlines & (1LL << i++)) path.quadTo(SkBits2Float(0x43f72f68), SkBits2Float
(0x4360a88a), SkBits2Float(0x43f72f83), SkBits2Float(0x4360a964)); // 494.37f,
224.658f, 494.371f, 224.662f |
| 5279 if (testlines & (1LL << i++)) path.quadTo(SkBits2Float(0x43f72fbb), SkBits2Float
(0x4360ab2a), SkBits2Float(0x43f72ff4), SkBits2Float(0x4360ad1d)); // 494.373f,
224.669f, 494.375f, 224.676f |
| 5280 if (testlines & (1LL << i++)) path.quadTo(SkBits2Float(0x43f73000), SkBits2Float
(0x4360ad83), SkBits2Float(0x43f73009), SkBits2Float(0x4360add5)); // 494.375f,
224.678f, 494.375f, 224.679f |
| 5281 if (testlines & (1LL << i++)) path.quadTo(SkBits2Float(0x43f7300b), SkBits2Float
(0x4360ade9), SkBits2Float(0x43f73022), SkBits2Float(0x4360aeb5)); // 494.375f,
224.679f, 494.376f, 224.682f |
| 5282 if (testlines & (1LL << i++)) path.lineTo(SkBits2Float(0x43f7301f), SkBits2Float
(0x4360ae97)); // 494.376f, 224.682f |
| 5283 if (testlines & (1LL << i++)) path.lineTo(SkBits2Float(0x43f73027), SkBits2Float
(0x4360aee3)); // 494.376f, 224.683f |
| 5284 if (testlines & (1LL << i++)) path.lineTo(SkBits2Float(0x43f73028), SkBits2Float
(0x4360aeeb)); // 494.376f, 224.683f |
| 5285 if (testlines & (1LL << i++)) path.lineTo(SkBits2Float(0x43f73027), SkBits2Float
(0x4360aedf)); // 494.376f, 224.683f |
| 5286 if (testlines & (1LL << i++)) path.lineTo(SkBits2Float(0x43f73021), SkBits2Float
(0x4360aeaa)); // 494.376f, 224.682f |
| 5287 if (testlines & (1LL << i++)) path.lineTo(SkBits2Float(0x43f73016), SkBits2Float
(0x4360ae50)); // 494.376f, 224.681f |
| 5288 if (testlines & (1LL << i++)) path.lineTo(SkBits2Float(0x43f73007), SkBits2Float
(0x4360adc1)); // 494.375f, 224.679f |
| 5289 if (testlines & (1LL << i++)) path.lineTo(SkBits2Float(0x43f72ff9), SkBits2Float
(0x4360ad4d)); // 494.375f, 224.677f |
| 5290 if (testlines & (1LL << i++)) path.quadTo(SkBits2Float(0x43f7300d), SkBits2Float
(0x4360adf7), SkBits2Float(0x43f73031), SkBits2Float(0x4360af12)); // 494.375f,
224.68f, 494.376f, 224.684f |
| 5291 if (testlines & (1LL << i++)) path.quadTo(SkBits2Float(0x43f730f0), SkBits2Float
(0x4360b4f1), SkBits2Float(0x43f7320a), SkBits2Float(0x4360bc94)); // 494.382f,
224.707f, 494.391f, 224.737f |
| 5292 if (testlines & (1LL << i++)) path.quadTo(SkBits2Float(0x43f73625), SkBits2Float
(0x4360d8fe), SkBits2Float(0x43f73c59), SkBits2Float(0x4360fa4a)); // 494.423f,
224.848f, 494.471f, 224.978f |
| 5293 if (testlines & (1LL << i++)) path.quadTo(SkBits2Float(0x43f75132), SkBits2Float
(0x43616a36), SkBits2Float(0x43f772ac), SkBits2Float(0x4361d738)); // 494.634f,
225.415f, 494.896f, 225.841f |
| 5294 if (testlines & (1LL << i++)) path.quadTo(SkBits2Float(0x43f7de60), SkBits2Float
(0x436335ea), SkBits2Float(0x43f89f25), SkBits2Float(0x4363e779)); // 495.737f,
227.211f, 497.243f, 227.904f |
| 5295 if (testlines & (1LL << i++)) path.quadTo(SkBits2Float(0x43fb3d30), SkBits2Float
(0x436650a0), SkBits2Float(0x44005a14), SkBits2Float(0x43602133)); // 502.478f,
230.315f, 513.407f, 224.13f |
| 5296 if (testlines & (1LL << i++)) path.lineTo(SkBits2Float(0x4400799a), SkBits2Float
(0x4360ffff)); // 513.9f, 225 |
| 5297 if (testlines & (1LL << i++)) path.lineTo(SkBits2Float(0x44003ca2), SkBits2Float
(0x43614dd5)); // 512.947f, 225.304f |
| 5298 if (testlines & (1LL << i++)) path.quadTo(SkBits2Float(0x43ff92b8), SkBits2Float
(0x435ba8f8), SkBits2Float(0x43fee825), SkBits2Float(0x4353aa15)); // 511.146f,
219.66f, 509.814f, 211.664f |
| 5299 if (testlines & (1LL << i++)) path.lineTo(SkBits2Float(0x43ff6667), SkBits2Float
(0x43537fff)); // 510.8f, 211.5f |
| 5300 if (testlines & (1LL << i++)) path.lineTo(SkBits2Float(0x43ffcaf2), SkBits2Float
(0x43541e6d)); // 511.586f, 212.119f |
| 5301 if (testlines & (1LL << i++)) path.quadTo(SkBits2Float(0x43fd4888), SkBits2Float
(0x435a7d38), SkBits2Float(0x43f8d864), SkBits2Float(0x435b4bbf)); // 506.567f,
218.489f, 497.691f, 219.296f |
| 5302 if (testlines & (1LL << i++)) path.lineTo(SkBits2Float(0x43f8cccd), SkBits2Float
(0x435a4ccc)); // 497.6f, 218.3f |
| 5303 if (testlines & (1LL << i++)) path.lineTo(SkBits2Float(0x43f8e5e7), SkBits2Float
(0x435b47d3)); // 497.796f, 219.281f |
| 5304 if (testlines & (1LL << i++)) path.quadTo(SkBits2Float(0x43f84300), SkBits2Float
(0x435b88fd), SkBits2Float(0x43f7b75b), SkBits2Float(0x435c5e8e)); // 496.523f,
219.535f, 495.432f, 220.369f |
| 5305 if (testlines & (1LL << i++)) path.quadTo(SkBits2Float(0x43f6b984), SkBits2Float
(0x435de2c4), SkBits2Float(0x43f72ca1), SkBits2Float(0x43609572)); // 493.449f,
221.886f, 494.349f, 224.584f |
| 5306 if (testlines & (1LL << i++)) path.close(); |
| 5307 testSimplify(reporter, path, filename); |
| 5308 } |
| 5309 |
| 5310 static void tiger8b_h(skiatest::Reporter* reporter, const char* filename) { |
| 5311 #if DEBUG_UNDER_DEVELOPMENT // tiger |
| 5312 return; |
| 5313 #endif |
| 5314 SkRandom r; |
| 5315 for (int samples = 2; samples < 37; ++samples) { |
| 5316 for (int tests = 0; tests < 10000; ++tests) { |
| 5317 uint64_t testlines = 0; |
| 5318 for (int i = 0; i < samples; ++i) { |
| 5319 int bit; |
| 5320 do { |
| 5321 bit = r.nextRangeU(0, 38); |
| 5322 } while (testlines & (1LL << bit)); |
| 5323 testlines |= 1LL << bit; |
| 5324 } |
| 5325 tiger8b_x(reporter, filename, testlines); |
| 5326 } |
| 5327 } |
| 5328 } |
| 5329 |
| 5330 static void tiger8b_h_1(skiatest::Reporter* reporter, const char* filename) { |
| 5331 #if DEBUG_UNDER_DEVELOPMENT // tiger |
| 5332 return; |
| 5333 #endif |
| 5334 uint64_t testlines = 0x0000000001000893; // best so far: 0x0000000001000893 |
| 5335 tiger8b_x(reporter, filename, testlines); |
| 5336 } |
| 5337 |
5263 // tries to add same edge twice | 5338 // tries to add same edge twice |
5264 static void tiger8b(skiatest::Reporter* reporter, const char* filename) { | 5339 static void tiger8b(skiatest::Reporter* reporter, const char* filename) { |
5265 #if DEBUG_UNDER_DEVELOPMENT // tiger | 5340 #if DEBUG_UNDER_DEVELOPMENT // tiger |
5266 return; | 5341 return; |
5267 #endif | 5342 #endif |
5268 SkPath path; | 5343 SkPath path; |
5269 path.moveTo(SkBits2Float(0x43f72ca1), SkBits2Float(0x43609572)); // 494.349f, 2
24.584f | 5344 path.moveTo(SkBits2Float(0x43f72ca1), SkBits2Float(0x43609572)); // 494.349f, 2
24.584f |
5270 path.conicTo(SkBits2Float(0x43f72ebd), SkBits2Float(0x4360a219), SkBits2Float(0x
43f7302e), SkBits2Float(0x4360af1f), SkBits2Float(0x3f7fa741)); // 494.365f, 22
4.633f, 494.376f, 224.684f, 0.998646f | 5345 path.conicTo(SkBits2Float(0x43f72ebd), SkBits2Float(0x4360a219), SkBits2Float(0x
43f7302e), SkBits2Float(0x4360af1f), SkBits2Float(0x3f7fa741)); // 494.365f, 22
4.633f, 494.376f, 224.684f, 0.998646f |
5271 path.lineTo(SkBits2Float(0x43f63333), SkBits2Float(0x4360e667)); // 492.4f, 224
.9f | 5346 path.lineTo(SkBits2Float(0x43f63333), SkBits2Float(0x4360e667)); // 492.4f, 224
.9f |
5272 path.quadTo(SkBits2Float(0x43f63333), SkBits2Float(0x4360ca4b), SkBits2Float(0x4
3f6363f), SkBits2Float(0x4360aede)); // 492.4f, 224.79f, 492.424f, 224.683f | 5347 path.quadTo(SkBits2Float(0x43f63333), SkBits2Float(0x4360ca4b), SkBits2Float(0x4
3f6363f), SkBits2Float(0x4360aede)); // 492.4f, 224.79f, 492.424f, 224.683f |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5778 path.lineTo(3, 3); | 5853 path.lineTo(3, 3); |
5779 path.close(); | 5854 path.close(); |
5780 path.moveTo(0, 1); | 5855 path.moveTo(0, 1); |
5781 path.lineTo(2, 2); | 5856 path.lineTo(2, 2); |
5782 path.quadTo(1, 3, 3, 3); | 5857 path.quadTo(1, 3, 3, 3); |
5783 path.close(); | 5858 path.close(); |
5784 testSimplify(reporter, path, filename); | 5859 testSimplify(reporter, path, filename); |
5785 } | 5860 } |
5786 | 5861 |
5787 static void (*skipTest)(skiatest::Reporter* , const char* filename) = 0; | 5862 static void (*skipTest)(skiatest::Reporter* , const char* filename) = 0; |
5788 static void (*firstTest)(skiatest::Reporter* , const char* filename) = 0; | 5863 static void (*firstTest)(skiatest::Reporter* , const char* filename) = tiger8b_h
_1; |
5789 static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0; | 5864 static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0; |
5790 | 5865 |
5791 static TestDesc tests[] = { | 5866 static TestDesc tests[] = { |
5792 TEST(tiger8a_h_1), | 5867 TEST(tiger8a_h_1), |
5793 TEST(tiger8a_h), | 5868 TEST(tiger8a_h), |
5794 TEST(tiger8a), | 5869 TEST(tiger8a), |
| 5870 TEST(tiger8b_h_1), |
| 5871 TEST(tiger8b_h), |
5795 TEST(tiger8b), | 5872 TEST(tiger8b), |
5796 TEST(tiger8), | 5873 TEST(tiger8), |
5797 TEST(testQuads72), | 5874 TEST(testQuads72), |
5798 TEST(testQuads71), | 5875 TEST(testQuads71), |
5799 TEST(testQuads70), | 5876 TEST(testQuads70), |
5800 TEST(testQuads69), | 5877 TEST(testQuads69), |
5801 TEST(testQuads68), | 5878 TEST(testQuads68), |
5802 TEST(testQuads67), | 5879 TEST(testQuads67), |
5803 TEST(testQuads66), | 5880 TEST(testQuads66), |
5804 TEST(dean4), | 5881 TEST(dean4), |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6250 | 6327 |
6251 DEF_TEST(PathOpsSimplify, reporter) { | 6328 DEF_TEST(PathOpsSimplify, reporter) { |
6252 if (runSubTests && runSubTestsFirst) { | 6329 if (runSubTests && runSubTestsFirst) { |
6253 RunTestSet(reporter, subTests, subTestCount, firstSubTest, nullptr, stop
Test, runReverse); | 6330 RunTestSet(reporter, subTests, subTestCount, firstSubTest, nullptr, stop
Test, runReverse); |
6254 } | 6331 } |
6255 RunTestSet(reporter, tests, testCount, firstTest, skipTest, stopTest, runRev
erse); | 6332 RunTestSet(reporter, tests, testCount, firstTest, skipTest, stopTest, runRev
erse); |
6256 if (runSubTests && !runSubTestsFirst) { | 6333 if (runSubTests && !runSubTestsFirst) { |
6257 RunTestSet(reporter, subTests, subTestCount, firstSubTest, nullptr, stop
Test, runReverse); | 6334 RunTestSet(reporter, subTests, subTestCount, firstSubTest, nullptr, stop
Test, runReverse); |
6258 } | 6335 } |
6259 } | 6336 } |
OLD | NEW |