Debian Codegraph @

src/gpu/graphite/precompile/PaintOption.h

raw
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
11 #include "include/core/SkBlendMode.h"
12 #include "include/core/SkColorType.h"
13 #include "include/core/SkRefCnt.h"
14 #include "src/gpu/graphite/Caps.h"
15 #include "src/gpu/graphite/Renderer.h"
16
17 namespace skgpu::graphite {
18
19 class PrecompileBlender;
20 class PrecompileColorFilter;
21 class PrecompileShader;
22
23 class KeyContext;
24 class PaintParamsKeyBuilder;
25 class PipelineDataGatherer;
26 class FloatStorageManager;
27
28 class PaintOption {
29 public:
30 PaintOption(bool opaquePaintColor,
31 const std::pair<sk_sp<PrecompileBlender>, int>& finalBlender,
32 const std::pair<sk_sp<PrecompileShader>, int>& shader,
33 const std::pair<sk_sp<PrecompileColorFilter>, int>& colorFilter,
34 bool hasPrimitiveBlender,
35 SkBlendMode primitiveBlendMode,
36 bool skipColorXform,
37 const std::pair<sk_sp<PrecompileShader>, int>& clipShader,
38 Coverage coverage,
39 TextureFormat targetFormat,
40 bool dither,
41 bool analyticClip);
42
43 const PrecompileBlender* finalBlender() const { return fFinalBlender.first.get(); }
44
45 void toKey(const KeyContext&) const;
46
47 private:
48 void addPaintColorToKey(const KeyContext&) const;
49 void handlePrimitiveColor(const KeyContext&) const;
50 void handlePaintAlpha(const KeyContext&) const;
51 void handleColorFilter(const KeyContext&) const;
52 bool shouldDither(SkColorType dstCT) const;
53 void handleDithering(const KeyContext&) const;
54 void handleClipping(const KeyContext&) const;
55
56 bool fOpaquePaintColor;
57 std::pair<sk_sp<PrecompileBlender>, int> fFinalBlender;
58 std::pair<sk_sp<PrecompileShader>, int> fShader;
59 std::pair<sk_sp<PrecompileColorFilter>, int> fColorFilter;
60 SkBlendMode fPrimitiveBlendMode;
61 bool fHasPrimitiveBlender;
62 bool fSkipColorXform;
63 std::pair<sk_sp<PrecompileShader>, int> fClipShader;
64 Coverage fRendererCoverage;
65 TextureFormat fTargetFormat;
66 bool fDither;
67 bool fAnalyticClip;
68 };
69
70 } // namespace skgpu::graphite
71
72 #endif // skgpu_graphite_precompile_PaintOption_DEFINED