Flutter Engine
The Flutter Engine
Toggle main menu visibility
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Enumerations
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Properties
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Related Functions
:
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
z
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
v
w
y
Enumerator
b
c
d
e
f
g
h
k
l
m
n
p
r
s
t
u
v
w
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
third_party
skia
modules
skparagraph
bench
ParagraphBench.cpp
Go to the documentation of this file.
1
// Copyright 2019 Google LLC.
2
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3
4
#include "
bench/Benchmark.h
"
5
6
#if !defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) && !defined(SK_BUILD_FOR_GOOGLE3)
7
8
#include "
modules/skparagraph/include/FontCollection.h
"
9
#include "
modules/skparagraph/include/Paragraph.h
"
10
#include "
modules/skparagraph/src/ParagraphBuilderImpl.h
"
11
#include "
modules/skparagraph/src/ParagraphImpl.h
"
12
#include "
tools/Resources.h
"
13
#include "
tools/fonts/FontToolUtils.h
"
14
15
#include <cfloat>
16
#include "
include/core/SkPictureRecorder.h
"
17
#include "
modules/skparagraph/utils/TestFontCollection.h
"
18
19
using namespace
skia::textlayout
;
20
namespace
{
21
struct
ParagraphBench :
public
Benchmark
{
22
ParagraphBench(
SkScalar
width
,
const
char
* r,
const
char
* n)
23
: fResource(r),
fName
(n), fWidth(
width
) {}
24
sk_sp<SkData>
fData;
25
const
char
* fResource;
26
const
char
*
fName
;
27
SkScalar
fWidth;
28
const
char
*
onGetName
()
override
{
return
fName
; }
29
bool
isSuitableFor
(Backend
backend
)
override
{
return
backend
==
Backend::kNonRendering
; }
30
void
onDelayedSetup
()
override
{ fData =
GetResourceAsData
(fResource); }
31
void
onDraw
(
int
loops,
SkCanvas
*)
override
{
32
if
(!fData) {
33
return
;
34
}
35
36
const
char
*
text
= (
const
char
*)fData->
data
();
37
38
auto
fontCollection = sk_make_sp<FontCollection>();
39
fontCollection->setDefaultFontManager(
ToolUtils::TestFontMgr
());
40
ParagraphStyle
paragraph_style;
41
paragraph_style.
turnHintingOff
();
42
ParagraphBuilderImpl
builder
(paragraph_style, fontCollection);
43
builder
.addText(
text
);
44
auto
paragraph =
builder
.Build();
45
46
SkPictureRecorder
rec;
47
SkCanvas
* canvas = rec.
beginRecording
({0,0, 2000,3000});
48
while
(loops-- > 0) {
49
paragraph->layout(fWidth);
50
auto
impl =
static_cast<
ParagraphImpl
*
>
(paragraph.get());
51
paragraph->
paint
(canvas, 0, 0);
52
paragraph->markDirty();
53
impl->resetCache();
54
}
55
}
56
};
57
}
// namespace
58
59
#define PARAGRAPH_BENCH(X) DEF_BENCH(return new ParagraphBench(50000, "text/"
#X ".txt", "paragraph_" #X);)
60
//PARAGRAPH_BENCH(arabic)
61
//PARAGRAPH_BENCH(emoji)
62
PARAGRAPH_BENCH
(english)
63
#undef PARAGRAPH_BENCH
64
65
#endif
// !defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) && !defined(SK_BUILD_FOR_GOOGLE3)
Benchmark.h
backend
const char * backend
Definition:
CommonFlagsConfig.cpp:42
fName
const char * fName
Definition:
FontCacheBench.cpp:71
FontCollection.h
FontToolUtils.h
ParagraphBuilderImpl.h
ParagraphImpl.h
Paragraph.h
GetResourceAsData
sk_sp< SkData > GetResourceAsData(const char *resource)
Definition:
Resources.cpp:42
Resources.h
SkPictureRecorder.h
TestFontCollection.h
Benchmark
Definition:
Benchmark.h:36
Benchmark::Backend::kNonRendering
@ kNonRendering
Benchmark::onDraw
virtual void onDraw(int loops, SkCanvas *)=0
Benchmark::isSuitableFor
virtual bool isSuitableFor(Backend backend)
Definition:
Benchmark.h:55
Benchmark::onDelayedSetup
virtual void onDelayedSetup()
Definition:
Benchmark.h:101
Benchmark::onGetName
virtual const char * onGetName()=0
SkCanvas
Definition:
SkCanvas.h:106
SkData::data
const void * data() const
Definition:
SkData.h:37
SkPictureRecorder
Definition:
SkPictureRecorder.h:32
SkPictureRecorder::beginRecording
SkCanvas * beginRecording(const SkRect &bounds, sk_sp< SkBBoxHierarchy > bbh)
Definition:
SkPictureRecorder.cpp:35
sk_sp< SkData >
skia::textlayout::ParagraphBuilderImpl
Definition:
ParagraphBuilderImpl.h:20
skia::textlayout::ParagraphImpl
Definition:
ParagraphImpl.h:88
skia::textlayout::ParagraphImpl::paint
void paint(SkCanvas *canvas, SkScalar x, SkScalar y) override
Definition:
ParagraphImpl.cpp:243
SkScalar
float SkScalar
Definition:
extension.cpp:12
text
std::u16string text
Definition:
keyboard_unittests.cc:332
PARAGRAPH_BENCH
#define PARAGRAPH_BENCH(X)
Definition:
ParagraphBench.cpp:59
ToolUtils::TestFontMgr
sk_sp< SkFontMgr > TestFontMgr()
Definition:
FontToolUtils.cpp:247
dependency.builder
builder
Definition:
dependency.py:1
skia::textlayout
Definition:
DartTypes.h:14
width
int32_t width
Definition:
serialization_callbacks.cc:0
skia::textlayout::ParagraphStyle
Definition:
ParagraphStyle.h:78
skia::textlayout::ParagraphStyle::turnHintingOff
void turnHintingOff()
Definition:
ParagraphStyle.h:122
Generated on Sun Jun 23 2024 21:55:53 for Flutter Engine by
1.9.4