xref: /aosp_15_r20/external/skia/include/gpu/graphite/precompile/PrecompileMaskFilter.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
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_PrecompileMaskFilter_DEFINED
9 #define skgpu_graphite_precompile_PrecompileMaskFilter_DEFINED
10 
11 #include "include/gpu/graphite/precompile/PrecompileBase.h"
12 
13 #include "include/gpu/graphite/precompile/PaintOptions.h"
14 
15 namespace skgpu::graphite {
16 
17 /** \class PrecompileMaskFilter
18     This class corresponds to the SkMaskFilter class in the main API.
19 */
20 class SK_API PrecompileMaskFilter : public PrecompileBase {
21 protected:
22     friend class PaintOptions;  // for createPipelines() access
23 
PrecompileMaskFilter()24     PrecompileMaskFilter() : PrecompileBase(Type::kMaskFilter) {}
25     ~PrecompileMaskFilter() override;
26 
27     void addToKey(const KeyContext&,
28                   PaintParamsKeyBuilder*,
29                   PipelineDataGatherer*,
30                   int desiredCombination) const final;
31 
32     virtual void createPipelines(const KeyContext&,
33                                  PipelineDataGatherer*,
34                                  const PaintOptions&,
35                                  const RenderPassDesc&,
36                                  const PaintOptions::ProcessCombination&) const = 0;
37 };
38 
39 //--------------------------------------------------------------------------------------------------
40 // This is the Precompile correlate to the SkMaskFilter class' factories in the main API
41 namespace PrecompileMaskFilters {
42 
43     // This corresponds to the SkMaskFilter::MakeBlur factory in the main Skia API.
44     // The specific details of the blur have been elided since they don't impact the generated
45     // shader.
46     SK_API sk_sp<PrecompileMaskFilter> Blur();
47 
48 } // namespace PrecompileMaskFilters
49 
50 } // namespace skgpu::graphite
51 
52 
53 #endif // skgpu_graphite_precompile_PrecompileMaskFilter_DEFINED
54