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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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 2016 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 "SkBlurMask.h"
10 #include "SkBlurMaskFilter.h"
11 #include "SkPath.h"
12
13 class SimpleRectGM : public skiagm::GM {
14 public:
15 SimpleRectGM() {}
16
17 protected:
18 SkString onShortName() override {
19 SkString name;
20 name.printf("simplerect");
21 return name;
22 }
23
24 SkISize onISize() override {
25 return SkISize::Make(800, 600);
26 }
27
28 void onDraw(SkCanvas* canvas) override {
29 const SkScalar min = -20;
30 const SkScalar max = 800;
31 const SkScalar size = 20;
32
33 SkRandom rand;
34 SkPaint paint;
35 for (int i = 0; i < 10000; i++) {
36 paint.setColor(sk_tool_utils::color_to_565(rand.nextU() | (0xFF << 2 4)));
37 canvas->drawRect(SkRect::MakeXYWH(rand.nextRangeScalar(min, max),
38 rand.nextRangeScalar(min, max),
39 rand.nextRangeScalar(0, size),
40 rand.nextRangeScalar(0, size)),
41 paint);
42 }
43 }
44
45 bool onAnimate(const SkAnimTimer& timer) override {
46 return true;
47 }
48
49 private:
50
51 typedef GM INHERITED;
52 };
53 DEF_GM(return new SimpleRectGM;)
OLDNEW
« 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