Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: gm/smallpaths.cpp

Issue 1842753002: Style bikeshed - remove extraneous whitespace (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gm/showmiplevels.cpp ('k') | gm/strokefill.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 "gm.h" 8 #include "gm.h"
9 #include "SkPath.h" 9 #include "SkPath.h"
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 57
58 static SkScalar make_star_5(SkPath* path) { return make_star(path, 5); } 58 static SkScalar make_star_5(SkPath* path) { return make_star(path, 5); }
59 static SkScalar make_star_13(SkPath* path) { return make_star(path, 13); } 59 static SkScalar make_star_13(SkPath* path) { return make_star(path, 13); }
60 60
61 static SkScalar make_three_line(SkPath* path) { 61 static SkScalar make_three_line(SkPath* path) {
62 static SkScalar xOffset = 34.f; 62 static SkScalar xOffset = 34.f;
63 static SkScalar yOffset = 50.f; 63 static SkScalar yOffset = 50.f;
64 path->moveTo(-32.5f + xOffset, 0.0f + yOffset); 64 path->moveTo(-32.5f + xOffset, 0.0f + yOffset);
65 path->lineTo(32.5f + xOffset, 0.0f + yOffset); 65 path->lineTo(32.5f + xOffset, 0.0f + yOffset);
66 66
67 path->moveTo(-32.5f + xOffset, 19 + yOffset); 67 path->moveTo(-32.5f + xOffset, 19 + yOffset);
68 path->lineTo(32.5f + xOffset, 19 + yOffset); 68 path->lineTo(32.5f + xOffset, 19 + yOffset);
69 69
70 path->moveTo(-32.5f + xOffset, -19 + yOffset); 70 path->moveTo(-32.5f + xOffset, -19 + yOffset);
71 path->lineTo(32.5f + xOffset, -19 + yOffset); 71 path->lineTo(32.5f + xOffset, -19 + yOffset);
72 path->lineTo(-32.5f + xOffset, -19 + yOffset); 72 path->lineTo(-32.5f + xOffset, -19 + yOffset);
73 73
74 path->close(); 74 path->close();
75 75
76 return SkIntToScalar(70); 76 return SkIntToScalar(70);
77 } 77 }
78 78
79 static SkScalar make_arrow(SkPath* path) { 79 static SkScalar make_arrow(SkPath* path) {
80 static SkScalar xOffset = 34.f; 80 static SkScalar xOffset = 34.f;
81 static SkScalar yOffset = 40.f; 81 static SkScalar yOffset = 40.f;
82 path->moveTo(-26.f + xOffset, 0.0f + yOffset); 82 path->moveTo(-26.f + xOffset, 0.0f + yOffset);
83 path->lineTo(26.f + xOffset, 0.0f + yOffset); 83 path->lineTo(26.f + xOffset, 0.0f + yOffset);
84 84
85 path->moveTo(-28.f + xOffset, -2.4748745f + yOffset); 85 path->moveTo(-28.f + xOffset, -2.4748745f + yOffset);
86 path->lineTo(0 + xOffset, 25.525126f + yOffset); 86 path->lineTo(0 + xOffset, 25.525126f + yOffset);
87 87
88 path->moveTo(-28.f + xOffset, 2.4748745f + yOffset); 88 path->moveTo(-28.f + xOffset, 2.4748745f + yOffset);
89 path->lineTo(0 + xOffset, -25.525126f + yOffset); 89 path->lineTo(0 + xOffset, -25.525126f + yOffset);
90 path->lineTo(-28.f + xOffset, 2.4748745f + yOffset); 90 path->lineTo(-28.f + xOffset, 2.4748745f + yOffset);
91 91
92 path->close(); 92 path->close();
93 93
94 return SkIntToScalar(70); 94 return SkIntToScalar(70);
95 } 95 }
96 96
97 static SkScalar make_curve(SkPath* path) { 97 static SkScalar make_curve(SkPath* path) {
98 static SkScalar xOffset = -382.f; 98 static SkScalar xOffset = -382.f;
99 static SkScalar yOffset = -50.f; 99 static SkScalar yOffset = -50.f;
100 path->moveTo(491 + xOffset, 56 + yOffset); 100 path->moveTo(491 + xOffset, 56 + yOffset);
101 path->conicTo(435.93292f + xOffset, 56.000031f + yOffset, 101 path->conicTo(435.93292f + xOffset, 56.000031f + yOffset,
102 382.61078f + xOffset, 69.752716f + yOffset, 102 382.61078f + xOffset, 69.752716f + yOffset,
103 0.9920463f); 103 0.9920463f);
104 104
105 return SkIntToScalar(40); 105 return SkIntToScalar(40);
106 } 106 }
107 107
108 static SkScalar make_battery(SkPath* path) { 108 static SkScalar make_battery(SkPath* path) {
109 static SkScalar xOffset = 5.f; 109 static SkScalar xOffset = 5.f;
110 110
111 path->moveTo(24.67f + xOffset, 0.33000004f); 111 path->moveTo(24.67f + xOffset, 0.33000004f);
112 path->lineTo(8.3299999f + xOffset, 0.33000004f); 112 path->lineTo(8.3299999f + xOffset, 0.33000004f);
113 path->lineTo(8.3299999f + xOffset, 5.3299999f); 113 path->lineTo(8.3299999f + xOffset, 5.3299999f);
114 path->lineTo(0.33000004f + xOffset, 5.3299999f); 114 path->lineTo(0.33000004f + xOffset, 5.3299999f);
115 path->lineTo(0.33000004f + xOffset, 50.669998f); 115 path->lineTo(0.33000004f + xOffset, 50.669998f);
116 path->lineTo(32.669998f + xOffset, 50.669998f); 116 path->lineTo(32.669998f + xOffset, 50.669998f);
117 path->lineTo(32.669998f + xOffset, 5.3299999f); 117 path->lineTo(32.669998f + xOffset, 5.3299999f);
118 path->lineTo(24.67f + xOffset, 5.3299999f); 118 path->lineTo(24.67f + xOffset, 5.3299999f);
119 path->lineTo(24.67f + xOffset, 0.33000004f); 119 path->lineTo(24.67f + xOffset, 0.33000004f);
120 path->close(); 120 path->close();
121 121
122 path->moveTo(25.727224f + xOffset, 12.886665f); 122 path->moveTo(25.727224f + xOffset, 12.886665f);
123 path->lineTo(10.907918f + xOffset, 12.886665f); 123 path->lineTo(10.907918f + xOffset, 12.886665f);
124 path->lineTo(7.5166659f + xOffset, 28.683645f); 124 path->lineTo(7.5166659f + xOffset, 28.683645f);
125 path->lineTo(14.810181f + xOffset, 28.683645f); 125 path->lineTo(14.810181f + xOffset, 28.683645f);
126 path->lineTo(7.7024879f + xOffset, 46.135998f); 126 path->lineTo(7.7024879f + xOffset, 46.135998f);
127 path->lineTo(28.049999f + xOffset, 25.136419f); 127 path->lineTo(28.049999f + xOffset, 25.136419f);
128 path->lineTo(16.854223f + xOffset, 25.136419f); 128 path->lineTo(16.854223f + xOffset, 25.136419f);
129 path->lineTo(25.727224f + xOffset, 12.886665f); 129 path->lineTo(25.727224f + xOffset, 12.886665f);
130 path->close(); 130 path->close();
131 return SkIntToScalar(50); 131 return SkIntToScalar(50);
132 } 132 }
133 133
134 static SkScalar make_battery2(SkPath* path) { 134 static SkScalar make_battery2(SkPath* path) {
135 static SkScalar xOffset = 5.f; 135 static SkScalar xOffset = 5.f;
136 136
137 path->moveTo(32.669998f + xOffset, 9.8640003f); 137 path->moveTo(32.669998f + xOffset, 9.8640003f);
138 path->lineTo(0.33000004f + xOffset, 9.8640003f); 138 path->lineTo(0.33000004f + xOffset, 9.8640003f);
139 path->lineTo(0.33000004f + xOffset, 50.669998f); 139 path->lineTo(0.33000004f + xOffset, 50.669998f);
140 path->lineTo(32.669998f + xOffset, 50.669998f); 140 path->lineTo(32.669998f + xOffset, 50.669998f);
141 path->lineTo(32.669998f + xOffset, 9.8640003f); 141 path->lineTo(32.669998f + xOffset, 9.8640003f);
142 path->close(); 142 path->close();
143 143
144 path->moveTo(10.907918f + xOffset, 12.886665f); 144 path->moveTo(10.907918f + xOffset, 12.886665f);
145 path->lineTo(25.727224f + xOffset, 12.886665f); 145 path->lineTo(25.727224f + xOffset, 12.886665f);
146 path->lineTo(16.854223f + xOffset, 25.136419f); 146 path->lineTo(16.854223f + xOffset, 25.136419f);
147 path->lineTo(28.049999f + xOffset, 25.136419f); 147 path->lineTo(28.049999f + xOffset, 25.136419f);
148 path->lineTo(7.7024879f + xOffset, 46.135998f); 148 path->lineTo(7.7024879f + xOffset, 46.135998f);
149 path->lineTo(14.810181f + xOffset, 28.683645f); 149 path->lineTo(14.810181f + xOffset, 28.683645f);
150 path->lineTo(7.5166659f + xOffset, 28.683645f); 150 path->lineTo(7.5166659f + xOffset, 28.683645f);
151 path->lineTo(10.907918f + xOffset, 12.886665f); 151 path->lineTo(10.907918f + xOffset, 12.886665f);
152 path->close(); 152 path->close();
153 153
154 return SkIntToScalar(70); 154 return SkIntToScalar(70);
155 } 155 }
156 156
157 static const MakePathProc gProcs[] = { 157 static const MakePathProc gProcs[] = {
158 make_triangle, 158 make_triangle,
159 make_rect, 159 make_rect,
160 make_oval, 160 make_oval,
161 make_star_5, 161 make_star_5,
162 make_star_13, 162 make_star_13,
163 make_three_line, 163 make_three_line,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 paint.setAntiAlias(true); 222 paint.setAntiAlias(true);
223 223
224 // first column: filled paths 224 // first column: filled paths
225 canvas->save(); 225 canvas->save();
226 for (size_t i = 0; i < N; i++) { 226 for (size_t i = 0; i < N; i++) {
227 canvas->drawPath(fPath[i], paint); 227 canvas->drawPath(fPath[i], paint);
228 canvas->translate(SkIntToScalar(0), fDY[i]); 228 canvas->translate(SkIntToScalar(0), fDY[i]);
229 } 229 }
230 canvas->restore(); 230 canvas->restore();
231 canvas->translate(SkIntToScalar(120), SkIntToScalar(0)); 231 canvas->translate(SkIntToScalar(120), SkIntToScalar(0));
232 232
233 // second column: stroked paths 233 // second column: stroked paths
234 canvas->save(); 234 canvas->save();
235 paint.setStyle(SkPaint::kStroke_Style); 235 paint.setStyle(SkPaint::kStroke_Style);
236 paint.setStrokeCap(SkPaint::kButt_Cap); 236 paint.setStrokeCap(SkPaint::kButt_Cap);
237 for (size_t i = 0; i < N; i++) { 237 for (size_t i = 0; i < N; i++) {
238 paint.setStrokeWidth(gWidths[i]); 238 paint.setStrokeWidth(gWidths[i]);
239 paint.setStrokeMiter(gMiters[i]); 239 paint.setStrokeMiter(gMiters[i]);
240 canvas->drawPath(fPath[i], paint); 240 canvas->drawPath(fPath[i], paint);
241 canvas->translate(SkIntToScalar(0), fDY[i]); 241 canvas->translate(SkIntToScalar(0), fDY[i]);
242 } 242 }
243 canvas->restore(); 243 canvas->restore();
244 canvas->translate(SkIntToScalar(120), SkIntToScalar(0)); 244 canvas->translate(SkIntToScalar(120), SkIntToScalar(0));
245 245
246 // third column: stroked paths with different widths 246 // third column: stroked paths with different widths
247 canvas->save(); 247 canvas->save();
248 paint.setStyle(SkPaint::kStroke_Style); 248 paint.setStyle(SkPaint::kStroke_Style);
249 paint.setStrokeCap(SkPaint::kButt_Cap); 249 paint.setStrokeCap(SkPaint::kButt_Cap);
250 for (size_t i = 0; i < N; i++) { 250 for (size_t i = 0; i < N; i++) {
251 paint.setStrokeWidth(gWidths[i] + 2.0f); 251 paint.setStrokeWidth(gWidths[i] + 2.0f);
252 paint.setStrokeMiter(gMiters[i]); 252 paint.setStrokeMiter(gMiters[i]);
253 canvas->drawPath(fPath[i], paint); 253 canvas->drawPath(fPath[i], paint);
254 canvas->translate(SkIntToScalar(0), fDY[i]); 254 canvas->translate(SkIntToScalar(0), fDY[i]);
255 } 255 }
256 canvas->restore(); 256 canvas->restore();
257 canvas->translate(SkIntToScalar(120), SkIntToScalar(0)); 257 canvas->translate(SkIntToScalar(120), SkIntToScalar(0));
258 258
259 // fourth column: stroked and filled paths 259 // fourth column: stroked and filled paths
260 paint.setStyle(SkPaint::kStrokeAndFill_Style); 260 paint.setStyle(SkPaint::kStrokeAndFill_Style);
261 paint.setStrokeCap(SkPaint::kButt_Cap); 261 paint.setStrokeCap(SkPaint::kButt_Cap);
262 for (size_t i = 0; i < N; i++) { 262 for (size_t i = 0; i < N; i++) {
263 paint.setStrokeWidth(gWidths[i]); 263 paint.setStrokeWidth(gWidths[i]);
264 paint.setStrokeMiter(gMiters[i]); 264 paint.setStrokeMiter(gMiters[i]);
265 canvas->drawPath(fPath[i], paint); 265 canvas->drawPath(fPath[i], paint);
266 canvas->translate(SkIntToScalar(0), fDY[i]); 266 canvas->translate(SkIntToScalar(0), fDY[i]);
267 } 267 }
268 268
269 } 269 }
270 270
271 private: 271 private:
272 typedef skiagm::GM INHERITED; 272 typedef skiagm::GM INHERITED;
273 }; 273 };
274 274
275 DEF_GM(return new SmallPathsGM;) 275 DEF_GM(return new SmallPathsGM;)
276
OLDNEW
« no previous file with comments | « gm/showmiplevels.cpp ('k') | gm/strokefill.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698