Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrCoverageSetOpXP.h
Go to the documentation of this file.
1/*
2 * Copyright 2014 Google Inc.
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 GrCoverageSetOpXP_DEFINED
9#define GrCoverageSetOpXP_DEFINED
10
17
18enum class GrClampType;
19
20// See the comment above GrXPFactory's definition about this warning suppression.
21#if defined(__GNUC__)
22#pragma GCC diagnostic push
23#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
24#endif
25#if defined(__clang__)
26#pragma clang diagnostic push
27#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
28#endif
29
30/**
31 * This xfer processor directly blends the the src coverage with the dst using a set operator. It is
32 * useful for rendering coverage masks using CSG. It can optionally invert the src coverage before
33 * applying the set operator.
34 */
36public:
37 static const GrXPFactory* Get(SkRegion::Op regionOp, bool invertCoverage = false);
38
39private:
40 constexpr GrCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage);
41
44 const GrCaps&,
45 GrClampType) const override;
46
48 const GrProcessorAnalysisCoverage& coverage,
49 const GrCaps&,
50 GrClampType) const override {
52 switch (fRegionOp) {
55 break;
58 // FIXME: If we can formalize the fact that this op only operates on alpha, we can
59 // set AnalysisProperties::kUnaffectedByDstValue if color/coverage are all opaque.
60 break;
64 break;
65 }
66 return props;
67 }
68
69
71
72 SkRegion::Op fRegionOp;
73 bool fInvertCoverage;
74
75 using INHERITED = GrXPFactory;
76};
77#if defined(__GNUC__)
78#pragma GCC diagnostic pop
79#endif
80#if defined(__clang__)
81#pragma clang diagnostic pop
82#endif
83
84#endif
GrProcessorAnalysisCoverage
#define GR_DECLARE_XP_FACTORY_TEST
GrClampType
SkColor4f color
static const GrXPFactory * Get(SkRegion::Op regionOp, bool invertCoverage=false)
sk_sp< const GrXferProcessor > makeXferProcessor(const GrProcessorAnalysisColor &, GrProcessorAnalysisCoverage, const GrCaps &, GrClampType) const override
AnalysisProperties analysisProperties(const GrProcessorAnalysisColor &color, const GrProcessorAnalysisCoverage &coverage, const GrCaps &, GrClampType) const override
constexpr GrXPFactory()
@ kReverseDifference_Op
operand minus target
Definition SkRegion.h:371
@ kUnion_Op
target unioned with operand
Definition SkRegion.h:369
@ kReplace_Op
replace target with operand
Definition SkRegion.h:372
@ kIntersect_Op
target intersected with operand
Definition SkRegion.h:368
@ kDifference_Op
target minus operand
Definition SkRegion.h:367
@ kXOR_Op
target exclusive or with operand
Definition SkRegion.h:370