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

Side by Side Diff: gm/addarc.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/aaxfermodes.cpp ('k') | gm/anisotropic.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 "SkAnimTimer.h" 9 #include "SkAnimTimer.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 DEF_GM( return new AddArcMeasGM; ) 113 DEF_GM( return new AddArcMeasGM; )
114 114
115 /////////////////////////////////////////////////// 115 ///////////////////////////////////////////////////
116 116
117 // Emphasize drawing a stroked oval (containing conics) and then scaling the res ults up, 117 // Emphasize drawing a stroked oval (containing conics) and then scaling the res ults up,
118 // to ensure that we compute the stroke taking the CTM into account 118 // to ensure that we compute the stroke taking the CTM into account
119 // 119 //
120 class StrokeCircleGM : public skiagm::GM { 120 class StrokeCircleGM : public skiagm::GM {
121 public: 121 public:
122 StrokeCircleGM() : fRotate(0) {} 122 StrokeCircleGM() : fRotate(0) {}
123 123
124 protected: 124 protected:
125 SkString onShortName() override { return SkString("strokecircle"); } 125 SkString onShortName() override { return SkString("strokecircle"); }
126 126
127 SkISize onISize() override { return SkISize::Make(520, 520); } 127 SkISize onISize() override { return SkISize::Make(520, 520); }
128 128
129 void onDraw(SkCanvas* canvas) override { 129 void onDraw(SkCanvas* canvas) override {
130 canvas->scale(20, 20); 130 canvas->scale(20, 20);
131 canvas->translate(13, 13); 131 canvas->translate(13, 13);
132 132
133 SkPaint paint; 133 SkPaint paint;
134 paint.setAntiAlias(true); 134 paint.setAntiAlias(true);
135 paint.setStyle(SkPaint::kStroke_Style); 135 paint.setStyle(SkPaint::kStroke_Style);
136 paint.setStrokeWidth(SK_Scalar1 / 2); 136 paint.setStrokeWidth(SK_Scalar1 / 2);
137 137
138 const SkScalar delta = paint.getStrokeWidth() * 3 / 2; 138 const SkScalar delta = paint.getStrokeWidth() * 3 / 2;
(...skipping 30 matching lines...) Expand all
169 SkScalar end, bool ccw) { 169 SkScalar end, bool ccw) {
170 SkRect bounds = { x - r, y - r, x + r, y + r }; 170 SkRect bounds = { x - r, y - r, x + r, y + r };
171 SkScalar sweep = ccw ? end - start : start - end; 171 SkScalar sweep = ccw ? end - start : start - end;
172 path->arcTo(bounds, start, sweep, false); 172 path->arcTo(bounds, start, sweep, false);
173 } 173 }
174 174
175 // Lifted from canvas-arc-circumference-fill-diffs.html 175 // Lifted from canvas-arc-circumference-fill-diffs.html
176 class ManyArcsGM : public skiagm::GM { 176 class ManyArcsGM : public skiagm::GM {
177 public: 177 public:
178 ManyArcsGM() {} 178 ManyArcsGM() {}
179 179
180 protected: 180 protected:
181 SkString onShortName() override { return SkString("manyarcs"); } 181 SkString onShortName() override { return SkString("manyarcs"); }
182 182
183 SkISize onISize() override { return SkISize::Make(620, 330); } 183 SkISize onISize() override { return SkISize::Make(620, 330); }
184 184
185 void onDraw(SkCanvas* canvas) override { 185 void onDraw(SkCanvas* canvas) override {
186 SkPaint paint; 186 SkPaint paint;
187 paint.setAntiAlias(true); 187 paint.setAntiAlias(true);
188 paint.setStyle(SkPaint::kStroke_Style); 188 paint.setStyle(SkPaint::kStroke_Style);
189 189
190 canvas->translate(10, 10); 190 canvas->translate(10, 10);
191 191
192 // 20 angles. 192 // 20 angles.
193 SkScalar sweepAngles[] = { 193 SkScalar sweepAngles[] = {
194 -123.7f, -2.3f, -2, -1, -0.3f, -0.000001f, 0, 0.00000 1f, 0.3f, 0.7f, 194 -123.7f, -2.3f, -2, -1, -0.3f, -0.000001f, 0, 0.00000 1f, 0.3f, 0.7f,
195 1, 1.3f, 1.5f, 1.7f, 1.99999f, 2, 2.00001f, 2.3f, 4.3 f, 3934723942837.3f 195 1, 1.3f, 1.5f, 1.7f, 1.99999f, 2, 2.00001f, 2.3f, 4.3 f, 3934723942837.3f
196 }; 196 };
197 for (size_t i = 0; i < SK_ARRAY_COUNT(sweepAngles); ++i) { 197 for (size_t i = 0; i < SK_ARRAY_COUNT(sweepAngles); ++i) {
198 sweepAngles[i] *= 180; 198 sweepAngles[i] *= 180;
199 } 199 }
200 200
201 SkScalar startAngles[] = { -1, -0.5f, 0, 0.5f }; 201 SkScalar startAngles[] = { -1, -0.5f, 0, 0.5f };
202 for (size_t i = 0; i < SK_ARRAY_COUNT(startAngles); ++i) { 202 for (size_t i = 0; i < SK_ARRAY_COUNT(startAngles); ++i) {
203 startAngles[i] *= 180; 203 startAngles[i] *= 180;
204 } 204 }
205 205
206 bool anticlockwise = false; 206 bool anticlockwise = false;
207 SkScalar sign = 1; 207 SkScalar sign = 1;
208 for (size_t i = 0; i < SK_ARRAY_COUNT(startAngles) * 2; ++i) { 208 for (size_t i = 0; i < SK_ARRAY_COUNT(startAngles) * 2; ++i) {
209 if (i == SK_ARRAY_COUNT(startAngles)) { 209 if (i == SK_ARRAY_COUNT(startAngles)) {
210 anticlockwise = true; 210 anticlockwise = true;
211 sign = -1; 211 sign = -1;
212 } 212 }
213 SkScalar startAngle = startAngles[i % SK_ARRAY_COUNT(startAngles)] * sign; 213 SkScalar startAngle = startAngles[i % SK_ARRAY_COUNT(startAngles)] * sign;
214 canvas->save(); 214 canvas->save();
215 for (size_t j = 0; j < SK_ARRAY_COUNT(sweepAngles); ++j) { 215 for (size_t j = 0; j < SK_ARRAY_COUNT(sweepAngles); ++j) {
216 SkPath path; 216 SkPath path;
217 path.moveTo(0, 2); 217 path.moveTo(0, 2);
218 html_canvas_arc(&path, 18, 15, 10, startAngle, startAngle + (swe epAngles[j] * sign), 218 html_canvas_arc(&path, 18, 15, 10, startAngle, startAngle + (swe epAngles[j] * sign),
219 anticlockwise); 219 anticlockwise);
220 path.lineTo(0, 28); 220 path.lineTo(0, 28);
221 canvas->drawPath(path, paint); 221 canvas->drawPath(path, paint);
222 canvas->translate(30, 0); 222 canvas->translate(30, 0);
223 } 223 }
224 canvas->restore(); 224 canvas->restore();
225 canvas->translate(0, 40); 225 canvas->translate(0, 40);
226 } 226 }
227 } 227 }
228 228
229 private: 229 private:
230 typedef skiagm::GM INHERITED; 230 typedef skiagm::GM INHERITED;
231 }; 231 };
232 DEF_GM( return new ManyArcsGM; ) 232 DEF_GM( return new ManyArcsGM; )
233
OLDNEW
« no previous file with comments | « gm/aaxfermodes.cpp ('k') | gm/anisotropic.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698