Flutter Engine
The Flutter Engine
third_party
skia
src
gpu
ganesh
ops
SmallPathShapeData.h
Go to the documentation of this file.
1
/*
2
* Copyright 2020 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
#ifndef SmallPathShapeData_DEFINED
9
#define SmallPathShapeData_DEFINED
10
11
#if !defined(SK_ENABLE_OPTIMIZE_SIZE)
12
13
#include "
src/core/SkChecksum.h
"
14
#include "
src/gpu/ganesh/GrDrawOpAtlas.h
"
15
16
class
GrStyledShape
;
17
18
namespace
skgpu::ganesh
{
19
20
class
SmallPathShapeDataKey
{
21
public
:
22
// TODO: add a move variant
23
SmallPathShapeDataKey
(
const
SmallPathShapeDataKey
& that) {
24
fKey.
reset
(that.fKey.
count
());
25
memcpy(fKey.
get
(), that.fKey.
get
(), fKey.
count
() *
sizeof
(uint32_t));
26
}
27
28
SmallPathShapeDataKey
&
operator=
(
const
SmallPathShapeDataKey
&) =
delete
;
29
30
// for SDF paths
31
SmallPathShapeDataKey
(
const
GrStyledShape
&, uint32_t dim);
32
33
// for bitmap paths
34
SmallPathShapeDataKey
(
const
GrStyledShape
&,
const
SkMatrix
& ctm);
35
36
bool
operator==
(
const
SmallPathShapeDataKey
& that)
const
{
37
return
fKey.
count
() == that.fKey.
count
() &&
38
0 == memcmp(fKey.
get
(), that.fKey.
get
(),
sizeof
(uint32_t) * fKey.
count
());
39
}
40
41
int
count32
()
const
{
return
fKey.
count
(); }
42
const
uint32_t*
data
()
const
{
return
fKey.
get
(); }
43
44
private
:
45
// The key is composed of the GrStyledShape's key, and either the dimensions of the DF
46
// generated for the path (32x32 max, 64x64 max, 128x128 max) if an SDF image or
47
// the matrix for the path with only fractional translation.
48
skia_private::AutoSTArray<24, uint32_t>
fKey;
49
};
50
51
class
SmallPathShapeData
{
52
public
:
53
SmallPathShapeData
(
const
SmallPathShapeDataKey
&
key
) :
fKey
(
key
) {}
54
55
const
SmallPathShapeDataKey
fKey
;
56
SkRect
fBounds
;
57
skgpu::AtlasLocator
fAtlasLocator
;
58
59
SK_DECLARE_INTERNAL_LLIST_INTERFACE
(
SmallPathShapeData
);
60
61
static
inline
const
SmallPathShapeDataKey
&
GetKey
(
const
SmallPathShapeData
&
data
) {
62
return
data
.fKey;
63
}
64
65
static
inline
uint32_t
Hash
(
const
SmallPathShapeDataKey
&
key
) {
66
return
SkChecksum::Hash32
(
key
.data(),
sizeof
(uint32_t) *
key
.count32());
67
}
68
};
69
70
}
// namespace skgpu::ganesh
71
72
#endif
// SK_ENABLE_OPTIMIZE_SIZE
73
74
#endif
// SmallPathShapeData_DEFINED
GrDrawOpAtlas.h
SkChecksum.h
GrStyledShape
Definition:
GrStyledShape.h:49
SkMatrix
Definition:
SkMatrix.h:54
skgpu::AtlasLocator
Definition:
AtlasTypes.h:292
skgpu::ganesh::SmallPathShapeDataKey
Definition:
SmallPathShapeData.h:20
skgpu::ganesh::SmallPathShapeDataKey::data
const uint32_t * data() const
Definition:
SmallPathShapeData.h:42
skgpu::ganesh::SmallPathShapeDataKey::operator==
bool operator==(const SmallPathShapeDataKey &that) const
Definition:
SmallPathShapeData.h:36
skgpu::ganesh::SmallPathShapeDataKey::count32
int count32() const
Definition:
SmallPathShapeData.h:41
skgpu::ganesh::SmallPathShapeDataKey::operator=
SmallPathShapeDataKey & operator=(const SmallPathShapeDataKey &)=delete
skgpu::ganesh::SmallPathShapeDataKey::SmallPathShapeDataKey
SmallPathShapeDataKey(const SmallPathShapeDataKey &that)
Definition:
SmallPathShapeData.h:23
skgpu::ganesh::SmallPathShapeData
Definition:
SmallPathShapeData.h:51
skgpu::ganesh::SmallPathShapeData::fAtlasLocator
skgpu::AtlasLocator fAtlasLocator
Definition:
SmallPathShapeData.h:57
skgpu::ganesh::SmallPathShapeData::Hash
static uint32_t Hash(const SmallPathShapeDataKey &key)
Definition:
SmallPathShapeData.h:65
skgpu::ganesh::SmallPathShapeData::SK_DECLARE_INTERNAL_LLIST_INTERFACE
SK_DECLARE_INTERNAL_LLIST_INTERFACE(SmallPathShapeData)
skgpu::ganesh::SmallPathShapeData::fBounds
SkRect fBounds
Definition:
SmallPathShapeData.h:56
skgpu::ganesh::SmallPathShapeData::GetKey
static const SmallPathShapeDataKey & GetKey(const SmallPathShapeData &data)
Definition:
SmallPathShapeData.h:61
skgpu::ganesh::SmallPathShapeData::SmallPathShapeData
SmallPathShapeData(const SmallPathShapeDataKey &key)
Definition:
SmallPathShapeData.h:53
skgpu::ganesh::SmallPathShapeData::fKey
const SmallPathShapeDataKey fKey
Definition:
SmallPathShapeData.h:55
skia_private::AutoSTArray< 24, uint32_t >
skia_private::AutoSTArray::reset
void reset(int count)
Definition:
SkTemplates.h:195
skia_private::AutoSTArray::get
T * get() const
Definition:
SkTemplates.h:234
skia_private::AutoSTArray::count
int count() const
Definition:
SkTemplates.h:230
key
int key
Definition:
keyboard_key_handler_unittests.cc:114
SkChecksum::Hash32
uint32_t Hash32(const void *data, size_t bytes, uint32_t seed)
Definition:
SkChecksum.cpp:113
skgpu::ganesh
Definition:
TessellateBench.cpp:24
SkRect
Definition:
extension.cpp:13
data
std::shared_ptr< const fml::Mapping > data
Definition:
texture_gles.cc:63
Generated on Sun Jun 23 2024 21:56:23 for Flutter Engine by
1.9.4