OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "PathOpsThreadedCommon.h" | 8 #include "PathOpsThreadedCommon.h" |
9 | 9 |
10 static int add_point(char* str, SkScalar x, SkScalar y) { | 10 static int add_point(char* str, SkScalar x, SkScalar y) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 SkIntToScalar(b * state.fA + d * (6 - state.fA)) / 6 }; | 46 SkIntToScalar(b * state.fA + d * (6 - state.fA)) / 6 }; |
47 SkPoint midB = { SkIntToScalar(a * state.fB + c * (6 - state.fB)) / 6, | 47 SkPoint midB = { SkIntToScalar(a * state.fB + c * (6 - state.fB)) / 6, |
48 SkIntToScalar(b * state.fB + d * (6 - state.fB)) / 6 }; | 48 SkIntToScalar(b * state.fB + d * (6 - state.fB)) / 6 }; |
49 SkPoint endC = { midA.fX + v.fY * state.fC / 3, | 49 SkPoint endC = { midA.fX + v.fY * state.fC / 3, |
50 midA.fY + v.fX * state.fC / 3 }; | 50 midA.fY + v.fX * state.fC / 3 }; |
51 SkPoint endD = { midB.fX - v.fY * state.fD / 3, | 51 SkPoint endD = { midB.fX - v.fY * state.fD / 3, |
52 midB.fY + v.fX * state.fD / 3 }; | 52 midB.fY + v.fX * state.fD / 3 }; |
53 SkPath pathA, pathB; | 53 SkPath pathA, pathB; |
54 if (progress) { | 54 if (progress) { |
55 char* str = pathStr; | 55 char* str = pathStr; |
56 const int loopNo = 12; | 56 const int loopNo = 17; |
57 str += sprintf(str, "static void loop%d(skiatest::Reporter* reporter
," | 57 str += sprintf(str, "static void loop%d(skiatest::Reporter* reporter
," |
58 " const char* filename) {\n", loopNo); | 58 " const char* filename) {\n", loopNo); |
59 str += sprintf(str, " SkPath path, pathB;\n"); | 59 str += sprintf(str, " SkPath path, pathB;\n"); |
60 str += sprintf(str, " path.moveTo(%d,%d);\n", a, b); | 60 str += sprintf(str, " path.moveTo(%d,%d);\n", a, b); |
61 str += sprintf(str, " path.cubicTo(%d,%d, ", c, d); | 61 str += sprintf(str, " path.cubicTo(%d,%d, ", c, d); |
62 str += add_point(str, endC.fX, endC.fY); | 62 str += add_point(str, endC.fX, endC.fY); |
63 str += sprintf(str, ", "); | 63 str += sprintf(str, ", "); |
64 str += add_point(str, endD.fX, endD.fY); | 64 str += add_point(str, endD.fX, endD.fY); |
65 str += sprintf(str, ");\n"); | 65 str += sprintf(str, ");\n"); |
66 str += sprintf(str, " path.close();\n"); | 66 str += sprintf(str, " path.close();\n"); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 (&testOpLoopsMain, a, b, c, d, &testRunner)); | 103 (&testOpLoopsMain, a, b, c, d, &testRunner)); |
104 } | 104 } |
105 } | 105 } |
106 if (!reporter->allowExtendedTest()) goto finish; | 106 if (!reporter->allowExtendedTest()) goto finish; |
107 } | 107 } |
108 } | 108 } |
109 finish: | 109 finish: |
110 testRunner.render(); | 110 testRunner.render(); |
111 ShowTestArray("loopOp"); | 111 ShowTestArray("loopOp"); |
112 } | 112 } |
OLD | NEW |