Flutter Engine
The Flutter Engine
third_party
skia
include
gpu
graphite
precompile
PrecompileBase.h
Go to the documentation of this file.
1
/*
2
* Copyright 2024 Google LLC
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 skgpu_graphite_precompile_PrecompileBase_DEFINED
9
#define skgpu_graphite_precompile_PrecompileBase_DEFINED
10
11
#include "
include/core/SkRefCnt.h
"
12
#include "
include/core/SkSpan.h
"
13
14
namespace
skgpu::graphite
{
15
16
class
KeyContext;
17
class
PaintParamsKeyBuilder;
18
class
PipelineDataGatherer;
19
class
PrecompileBasePriv;
20
21
/** \class PrecompileBase
22
This is the base class for all the objects that can be attached to PaintOptions.
23
*/
24
class
SK_API
PrecompileBase
:
public
SkRefCnt
{
25
public
:
26
enum class
Type
{
27
kBlender,
28
kColorFilter,
29
kImageFilter,
30
kMaskFilter,
31
kShader,
32
};
33
34
Type
type
()
const
{
return
fType; }
35
36
// Provides access to functions that aren't part of the public API.
37
PrecompileBasePriv
priv
();
38
const
PrecompileBasePriv
priv
()
const
;
// NOLINT(readability-const-return-type)
39
40
protected
:
41
PrecompileBase
(
Type
type
) : fType(
type
) {}
42
43
virtual
int
numIntrinsicCombinations
()
const
{
return
1; }
44
virtual
int
numChildCombinations
()
const
{
return
1; }
45
46
/** This call returns the number of combinations generated from this object and its childen.
47
48
@return number of precompilation combinations generated by this object
49
*/
50
int
numCombinations
()
const
{
51
return
this->numIntrinsicCombinations() * this->numChildCombinations();
52
}
53
54
virtual
void
addToKey
(
const
KeyContext
&,
55
PaintParamsKeyBuilder
*,
56
PipelineDataGatherer
*,
57
int
desiredCombination)
const
= 0;
58
59
// This returns the desired option along with the child options.
60
template
<
typename
T>
61
static
std::pair<sk_sp<T>,
int
> SelectOption(
SkSpan
<
const
sk_sp<T>
>
options
,
62
int
desiredOption);
63
64
// In general, derived classes should use AddToKey to select the desired child option from
65
// a span and then have it added to the key with its reduced/nested child option.
66
template
<
typename
T>
67
static
void
AddToKey
(
const
KeyContext
&,
68
PaintParamsKeyBuilder
*,
69
PipelineDataGatherer
*,
70
SkSpan
<
const
sk_sp<T>
>
options
,
71
int
desiredOption);
72
73
private
:
74
friend
class
PaintOptions
;
// for access to SelectOption
75
friend
class
PrecompileBasePriv
;
76
77
Type
fType;
78
};
79
80
}
// namespace skgpu::graphite
81
82
#endif
// skgpu_graphite_precompile_PrecompileBase_DEFINED
options
const char * options
Definition:
CommonFlagsConfig.cpp:43
SK_API
#define SK_API
Definition:
SkAPI.h:35
SkRefCnt.h
SkSpan.h
type
GLenum type
Definition:
blit_command_gles.cc:126
SkRefCnt
Definition:
SkRefCnt.h:119
SkSpan
Definition:
SkSpan_impl.h:65
sk_sp
Definition:
SkRefCnt.h:220
skgpu::graphite::KeyContext
Definition:
KeyContext.h:29
skgpu::graphite::PaintOptions
Definition:
PaintOptions.h:50
skgpu::graphite::PaintParamsKeyBuilder
Definition:
PaintParamsKey.h:113
skgpu::graphite::PipelineDataGatherer
Definition:
PipelineData.h:91
skgpu::graphite::PrecompileBasePriv
Definition:
PrecompileBasePriv.h:18
skgpu::graphite::PrecompileBase
Definition:
PrecompileBase.h:24
skgpu::graphite::PrecompileBase::type
Type type() const
Definition:
PrecompileBase.h:34
skgpu::graphite::PrecompileBase::numCombinations
int numCombinations() const
Definition:
PrecompileBase.h:50
skgpu::graphite::PrecompileBase::numChildCombinations
virtual int numChildCombinations() const
Definition:
PrecompileBase.h:44
skgpu::graphite::PrecompileBase::numIntrinsicCombinations
virtual int numIntrinsicCombinations() const
Definition:
PrecompileBase.h:43
skgpu::graphite::PrecompileBase::addToKey
virtual void addToKey(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *, int desiredCombination) const =0
skgpu::graphite::PrecompileBase::PrecompileBase
PrecompileBase(Type type)
Definition:
PrecompileBase.h:41
priv
FlPixelBufferTexturePrivate * priv
Definition:
fl_pixel_buffer_texture.cc:30
Type
Definition:
asyncrescaleandread.cpp:530
skgpu::graphite
Definition:
BoundsManagerBench.cpp:27
skgpu::graphite::AddToKey
void AddToKey(const KeyContext &keyContext, PaintParamsKeyBuilder *builder, PipelineDataGatherer *gatherer, const SkBlender *blender)
Definition:
KeyHelpers.cpp:1269
Generated on Sun Jun 23 2024 21:56:02 for Flutter Engine by
1.9.4