blob: b27c348ce137850afba87c83f784ab1fa5ff2d43 [file] [log] [blame]
reed5e0d9272016-08-18 15:01:10 -07001/*
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"
Mike Klein33d20552017-03-22 13:47:51 -04009#include "sk_tool_utils.h"
reed5e0d9272016-08-18 15:01:10 -070010#include "SkBlurMask.h"
11#include "SkBlurMaskFilter.h"
12#include "SkPath.h"
13
14class SimpleRectGM : public skiagm::GM {
15public:
16 SimpleRectGM() {}
17
18protected:
19 SkString onShortName() override {
20 SkString name;
21 name.printf("simplerect");
22 return name;
23 }
24
25 SkISize onISize() override {
reedc1fb8e82016-08-18 19:35:52 -070026 return SkISize::Make(800, 800);
reed5e0d9272016-08-18 15:01:10 -070027 }
28
29 void onDraw(SkCanvas* canvas) override {
reed577e0122016-08-21 15:03:47 -070030 canvas->translate(1, 1); // want to exercise non-identity ctm performance
31
reed5e0d9272016-08-18 15:01:10 -070032 const SkScalar min = -20;
33 const SkScalar max = 800;
34 const SkScalar size = 20;
35
36 SkRandom rand;
37 SkPaint paint;
38 for (int i = 0; i < 10000; i++) {
39 paint.setColor(sk_tool_utils::color_to_565(rand.nextU() | (0xFF << 24)));
reedc1fb8e82016-08-18 19:35:52 -070040 SkScalar x = rand.nextRangeScalar(min, max);
41 SkScalar y = rand.nextRangeScalar(min, max);
42 SkScalar w = rand.nextRangeScalar(0, size);
43 SkScalar h = rand.nextRangeScalar(0, size);
44 canvas->drawRect(SkRect::MakeXYWH(x, y, w, h), paint);
reed5e0d9272016-08-18 15:01:10 -070045 }
46 }
47
48 bool onAnimate(const SkAnimTimer& timer) override {
49 return true;
50 }
51
52private:
53
54 typedef GM INHERITED;
55};
56DEF_GM(return new SimpleRectGM;)