c0bd9f9fe5
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>
81 lines
2.3 KiB
C++
81 lines
2.3 KiB
C++
/*
|
|
* Copyright 2014 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#include "bench/Benchmark.h"
|
|
#include "include/core/SkCanvas.h"
|
|
#include "include/core/SkMaskFilter.h"
|
|
#include "include/core/SkPaint.h"
|
|
#include "include/core/SkPath.h"
|
|
#include "include/core/SkRect.h"
|
|
#include "include/core/SkString.h"
|
|
|
|
class BlurRectsBench : public Benchmark {
|
|
public:
|
|
BlurRectsBench(SkRect outer, SkRect inner, SkScalar radius) {
|
|
fRadius = radius;
|
|
fOuter = outer;
|
|
fInner = inner;
|
|
}
|
|
|
|
const char* onGetName() override {
|
|
return fName.c_str();
|
|
}
|
|
|
|
void setName(const SkString& name) {
|
|
fName = name;
|
|
}
|
|
|
|
void onDraw(int loops, SkCanvas* canvas) override {
|
|
SkPaint paint;
|
|
paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, fRadius));
|
|
|
|
SkPath path;
|
|
path.addRect(fOuter, SkPath::kCW_Direction);
|
|
path.addRect(fInner, SkPath::kCW_Direction);
|
|
|
|
for (int i = 0; i < loops; i++) {
|
|
canvas->drawPath(path, paint);
|
|
}
|
|
}
|
|
|
|
private:
|
|
SkString fName;
|
|
SkRect fOuter;
|
|
SkRect fInner;
|
|
SkScalar fRadius;
|
|
|
|
typedef Benchmark INHERITED;
|
|
};
|
|
|
|
class BlurRectsNinePatchBench: public BlurRectsBench {
|
|
public:
|
|
BlurRectsNinePatchBench(SkRect outer, SkRect inner, SkScalar radius)
|
|
: INHERITED(outer, inner, radius) {
|
|
this->setName(SkString("blurrectsninepatch"));
|
|
}
|
|
private:
|
|
typedef BlurRectsBench INHERITED;
|
|
};
|
|
|
|
class BlurRectsNonNinePatchBench: public BlurRectsBench {
|
|
public:
|
|
BlurRectsNonNinePatchBench(SkRect outer, SkRect inner, SkScalar radius)
|
|
: INHERITED(outer, inner, radius) {
|
|
SkString name;
|
|
this->setName(SkString("blurrectsnonninepatch"));
|
|
}
|
|
private:
|
|
typedef BlurRectsBench INHERITED;
|
|
};
|
|
|
|
DEF_BENCH(return new BlurRectsNinePatchBench(SkRect::MakeXYWH(10, 10, 100, 100),
|
|
SkRect::MakeXYWH(20, 20, 60, 60),
|
|
2.3f);)
|
|
DEF_BENCH(return new BlurRectsNonNinePatchBench(SkRect::MakeXYWH(10, 10, 100, 100),
|
|
SkRect::MakeXYWH(50, 50, 10, 10),
|
|
4.3f);)
|