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