aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2016-08-04 09:03:19 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-04 09:03:20 -0700
commit276d3286b32900d8b7e895c5224ceba1922d2391 (patch)
treeff4bdbe68e8d4106a9c9ba939d61ebd000ca6272 /bench
parent15c42ca310e8b9785eab38b3dd36265948e85b0e (diff)
Add new bench for occluded blurmaskfilter draws
w/ occluders 44/44 MB 6 497us 500us 500us 502us 0% .oOOooooOO gpu bluroccludedrrect w/o occluders 41/41 MB 5 1.08ms 1.09ms 1.12ms 1.47ms 11% .........O gpu bluroccludedrrect GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2203153002 Review-Url: https://codereview.chromium.org/2203153002
Diffstat (limited to 'bench')
-rw-r--r--bench/BlurOccludedRRectBench.cpp87
1 files changed, 87 insertions, 0 deletions
diff --git a/bench/BlurOccludedRRectBench.cpp b/bench/BlurOccludedRRectBench.cpp
new file mode 100644
index 0000000000..a2e8276776
--- /dev/null
+++ b/bench/BlurOccludedRRectBench.cpp
@@ -0,0 +1,87 @@
+/*
+ * 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 "Benchmark.h"
+#include "SkBlurMaskFilter.h"
+#include "SkCanvas.h"
+#include "SkPaint.h"
+#include "SkRRect.h"
+#include "SkRect.h"
+#include "sk_tool_utils.h"
+
+class BlurOccludedRRectBench : public Benchmark {
+public:
+ BlurOccludedRRectBench() {}
+
+ const char* onGetName() override {
+ return "bluroccludedrrect";
+ }
+
+ SkIPoint onGetSize() override {
+ return SkIPoint::Make(1024, 2048);
+ }
+
+ void onDraw(int loops, SkCanvas* canvas) override {
+ for (int l = 0; l < loops; ++l) {
+ canvas->clear(0xFFFAFAFA);
+
+ SkPaint opaque;
+ opaque.setAntiAlias(true);
+ opaque.setColor(SK_ColorWHITE);
+
+ const SkRect r = SkRect::MakeWH(480, 230);
+ const SkRRect rr = SkRRect::MakeRectXY(r, 8, 8);
+ //SkRect occRect = sk_tool_utils::compute_central_occluder(rr);
+
+ for (int i = 0; i < 2; ++i) {
+ canvas->save();
+
+ canvas->translate(i*502.0f+20, 10.0f);
+
+ for (int j = 0; j < 8; ++j) {
+ canvas->save();
+
+ canvas->translate(0.0f, j*256.0f);
+
+ SkPaint firstBlur;
+ firstBlur.setAntiAlias(true);
+ firstBlur.setColor(0x09000000);
+ firstBlur.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle,
+ 2.5f));
+ //, occRect));
+
+ canvas->drawRRect(rr, firstBlur);
+
+ canvas->save();
+ canvas->translate(1.5f, 1.5f);
+
+ SkPaint secondBlur;
+ secondBlur.setAntiAlias(true);
+ secondBlur.setColor(0x30000000);
+ secondBlur.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle,
+ 6.0f));
+ //, occRect));
+
+ canvas->drawRRect(rr, secondBlur);
+
+ canvas->restore();
+
+ canvas->drawRRect(rr, opaque);
+
+ canvas->restore();
+ }
+
+ canvas->restore();
+ }
+ }
+ }
+
+private:
+ typedef Benchmark INHERITED;
+};
+
+DEF_BENCH(return new BlurOccludedRRectBench();)