Flutter Engine
The Flutter Engine
GrModulateAtlasCoverageEffect.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 GrGrModulateAtlasCoverageEffect_DEFINED
9#define GrGrModulateAtlasCoverageEffect_DEFINED
10
11#include "include/core/SkRect.h"
12#include "include/gpu/GrTypes.h"
14
15#include <memory>
16
18class SkMatrix;
19namespace skgpu { class KeyBuilder; }
20struct GrShaderCaps;
21
22// Multiplies 'inputFP' by the coverage value in an atlas, optionally inverting or clamping to 0.
24public:
25 enum class Flags {
26 kNone = 0,
27 kInvertCoverage = 1 << 0, // Return inputColor * (1 - atlasCoverage).
28 kCheckBounds = 1 << 1 // Clamp atlasCoverage to 0 if outside the path's valid atlas bounds.
29 };
30
32
33 GrModulateAtlasCoverageEffect(Flags flags, std::unique_ptr<GrFragmentProcessor> inputFP,
34 GrSurfaceProxyView atlasView, const SkMatrix& devToAtlasMatrix,
35 const SkIRect& devIBounds);
36
38
39 const char* name() const override {
40 return "GrModulateAtlasCoverageFP";
41 }
42
43 std::unique_ptr<GrFragmentProcessor> clone() const override {
44 return std::make_unique<GrModulateAtlasCoverageEffect>(*this);
45 }
46
47private:
48 void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder* b) const override;
49
50 bool onIsEqual(const GrFragmentProcessor& that) const override {
52 return fFlags == fp.fFlags && fBounds == fp.fBounds;
53 }
54 std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
55
56 const Flags fFlags;
57 const SkIRect fBounds;
58};
59
61
62#endif
#define GR_MAKE_BITFIELD_CLASS_OPS(X)
Definition: GrTypes.h:42
std::unique_ptr< GrFragmentProcessor > clone() const override
const char * name() const override
GrModulateAtlasCoverageEffect(Flags flags, std::unique_ptr< GrFragmentProcessor > inputFP, GrSurfaceProxyView atlasView, const SkMatrix &devToAtlasMatrix, const SkIRect &devIBounds)
const T & cast() const
Definition: GrProcessor.h:127
static bool b
FlutterSemanticsFlag flags
const uint32_t fp
Definition: GpuTools.h:21
Definition: SkRect.h:32