Flutter Engine
The Flutter Engine
ClipMaskBench.cpp
Go to the documentation of this file.
1/*
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
8#include "bench/Benchmark.h"
15#include "tools/ToolUtils.h"
16
17#include "include/core/SkPath.h"
19
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;
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 {
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;)
SkPath fPath
#define DEF_BENCH(code)
Definition: Benchmark.h:20
const char * fName
#define W
Definition: aaa.cpp:17
void onDraw(int loops, SkCanvas *canvas) override
const char * onGetName() override
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
Definition: SkPath.h:59
SkPath & moveTo(SkScalar x, SkScalar y)
Definition: SkPath.cpp:688
SkPath & cubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3)
Definition: SkPath.cpp:799
SkCanvas * getCanvas()
Definition: SkSurface.cpp:82
const Paint & paint
Definition: color_source.cc:38
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
Definition: SkMD5.cpp:130
static SkImageInfo MakeN32Premul(int width, int height)