Flutter Engine
The Flutter Engine
PaintOption.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_PaintOption_DEFINED
9#define skgpu_graphite_precompile_PaintOption_DEFINED
10
14
15namespace skgpu::graphite {
16
17class PrecompileBlender;
18class PrecompileColorFilter;
19class PrecompileShader;
20
21class KeyContext;
22class PaintParamsKeyBuilder;
23class PipelineDataGatherer;
24
26public:
27 PaintOption(bool opaquePaintColor,
28 const std::pair<sk_sp<PrecompileBlender>, int>& finalBlender,
29 const std::pair<sk_sp<PrecompileShader>, int>& shader,
30 const std::pair<sk_sp<PrecompileColorFilter>, int>& colorFilter,
31 bool hasPrimitiveBlender,
32 const std::pair<sk_sp<PrecompileShader>, int>& clipShader,
33 DstReadRequirement dstReadReq,
34 bool dither)
35 : fOpaquePaintColor(opaquePaintColor)
36 , fFinalBlender(finalBlender)
37 , fShader(shader)
38 , fColorFilter(colorFilter)
39 , fHasPrimitiveBlender(hasPrimitiveBlender)
40 , fClipShader(clipShader)
41 , fDstReadReq(dstReadReq)
42 , fDither(dither) {
43 }
44
45 const PrecompileBlender* finalBlender() const { return fFinalBlender.first.get(); }
46
48
49private:
50 void addPaintColorToKey(const KeyContext&, PaintParamsKeyBuilder*, PipelineDataGatherer*) const;
51 void handlePrimitiveColor(const KeyContext&,
54 void handlePaintAlpha(const KeyContext&, PaintParamsKeyBuilder*, PipelineDataGatherer*) const;
55 void handleColorFilter(const KeyContext&, PaintParamsKeyBuilder*, PipelineDataGatherer*) const;
56 bool shouldDither(SkColorType dstCT) const;
57 void handleDithering(const KeyContext&, PaintParamsKeyBuilder*, PipelineDataGatherer*) const;
58 void handleDstRead(const KeyContext&, PaintParamsKeyBuilder*, PipelineDataGatherer*) const;
59
60
61 bool fOpaquePaintColor;
62 std::pair<sk_sp<PrecompileBlender>, int> fFinalBlender;
63 std::pair<sk_sp<PrecompileShader>, int> fShader;
64 std::pair<sk_sp<PrecompileColorFilter>, int> fColorFilter;
65 bool fHasPrimitiveBlender;
66 std::pair<sk_sp<PrecompileShader>, int> fClipShader;
67 DstReadRequirement fDstReadReq;
68 bool fDither;
69};
70
71} // namespace skgpu::graphite
72
73#endif // skgpu_graphite_precompile_PaintOption_DEFINED
SkColorType
Definition: SkColorType.h:19
PaintOption(bool opaquePaintColor, const std::pair< sk_sp< PrecompileBlender >, int > &finalBlender, const std::pair< sk_sp< PrecompileShader >, int > &shader, const std::pair< sk_sp< PrecompileColorFilter >, int > &colorFilter, bool hasPrimitiveBlender, const std::pair< sk_sp< PrecompileShader >, int > &clipShader, DstReadRequirement dstReadReq, bool dither)
Definition: PaintOption.h:27
const PrecompileBlender * finalBlender() const
Definition: PaintOption.h:45
void toKey(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *) const
Definition: PaintOption.cpp:25
DstReadRequirement
Definition: Caps.h:64