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

Unified 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, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gyp/gmslides.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/addarc.cpp
diff --git a/gm/addarc.cpp b/gm/addarc.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..209fb59aef77cfc66a8dc2fdf8d0a5dda3816870
--- /dev/null
+++ b/gm/addarc.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "gm.h"
+#include "SkCanvas.h"
+#include "SkRandom.h"
+
+class AddArcGM : public skiagm::GM {
+protected:
+ SkString onShortName() SK_OVERRIDE { return SkString("addarc"); }
+
+ SkISize onISize() SK_OVERRIDE { return SkISize::Make(1040, 1040); }
+
+ void onDraw(SkCanvas* canvas) SK_OVERRIDE {
+ canvas->translate(20, 20);
+
+ SkRect r = SkRect::MakeWH(1000, 1000);
+
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ paint.setStyle(SkPaint::kStroke_Style);
+ paint.setStrokeWidth(15);
+
+ const SkScalar inset = paint.getStrokeWidth() + 4;
+ const SkScalar sweepAngle = 345;
+ SkRandom rand;
+
+ while (r.width() > paint.getStrokeWidth() * 3) {
+ paint.setColor(rand.nextU() | (0xFF << 24));
+ SkScalar startAngle = rand.nextUScalar1() * 360;
+
+ SkPath path;
+ path.addArc(r, startAngle, sweepAngle);
+ canvas->drawPath(path, paint);
+
+ r.inset(inset, inset);
+
+ }
+ }
+
+private:
+ typedef skiagm::GM INHERITED;
+};
+DEF_GM( return new AddArcGM; )
« 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