From 2dc50cc92af008155d98f3729828eae71f82930d Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Thu, 12 Apr 2018 12:20:25 -0400 Subject: 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 Reviewed-by: Florin Malita --- bench/ClipMaskBench.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'bench') 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 { SkColorSpace::MakeSRGB()); });) +///////// +#include "SkSurface.h" +#include "SkPath.h" + +class RasterTileBench : public Benchmark { + sk_sp 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;) -- cgit v1.2.3