| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 | 8 |
| 9 #ifndef GrUserStencilSettings_DEFINED | 9 #ifndef GrUserStencilSettings_DEFINED |
| 10 #define GrUserStencilSettings_DEFINED | 10 #define GrUserStencilSettings_DEFINED |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 , fFront{FtRef, FtTest, FtAttrs::EffectiveTestMask(FtTestMask), FtPassOp
, FtFailOp, | 175 , fFront{FtRef, FtTest, FtAttrs::EffectiveTestMask(FtTestMask), FtPassOp
, FtFailOp, |
| 176 FtAttrs::EffectiveWriteMask(FtWriteMask)} | 176 FtAttrs::EffectiveWriteMask(FtWriteMask)} |
| 177 , fBackFlags{BkAttrs::Flags(false), BkAttrs::Flags(true)} | 177 , fBackFlags{BkAttrs::Flags(false), BkAttrs::Flags(true)} |
| 178 , fBack{BkRef, BkTest, BkAttrs::EffectiveTestMask(BkTestMask), BkPassOp,
BkFailOp, | 178 , fBack{BkRef, BkTest, BkAttrs::EffectiveTestMask(BkTestMask), BkPassOp,
BkFailOp, |
| 179 BkAttrs::EffectiveWriteMask(BkWriteMask)} {} | 179 BkAttrs::EffectiveWriteMask(BkWriteMask)} {} |
| 180 | 180 |
| 181 // This struct can only be constructed with static initializers. | 181 // This struct can only be constructed with static initializers. |
| 182 GrUserStencilSettings() = delete; | 182 GrUserStencilSettings() = delete; |
| 183 GrUserStencilSettings(const GrUserStencilSettings&) = delete; | 183 GrUserStencilSettings(const GrUserStencilSettings&) = delete; |
| 184 | 184 |
| 185 uint16_t flags(bool hasStencilClip) const { |
| 186 return fFrontFlags[hasStencilClip] & fBackFlags[hasStencilClip]; |
| 187 } |
| 188 bool isDisabled(bool hasStencilClip) const { |
| 189 return this->flags(hasStencilClip) & kDisabled_StencilFlag; |
| 190 } |
| 191 bool doesWrite(bool hasStencilClip) const { |
| 192 return !(this->flags(hasStencilClip) & kNoModifyStencil_StencilFlag); |
| 193 } |
| 194 bool isTwoSided(bool hasStencilClip) const { |
| 195 return !(this->flags(hasStencilClip) & kSingleSided_StencilFlag); |
| 196 } |
| 197 bool usesWrapOp(bool hasStencilClip) const { |
| 198 return !(this->flags(hasStencilClip) & kNoWrapOps_StencilFlag); |
| 199 } |
| 200 |
| 185 const uint16_t fFrontFlags[2]; // frontFlagsForDraw = fFrontFlags[hasStenc
ilClip]. | 201 const uint16_t fFrontFlags[2]; // frontFlagsForDraw = fFrontFlags[hasStenc
ilClip]. |
| 186 const Face fFront; | 202 const Face fFront; |
| 187 const uint16_t fBackFlags[2]; // backFlagsForDraw = fBackFlags[hasStencilC
lip]. | 203 const uint16_t fBackFlags[2]; // backFlagsForDraw = fBackFlags[hasStencilC
lip]. |
| 188 const Face fBack; | 204 const Face fBack; |
| 189 | 205 |
| 190 static const GrUserStencilSettings& kUnused; | 206 static const GrUserStencilSettings& kUnused; |
| 191 | 207 |
| 192 bool isUnused() const { return this == &kUnused; } | 208 bool isUnused() const { return this == &kUnused; } |
| 193 }; | 209 }; |
| 194 | 210 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 } | 246 } |
| 231 constexpr static uint16_t EffectiveWriteMask(uint16_t writeMask) { | 247 constexpr static uint16_t EffectiveWriteMask(uint16_t writeMask) { |
| 232 // We don't modify the mask differently when hasStencilClip=false becaus
e either the entire | 248 // We don't modify the mask differently when hasStencilClip=false becaus
e either the entire |
| 233 // face gets disabled in that case (e.g. Test=kAlwaysIfInClip, PassOp=kK
eep), or else the | 249 // face gets disabled in that case (e.g. Test=kAlwaysIfInClip, PassOp=kK
eep), or else the |
| 234 // effective mask stays the same either way. | 250 // effective mask stays the same either way. |
| 235 return DoesNotModifyStencil(true) ? 0 : writeMask; | 251 return DoesNotModifyStencil(true) ? 0 : writeMask; |
| 236 } | 252 } |
| 237 }; | 253 }; |
| 238 | 254 |
| 239 #endif | 255 #endif |
| OLD | NEW |