skia2/gm/simplerect.cpp
Mike Klein c0bd9f9fe5 rewrite includes to not need so much -Ifoo
Current strategy: everything from the top

Things to look at first are the manual changes:

   - added tools/rewrite_includes.py
   - removed -Idirectives from BUILD.gn
   - various compile.sh simplifications
   - tweak tools/embed_resources.py
   - update gn/find_headers.py to write paths from the top
   - update gn/gn_to_bp.py SkUserConfig.h layout
     so that #include "include/config/SkUserConfig.h" always
     gets the header we want.

No-Presubmit: true
Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-04-24 16:27:11 +00:00

55 lines
1.4 KiB
C++

/*
* 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/gm.h"
#include "include/core/SkPath.h"
#include "include/effects/SkBlurMaskFilter.h"
#include "src/core/SkBlurMask.h"
#include "tools/ToolUtils.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, 800);
}
void onDraw(SkCanvas* canvas) override {
canvas->translate(1, 1); // want to exercise non-identity ctm performance
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(ToolUtils::color_to_565(rand.nextU() | (0xFF << 24)));
SkScalar x = rand.nextRangeScalar(min, max);
SkScalar y = rand.nextRangeScalar(min, max);
SkScalar w = rand.nextRangeScalar(0, size);
SkScalar h = rand.nextRangeScalar(0, size);
canvas->drawRect(SkRect::MakeXYWH(x, y, w, h), paint);
}
}
bool onAnimate(const AnimTimer& timer) override { return true; }
private:
typedef GM INHERITED;
};
DEF_GM(return new SimpleRectGM;)