aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2018-04-12 12:20:25 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-04-12 16:22:30 +0000
commit2dc50cc92af008155d98f3729828eae71f82930d (patch)
tree05e72f1ea8e03d30b33016800a2890d1d4cc7664 /bench
parentdd8ae14528bd8e37bcb98f4c452acf21850c4b3b (diff)
add conservative bounds to raster tiling
This allows the tiler to optimally visit only the tiles that might intersect the drawing. Not all call-sites can cheaply compute their bounds, so for those we just pass nullptr, which tells the tiler to visit all of the tiles. Bug: 818693 Bug: 820245 Bug: 820470 Change-Id: I8bda668a99bcdb2a9a74a8278ec0cf1004acba6e Reviewed-on: https://skia-review.googlesource.com/119570 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'bench')
-rw-r--r--bench/ClipMaskBench.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/bench/ClipMaskBench.cpp b/bench/ClipMaskBench.cpp
index fc3cc16705..b3b98f2fed 100644
--- a/bench/ClipMaskBench.cpp
+++ b/bench/ClipMaskBench.cpp
@@ -66,3 +66,40 @@ DEF_BENCH(return new ClipMaskBench("picture", [](int size) -> sk_sp<SkImage> {
SkColorSpace::MakeSRGB());
});)
+/////////
+#include "SkSurface.h"
+#include "SkPath.h"
+
+class RasterTileBench : public Benchmark {
+ sk_sp<SkSurface> fSurf;
+ SkPath fPath;
+ SkString fName;
+public:
+ RasterTileBench() : fName("rastertile") {
+ int W = 2014 * 20;
+ int H = 20;
+ fSurf = SkSurface::MakeRasterN32Premul(W, H);
+
+ fPath.moveTo(0, 0);
+ fPath.cubicTo(20, 10, 10, 15, 30, 5);
+ }
+
+protected:
+ const char* onGetName() override { return fName.c_str(); }
+
+ void onDraw(int loops, SkCanvas* canvas) override {
+ SkPaint paint;
+ paint.setStyle(SkPaint::kStroke_Style);
+ paint.setStrokeWidth(1.1f);
+ paint.setAntiAlias(true);
+
+ for (int i = 0; i < loops; ++i) {
+ for (int j = 0; j < 1000; ++j) {
+ fSurf->getCanvas()->drawPath(fPath, paint);
+ }
+ }
+ }
+
+private:
+};
+DEF_BENCH(return new RasterTileBench;)