blob: d9c192795b5dea93a0aeeed71a5a84a1d0d68673 [file] [log] [blame]
Florin Malitac3b10a32017-05-02 11:09:01 -04001/*
2 * Copyright 2017 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
Mike Kleinc0bd9f92019-04-23 12:05:21 -05008#include "bench/Benchmark.h"
9#include "include/core/SkCanvas.h"
10#include "include/core/SkColorSpace.h"
11#include "include/core/SkImage.h"
12#include "include/core/SkPictureRecorder.h"
13#include "include/core/SkString.h"
14#include "include/core/SkSurface.h"
15#include "tools/ToolUtils.h"
Florin Malitac3b10a32017-05-02 11:09:01 -040016
Mike Kleinc0bd9f92019-04-23 12:05:21 -050017#include "include/core/SkPath.h"
18#include "include/core/SkSurface.h"
Mike Reed2dc50cc2018-04-12 12:20:25 -040019
20class RasterTileBench : public Benchmark {
21 sk_sp<SkSurface> fSurf;
22 SkPath fPath;
23 SkString fName;
24public:
25 RasterTileBench() : fName("rastertile") {
26 int W = 2014 * 20;
27 int H = 20;
28 fSurf = SkSurface::MakeRasterN32Premul(W, H);
29
30 fPath.moveTo(0, 0);
31 fPath.cubicTo(20, 10, 10, 15, 30, 5);
32 }
33
34protected:
35 const char* onGetName() override { return fName.c_str(); }
36
37 void onDraw(int loops, SkCanvas* canvas) override {
38 SkPaint paint;
39 paint.setStyle(SkPaint::kStroke_Style);
40 paint.setStrokeWidth(1.1f);
41 paint.setAntiAlias(true);
42
43 for (int i = 0; i < loops; ++i) {
44 for (int j = 0; j < 1000; ++j) {
45 fSurf->getCanvas()->drawPath(fPath, paint);
46 }
47 }
48 }
49
50private:
51};
52DEF_BENCH(return new RasterTileBench;)