Flutter Engine
The Flutter Engine
third_party
skia
src
core
SkBlenderBase.h
Go to the documentation of this file.
1
/*
2
* Copyright 2021 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 SkBlenderBase_DEFINED
9
#define SkBlenderBase_DEFINED
10
11
#include "
include/core/SkBlender.h
"
12
#include "
src/base/SkArenaAlloc.h
"
13
14
#include <memory>
15
#include <optional>
16
17
struct
GrFPArgs
;
18
class
GrFragmentProcessor
;
19
class
SkColorInfo
;
20
class
SkRuntimeEffect
;
21
struct
SkStageRec
;
22
23
namespace
skgpu::graphite
{
24
enum class
DstColorType
;
25
class
KeyContext;
26
class
PaintParamsKeyBuilder;
27
class
PipelineDataGatherer;
28
}
29
30
#define SK_ALL_BLENDERS(M) \
31
M(BlendMode) \
32
M(Runtime)
33
34
/**
35
* Encapsulates a blend function, including non-public APIs.
36
* Blends combine a source color (the result of our paint) and destination color (from the canvas)
37
* into a final color.
38
*/
39
class
SkBlenderBase
:
public
SkBlender
{
40
public
:
41
/**
42
* Returns true if this SkBlender represents any SkBlendMode, and returns the blender's
43
* SkBlendMode in `mode`. Returns false for other types of blends.
44
*/
45
virtual
std::optional<SkBlendMode>
asBlendMode
()
const
{
return
{}; }
46
47
bool
affectsTransparentBlack
()
const
;
48
49
[[nodiscard]]
bool
appendStages
(
const
SkStageRec
& rec)
const
{
50
return
this->
onAppendStages
(rec);
51
}
52
53
[[nodiscard]]
virtual
bool
onAppendStages
(
const
SkStageRec
& rec)
const
= 0;
54
55
virtual
SkRuntimeEffect
*
asRuntimeEffect
()
const
{
return
nullptr
; }
56
57
static
SkFlattenable::Type
GetFlattenableType
() {
return
kSkBlender_Type
; }
58
SkFlattenable::Type
getFlattenableType
()
const override
{
return
GetFlattenableType
(); }
59
60
enum class
BlenderType
{
61
#define M(type) k ## type,
62
SK_ALL_BLENDERS
(M)
63
#undef M
64
};
65
66
virtual
BlenderType
type
()
const
= 0;
67
};
68
69
inline
SkBlenderBase
*
as_BB
(
SkBlender
*
blend
) {
70
return
static_cast<
SkBlenderBase
*
>
(
blend
);
71
}
72
73
inline
const
SkBlenderBase
*
as_BB
(
const
SkBlender
*
blend
) {
74
return
static_cast<
const
SkBlenderBase
*
>
(
blend
);
75
}
76
77
inline
const
SkBlenderBase
*
as_BB
(
const
sk_sp<SkBlender>
&
blend
) {
78
return
static_cast<
SkBlenderBase
*
>
(
blend
.get());
79
}
80
81
#endif
// SkBlenderBase_DEFINED
SkArenaAlloc.h
SK_ALL_BLENDERS
#define SK_ALL_BLENDERS(M)
Definition:
SkBlenderBase.h:30
as_BB
SkBlenderBase * as_BB(SkBlender *blend)
Definition:
SkBlenderBase.h:69
SkBlender.h
GrFragmentProcessor
Definition:
GrFragmentProcessor.h:45
SkBlenderBase
Definition:
SkBlenderBase.h:39
SkBlenderBase::asRuntimeEffect
virtual SkRuntimeEffect * asRuntimeEffect() const
Definition:
SkBlenderBase.h:55
SkBlenderBase::getFlattenableType
SkFlattenable::Type getFlattenableType() const override
Definition:
SkBlenderBase.h:58
SkBlenderBase::type
virtual BlenderType type() const =0
SkBlenderBase::onAppendStages
virtual bool onAppendStages(const SkStageRec &rec) const =0
SkBlenderBase::GetFlattenableType
static SkFlattenable::Type GetFlattenableType()
Definition:
SkBlenderBase.h:57
SkBlenderBase::BlenderType
BlenderType
Definition:
SkBlenderBase.h:60
SkBlenderBase::appendStages
bool appendStages(const SkStageRec &rec) const
Definition:
SkBlenderBase.h:49
SkBlenderBase::affectsTransparentBlack
bool affectsTransparentBlack() const
Definition:
SkBlendModeBlender.cpp:79
SkBlenderBase::asBlendMode
virtual std::optional< SkBlendMode > asBlendMode() const
Definition:
SkBlenderBase.h:45
SkBlender
Definition:
SkBlender.h:19
SkColorInfo
Definition:
SkImageInfo.h:111
SkFlattenable::Type
Type
Definition:
SkFlattenable.h:30
SkFlattenable::kSkBlender_Type
@ kSkBlender_Type
Definition:
SkFlattenable.h:32
SkRuntimeEffect
Definition:
SkRuntimeEffect.h:59
sk_sp< SkBlender >
blend
static SkColor blend(SkColor dst, SkColor src, void(*mode)(float, float, float, float *, float *, float *))
Definition:
hsl.cpp:142
skgpu::graphite
Definition:
BoundsManagerBench.cpp:27
skgpu::graphite::DstColorType
DstColorType
Definition:
KeyHelpers.h:42
GrFPArgs
Definition:
GrFPArgs.h:18
SkStageRec
Definition:
SkEffectPriv.h:20
Generated on Sun Jun 23 2024 21:56:10 for Flutter Engine by
1.9.4