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

Unified Diff: gm/simplerect.cpp

Issue 2257263002: add simplerect gm (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleanup Created 4 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/simplerect.cpp
diff --git a/gm/simplerect.cpp b/gm/simplerect.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..f6c144e2939560a58edd235d87cc6c00aa9458e8
--- /dev/null
+++ b/gm/simplerect.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2016 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 "SkBlurMask.h"
+#include "SkBlurMaskFilter.h"
+#include "SkPath.h"
+
+class SimpleRectGM : public skiagm::GM {
+public:
+ SimpleRectGM() {}
+
+protected:
+ SkString onShortName() override {
+ SkString name;
+ name.printf("simplerect");
+ return name;
+ }
+
+ SkISize onISize() override {
+ return SkISize::Make(800, 600);
+ }
+
+ void onDraw(SkCanvas* canvas) override {
+ const SkScalar min = -20;
+ const SkScalar max = 800;
+ const SkScalar size = 20;
+
+ SkRandom rand;
+ SkPaint paint;
+ for (int i = 0; i < 10000; i++) {
+ paint.setColor(sk_tool_utils::color_to_565(rand.nextU() | (0xFF << 24)));
+ canvas->drawRect(SkRect::MakeXYWH(rand.nextRangeScalar(min, max),
+ rand.nextRangeScalar(min, max),
+ rand.nextRangeScalar(0, size),
+ rand.nextRangeScalar(0, size)),
+ paint);
+ }
+ }
+
+ bool onAnimate(const SkAnimTimer& timer) override {
+ return true;
+ }
+
+private:
+
+ typedef GM INHERITED;
+};
+DEF_GM(return new SimpleRectGM;)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698