Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
bench
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
"
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
"
16
17
#include "
include/core/SkPath.h
"
18
#include "
include/core/SkSurface.h
"
19
20
class
RasterTileBench
:
public
Benchmark
{
21
sk_sp<SkSurface>
fSurf;
22
SkPath
fPath;
23
SkString
fName;
24
public
:
25
RasterTileBench
() :
fName
(
"rastertile"
) {
26
int
W
= 2014 * 20;
27
int
H
= 20;
28
fSurf =
SkSurfaces::Raster
(
SkImageInfo::MakeN32Premul
(
W
,
H
));
29
30
fPath
.
moveTo
(0, 0);
31
fPath
.
cubicTo
(20, 10, 10, 15, 30, 5);
32
}
33
34
protected
:
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
50
private
:
51
};
52
DEF_BENCH
(
return
new
RasterTileBench
;)
fPath
SkPath fPath
Definition
AAConvexPathRenderer.cpp:886
Benchmark.h
DEF_BENCH
#define DEF_BENCH(code)
Definition
Benchmark.h:20
fName
const char * fName
Definition
FontCacheBench.cpp:71
SkCanvas.h
SkColorSpace.h
SkImage.h
SkPath.h
SkPictureRecorder.h
SkString.h
SkSurface.h
ToolUtils.h
W
#define W
Definition
aaa.cpp:17
Benchmark
Definition
Benchmark.h:36
RasterTileBench
Definition
ClipMaskBench.cpp:20
RasterTileBench::RasterTileBench
RasterTileBench()
Definition
ClipMaskBench.cpp:25
RasterTileBench::onDraw
void onDraw(int loops, SkCanvas *canvas) override
Definition
ClipMaskBench.cpp:37
RasterTileBench::onGetName
const char * onGetName() override
Definition
ClipMaskBench.cpp:35
SkCanvas
Definition
SkCanvas.h:106
SkPaint
Definition
SkPaint.h:44
SkPaint::kStroke_Style
@ kStroke_Style
set to stroke geometry
Definition
SkPaint.h:194
SkPath
Definition
SkPath.h:59
SkPath::moveTo
SkPath & moveTo(SkScalar x, SkScalar y)
Definition
SkPath.cpp:678
SkPath::cubicTo
SkPath & cubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3)
Definition
SkPath.cpp:789
SkString
Definition
SkString.h:118
sk_sp
Definition
SkRefCnt.h:220
paint
const Paint & paint
Definition
color_source.cc:38
SkSurfaces::Raster
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
Definition
SkSurface_Raster.cpp:186
H
Definition
SkMD5.cpp:130
SkImageInfo::MakeN32Premul
static SkImageInfo MakeN32Premul(int width, int height)
Definition
SkImageInfo.cpp:157
Generated on Fri Apr 26 2024 06:15:24 for Flutter Engine by
1.9.8