diff options
author | reed <reed@google.com> | 2016-08-18 15:01:10 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-18 15:01:11 -0700 |
commit | 5e0d92769439db419b78190e76f16f0ece414987 (patch) | |
tree | 3e3eab95ca4366d1c38d3fea51a3b8bff2ca6686 /gm/simplerect.cpp | |
parent | da082a5767d7edfd3abe74fc683392422565a606 (diff) |
add simplerect gm
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2257263002
TBR=bsalomon
NOTRY=True
Review-Url: https://codereview.chromium.org/2257263002
Diffstat (limited to 'gm/simplerect.cpp')
-rw-r--r-- | gm/simplerect.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/gm/simplerect.cpp b/gm/simplerect.cpp new file mode 100644 index 0000000000..f6c144e293 --- /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;) |