Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
GrStencilSettings::Face Struct Reference

#include <GrStencilSettings.h>

Inheritance diagram for GrStencilSettings::Face:
GrTStencilFaceSettings< GrStencilTest, GrStencilOp >

Public Member Functions

void reset (const GrUserStencilSettings::Face &, bool useStencilClip, int numStencilBits)
 
void setDisabled ()
 

Additional Inherited Members

- Public Attributes inherited from GrTStencilFaceSettings< GrStencilTest, GrStencilOp >
uint16_t fRef
 
GrStencilTest fTest
 
uint16_t fTestMask
 
GrStencilOp fPassOp
 
GrStencilOp fFailOp
 
uint16_t fWriteMask
 

Detailed Description

Definition at line 79 of file GrStencilSettings.h.

Member Function Documentation

◆ reset()

void GrStencilSettings::Face::reset ( const GrUserStencilSettings::Face user,
bool  useStencilClip,
int  numStencilBits 
)

Definition at line 174 of file GrStencilSettings.cpp.

175 {
179 SkASSERT(numStencilBits > 0 && numStencilBits <= 16);
180 int clipBit = 1 << (numStencilBits - 1);
181 int userMask = clipBit - 1;
182
183 GrUserStencilOp maxOp = std::max(user.fPassOp, user.fFailOp);
184 SkDEBUGCODE(GrUserStencilOp otherOp = std::min(user.fPassOp, user.fFailOp);)
185 if (maxOp <= kLastUserOnlyStencilOp) {
186 // Ops that only modify user bits.
187 fWriteMask = user.fWriteMask & userMask;
189 } else if (maxOp <= kLastClipOnlyStencilOp) {
190 // Ops that only modify the clip bit.
191 fWriteMask = clipBit;
192 SkASSERT(GrUserStencilOp::kKeep == otherOp ||
193 (otherOp > kLastUserOnlyStencilOp && otherOp <= kLastClipOnlyStencilOp));
194 } else {
195 // Ops that modify both clip and user bits.
196 fWriteMask = clipBit | (user.fWriteMask & userMask);
198 }
199
202
203 if (!hasStencilClip || user.fTest > kLastClippedStencilTest) {
204 // Ignore the clip.
205 fTestMask = user.fTestMask & userMask;
207 } else if (GrUserStencilTest::kAlwaysIfInClip != user.fTest) {
208 // Respect the clip.
209 fTestMask = clipBit | (user.fTestMask & userMask);
211 } else {
212 // Test only for clip.
213 fTestMask = clipBit;
215 }
216
217 fRef = (clipBit | user.fRef) & (fTestMask | fWriteMask);
218}
static constexpr GrStencilOp gUserStencilOpToRaw[kGrUserStencilOpCount]
static constexpr GrStencilTest gUserStencilTestToRaw[kGrUserStencilTestCount]
static constexpr GrUserStencilOp kLastUserOnlyStencilOp
GrUserStencilTest
static constexpr GrUserStencilOp kLastClipOnlyStencilOp
static constexpr GrUserStencilTest kLastClippedStencilTest
static constexpr int kGrUserStencilOpCount
static constexpr int kGrUserStencilTestCount
#define SkASSERT(cond)
Definition: SkAssert.h:116
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
if(end==-1)
static float max(float r, float g, float b)
Definition: hsl.cpp:49
static float min(float r, float g, float b)
Definition: hsl.cpp:48

◆ setDisabled()

void GrStencilSettings::Face::setDisabled ( )

Definition at line 220 of file GrStencilSettings.cpp.

220 {
221 memset(this, 0, sizeof(*this));
222 static_assert(0 == (int)GrStencilTest::kAlways);
223 static_assert(0 == (int)GrStencilOp::kKeep);
224}

The documentation for this struct was generated from the following files: