Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: src/gpu/GrStencil.h

Issue 1619623005: Avoid updating glPathStencilFunc unless it changes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: eh Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/gpu/gl/GrGLPathRendering.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 bool writes = GR_STENCIL_SETTINGS_DOES_WRITE( 270 bool writes = GR_STENCIL_SETTINGS_DOES_WRITE(
271 fPassOps[kFront_Face], fPassOps[kBack_Face], 271 fPassOps[kFront_Face], fPassOps[kBack_Face],
272 fFailOps[kFront_Face], fFailOps[kBack_Face], 272 fFailOps[kFront_Face], fFailOps[kBack_Face],
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] = kStencilOpCount;
281 fFlags = 0; 281 fFlags = 0;
282 } 282 }
283 283
284 bool isValid() const {
285 return fPassOps[0] < kStencilOpCount;
286 }
287
284 bool operator == (const GrStencilSettings& s) const { 288 bool operator == (const GrStencilSettings& s) const {
285 static const size_t gCompareSize = sizeof(GrStencilSettings) - 289 static const size_t gCompareSize = sizeof(GrStencilSettings) -
286 sizeof(fFlags); 290 sizeof(fFlags);
287 SkASSERT((const char*)&fFlags + sizeof(fFlags) == 291 SkASSERT((const char*)&fFlags + sizeof(fFlags) ==
288 (const char*)this + sizeof(GrStencilSettings)); 292 (const char*)this + sizeof(GrStencilSettings));
289 if (this->isDisabled() & s.isDisabled()) { // using & not && 293 if (this->isDisabled() & s.isDisabled()) { // using & not &&
290 return true; 294 return true;
291 } 295 }
292 return 0 == memcmp(this, &s, gCompareSize); 296 return 0 == memcmp(this, &s, gCompareSize);
293 } 297 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&(NAME ## _STRUCT)); 390 *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&(NAME ## _STRUCT));
387 391
388 392
389 #define GR_STATIC_CONST_SAME_STENCIL(NAME, \ 393 #define GR_STATIC_CONST_SAME_STENCIL(NAME, \
390 PASS_OP, FAIL_OP, FUNC, MASK, REF, WRITE_MASK) \ 394 PASS_OP, FAIL_OP, FUNC, MASK, REF, WRITE_MASK) \
391 GR_STATIC_CONST_STENCIL(NAME, (PASS_OP), (PASS_OP), (FAIL_OP), \ 395 GR_STATIC_CONST_STENCIL(NAME, (PASS_OP), (PASS_OP), (FAIL_OP), \
392 (FAIL_OP), (FUNC), (FUNC), (MASK), (MASK), (REF), (REF), (WRITE_MASK), \ 396 (FAIL_OP), (FUNC), (FUNC), (MASK), (MASK), (REF), (REF), (WRITE_MASK), \
393 (WRITE_MASK)) 397 (WRITE_MASK))
394 398
395 #endif 399 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/gl/GrGLPathRendering.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698