blob: 8076bc96eb668ed7387efbb3ee627fd9890d3568 [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
reed5e0d9272016-08-18 15:01:10 -07008#include "SkBlurMask.h"
9#include "SkBlurMaskFilter.h"
10#include "SkPath.h"
Mike Kleinea3f0142019-03-20 11:12:10 -050011#include "ToolUtils.h"
12#include "gm.h"
reed5e0d9272016-08-18 15:01:10 -070013
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++) {
Mike Kleinea3f0142019-03-20 11:12:10 -050039 paint.setColor(ToolUtils::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
Mike Kleincd5104e2019-03-20 11:55:08 -050048 bool onAnimate(const AnimTimer& timer) override { return true; }
reed5e0d9272016-08-18 15:01:10 -070049
50private:
51
52 typedef GM INHERITED;
53};
54DEF_GM(return new SimpleRectGM;)