Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrFragmentProcessors.h
Go to the documentation of this file.
1/*
2 * Copyright 2023 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 GrFragmentProcessors_DEFINED
9#define GrFragmentProcessors_DEFINED
10
12
13#include <tuple>
14#include <memory>
15
16class GrColorInfo;
19class SkBlenderBase;
20class SkColorFilter;
21class SkMaskFilter;
22class SkMatrix;
23class SkSurfaceProps;
24class SkShader;
25struct GrFPArgs;
26
27using GrFPResult = std::tuple<bool, std::unique_ptr<GrFragmentProcessor>>;
28
29namespace SkShaders {
30class MatrixRec;
31}
32
33namespace GrFragmentProcessors {
34/**
35 * Returns a GrFragmentProcessor that implements this blend for the Ganesh GPU backend.
36 * The GrFragmentProcessor expects premultiplied inputs and returns a premultiplied output.
37 */
38std::unique_ptr<GrFragmentProcessor> Make(const SkBlenderBase*,
39 std::unique_ptr<GrFragmentProcessor> srcFP,
40 std::unique_ptr<GrFragmentProcessor> dstFP,
41 const GrFPArgs& fpArgs);
42
43/**
44 * Returns a GrFragmentProcessor that implements the color filter in GPU shader code.
45 *
46 * The fragment processor receives a input FP that generates a premultiplied input color, and
47 * produces a premultiplied output color.
48 *
49 * A GrFPFailure indicates that the color filter isn't implemented for the GPU backend.
50 */
52 const SkColorFilter*,
53 std::unique_ptr<GrFragmentProcessor> inputFP,
54 const GrColorInfo& dstColorInfo,
55 const SkSurfaceProps&);
56
57std::unique_ptr<GrFragmentProcessor> Make(const SkMaskFilter*,
58 const GrFPArgs&,
59 const SkMatrix& ctm);
60
61bool IsSupported(const SkMaskFilter*);
62
63/**
64 * Call on the root SkShader to produce a GrFragmentProcessor.
65 *
66 * The returned GrFragmentProcessor expects an unpremultiplied input color and produces a
67 * premultiplied output.
68 */
69std::unique_ptr<GrFragmentProcessor> Make(const SkShader*, const GrFPArgs&, const SkMatrix& ctm);
70std::unique_ptr<GrFragmentProcessor> Make(const SkShader*,
71 const GrFPArgs&,
73
74/**
75 * Returns a GrFragmentProcessor for the passed-in runtime effect child. The processor will be
76 * created with generic/null inputs, since the runtime effect is responsible for filling in the
77 * arguments to the function.
78 */
79GrFPResult MakeChildFP(const SkRuntimeEffect::ChildPtr& child, const GrFPArgs& childArgs);
80
81} // namespace GrFragmentProcessors
82
83#endif
std::tuple< bool, std::unique_ptr< GrFragmentProcessor > > GrFPResult
GrFPResult MakeChildFP(const SkRuntimeEffect::ChildPtr &child, const GrFPArgs &childArgs)
std::unique_ptr< GrFragmentProcessor > Make(const SkMaskFilter *maskfilter, const GrFPArgs &args, const SkMatrix &ctm)
bool IsSupported(const SkMaskFilter *maskfilter)