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

Side by Side Diff: gm/addarc.cpp

Issue 888663002: add new gm for SkPath::addArc() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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 | gyp/gmslides.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "gm.h"
9 #include "SkCanvas.h"
10 #include "SkRandom.h"
11
12 class AddArcGM : public skiagm::GM {
13 protected:
14 SkString onShortName() SK_OVERRIDE { return SkString("addarc"); }
15
16 SkISize onISize() SK_OVERRIDE { return SkISize::Make(1040, 1040); }
17
18 void onDraw(SkCanvas* canvas) SK_OVERRIDE {
19 canvas->translate(20, 20);
20
21 SkRect r = SkRect::MakeWH(1000, 1000);
22
23 SkPaint paint;
24 paint.setAntiAlias(true);
25 paint.setStyle(SkPaint::kStroke_Style);
26 paint.setStrokeWidth(15);
27
28 const SkScalar inset = paint.getStrokeWidth() + 4;
29 const SkScalar sweepAngle = 345;
30 SkRandom rand;
31
32 while (r.width() > paint.getStrokeWidth() * 3) {
33 paint.setColor(rand.nextU() | (0xFF << 24));
34 SkScalar startAngle = rand.nextUScalar1() * 360;
35
36 SkPath path;
37 path.addArc(r, startAngle, sweepAngle);
38 canvas->drawPath(path, paint);
39
40 r.inset(inset, inset);
41
42 }
43 }
44
45 private:
46 typedef skiagm::GM INHERITED;
47 };
48 DEF_GM( return new AddArcGM; )
OLDNEW
« no previous file with comments | « no previous file | gyp/gmslides.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698