OLD | NEW |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef GrStencil_DEFINED | 10 #ifndef GrStencil_DEFINED |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 fFuncs[kFront_Face], fFuncs[kBack_Face]); | 273 fFuncs[kFront_Face], fFuncs[kBack_Face]); |
274 fFlags |= writes ? kDoesWrite_StencilFlag : kDoesNotWrite_StencilFlag; | 274 fFlags |= writes ? kDoesWrite_StencilFlag : kDoesNotWrite_StencilFlag; |
275 return writes; | 275 return writes; |
276 } | 276 } |
277 | 277 |
278 void invalidate() { | 278 void invalidate() { |
279 // write an illegal value to the first member | 279 // write an illegal value to the first member |
280 fPassOps[0] = (GrStencilOp)(uint8_t)-1; | 280 fPassOps[0] = (GrStencilOp)(uint8_t)-1; |
281 fFlags = 0; | 281 fFlags = 0; |
282 } | 282 } |
283 | 283 bool isValid() const { |
bsalomon
2016/01/22 14:38:38
as implemented, shouldn't this be called isInvalid
Kimmo Kinnunen
2016/01/25 08:33:13
Ah, where is my head at.. I fixed this and changed
| |
284 return fPassOps[0] == static_cast<GrStencilOp>(static_cast<uint8_t>(-1)) && fFlags == 0; | |
285 } | |
284 bool operator == (const GrStencilSettings& s) const { | 286 bool operator == (const GrStencilSettings& s) const { |
285 static const size_t gCompareSize = sizeof(GrStencilSettings) - | 287 static const size_t gCompareSize = sizeof(GrStencilSettings) - |
286 sizeof(fFlags); | 288 sizeof(fFlags); |
287 SkASSERT((const char*)&fFlags + sizeof(fFlags) == | 289 SkASSERT((const char*)&fFlags + sizeof(fFlags) == |
288 (const char*)this + sizeof(GrStencilSettings)); | 290 (const char*)this + sizeof(GrStencilSettings)); |
289 if (this->isDisabled() & s.isDisabled()) { // using & not && | 291 if (this->isDisabled() & s.isDisabled()) { // using & not && |
290 return true; | 292 return true; |
291 } | 293 } |
292 return 0 == memcmp(this, &s, gCompareSize); | 294 return 0 == memcmp(this, &s, gCompareSize); |
293 } | 295 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
386 *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&(NAME ## _STRUCT)); | 388 *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&(NAME ## _STRUCT)); |
387 | 389 |
388 | 390 |
389 #define GR_STATIC_CONST_SAME_STENCIL(NAME, \ | 391 #define GR_STATIC_CONST_SAME_STENCIL(NAME, \ |
390 PASS_OP, FAIL_OP, FUNC, MASK, REF, WRITE_MASK) \ | 392 PASS_OP, FAIL_OP, FUNC, MASK, REF, WRITE_MASK) \ |
391 GR_STATIC_CONST_STENCIL(NAME, (PASS_OP), (PASS_OP), (FAIL_OP), \ | 393 GR_STATIC_CONST_STENCIL(NAME, (PASS_OP), (PASS_OP), (FAIL_OP), \ |
392 (FAIL_OP), (FUNC), (FUNC), (MASK), (MASK), (REF), (REF), (WRITE_MASK), \ | 394 (FAIL_OP), (FUNC), (FUNC), (MASK), (MASK), (REF), (REF), (WRITE_MASK), \ |
393 (WRITE_MASK)) | 395 (WRITE_MASK)) |
394 | 396 |
395 #endif | 397 #endif |
OLD | NEW |