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

Side by Side Diff: gm/strokes.cpp

Issue 1311273002: fix zero-length tangent (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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 | « no previous file | src/core/SkGeometry.cpp » ('j') | src/core/SkGeometry.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 #include "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 paint.setStrokeWidth(0.055f); 259 paint.setStrokeWidth(0.055f);
260 260
261 canvas->scale(1000, 1000); 261 canvas->scale(1000, 1000);
262 canvas->drawCircle(0, 2, 1.97f, paint); 262 canvas->drawCircle(0, 2, 1.97f, paint);
263 } 263 }
264 264
265 private: 265 private:
266 typedef skiagm::GM INHERITED; 266 typedef skiagm::GM INHERITED;
267 }; 267 };
268 268
269 class Strokes5GM : public skiagm::GM {
reed1 2015/08/24 20:15:46 // We want to explicitly test stroking (which need
caryclark 2015/08/25 12:04:48 Done.
270 public:
271 Strokes5GM() {}
272
273 protected:
274
275 SkString onShortName() override {
276 return SkString("zero_control_stroke");
277 }
278
279 SkISize onISize() override {
280 return SkISize::Make(W, H*2);
281 }
282
283 void onDraw(SkCanvas* canvas) override {
284 SkPaint p;
285 p.setColor(SK_ColorRED);
286 p.setAntiAlias(true);
287 p.setStyle(SkPaint::kStroke_Style);
288 p.setStrokeWidth(40);
289 p.setStrokeCap(SkPaint::kButt_Cap);
290
291 SkPath path;
292 path.moveTo(157.474f,111.753f);
293 path.cubicTo(128.5f,111.5f,35.5f,29.5f,35.5f,29.5f);
294 canvas->drawPath(path, p);
295 path.reset();
296 path.moveTo(250, 50);
297 path.quadTo(280, 80, 280, 80);
298 canvas->drawPath(path, p);
299 path.reset();
300 path.moveTo(150, 50);
301 path.conicTo(180, 80, 180, 80, 0.707f);
302 canvas->drawPath(path, p);
303
304 path.reset();
305 path.moveTo(157.474f,311.753f);
306 path.cubicTo(157.474f,311.753f,85.5f,229.5f,35.5f,229.5f);
307 canvas->drawPath(path, p);
308 path.reset();
309 path.moveTo(280, 250);
310 path.quadTo(280, 250, 310, 280);
311 canvas->drawPath(path, p);
312 path.reset();
313 path.moveTo(180, 250);
314 path.conicTo(180, 250, 210, 280, 0.707f);
315 canvas->drawPath(path, p);
316 }
317
318 private:
319 typedef skiagm::GM INHERITED;
320 };
321
269 322
270 ////////////////////////////////////////////////////////////////////////////// 323 //////////////////////////////////////////////////////////////////////////////
271 324
272 static skiagm::GM* F0(void*) { return new StrokesGM; } 325 static skiagm::GM* F0(void*) { return new StrokesGM; }
273 static skiagm::GM* F1(void*) { return new Strokes2GM; } 326 static skiagm::GM* F1(void*) { return new Strokes2GM; }
274 static skiagm::GM* F2(void*) { return new Strokes3GM; } 327 static skiagm::GM* F2(void*) { return new Strokes3GM; }
275 static skiagm::GM* F3(void*) { return new Strokes4GM; } 328 static skiagm::GM* F3(void*) { return new Strokes4GM; }
329 static skiagm::GM* F4(void*) { return new Strokes5GM; }
276 330
277 static skiagm::GMRegistry R0(F0); 331 static skiagm::GMRegistry R0(F0);
278 static skiagm::GMRegistry R1(F1); 332 static skiagm::GMRegistry R1(F1);
279 static skiagm::GMRegistry R2(F2); 333 static skiagm::GMRegistry R2(F2);
280 static skiagm::GMRegistry R3(F3); 334 static skiagm::GMRegistry R3(F3);
335 static skiagm::GMRegistry R4(F4);
OLDNEW
« no previous file with comments | « no previous file | src/core/SkGeometry.cpp » ('j') | src/core/SkGeometry.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698