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

Side by Side Diff: src/gpu/GrClipMaskManager.cpp

Issue 53823003: Add can-ignore-rect hint to clear call (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: cleaned up Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 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 #include "GrClipMaskManager.h" 9 #include "GrClipMaskManager.h"
10 #include "GrAAConvexPathRenderer.h" 10 #include "GrAAConvexPathRenderer.h"
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 454
455 GrDrawState* drawState = fGpu->drawState(); 455 GrDrawState* drawState = fGpu->drawState();
456 456
457 // We're drawing a coverage mask and want coverage to be run through the ble nd function. 457 // We're drawing a coverage mask and want coverage to be run through the ble nd function.
458 drawState->enableState(GrDrawState::kCoverageDrawing_StateBit); 458 drawState->enableState(GrDrawState::kCoverageDrawing_StateBit);
459 459
460 // The scratch texture that we are drawing into can be substantially larger than the mask. Only 460 // The scratch texture that we are drawing into can be substantially larger than the mask. Only
461 // clear the part that we care about. 461 // clear the part that we care about.
462 fGpu->clear(&maskSpaceIBounds, 462 fGpu->clear(&maskSpaceIBounds,
463 kAllIn_InitialState == initialState ? 0xffffffff : 0x00000000, 463 kAllIn_InitialState == initialState ? 0xffffffff : 0x00000000,
464 true,
464 result->asRenderTarget()); 465 result->asRenderTarget());
465 466
466 // When we use the stencil in the below loop it is important to have this cl ip installed. 467 // When we use the stencil in the below loop it is important to have this cl ip installed.
467 // The second pass that zeros the stencil buffer renders the rect maskSpaceI Bounds so the first 468 // The second pass that zeros the stencil buffer renders the rect maskSpaceI Bounds so the first
468 // pass must not set values outside of this bounds or stencil values outside the rect won't be 469 // pass must not set values outside of this bounds or stencil values outside the rect won't be
469 // cleared. 470 // cleared.
470 GrDrawTarget::AutoClipRestore acr(fGpu, maskSpaceIBounds); 471 GrDrawTarget::AutoClipRestore acr(fGpu, maskSpaceIBounds);
471 drawState->enableState(GrDrawState::kClip_StateBit); 472 drawState->enableState(GrDrawState::kClip_StateBit);
472 473
473 GrAutoScratchTexture temp; 474 GrAutoScratchTexture temp;
(...skipping 24 matching lines...) Expand all
498 499
499 this->getTemp(maskSpaceIBounds.fRight, maskSpaceIBounds.fBottom, &temp); 500 this->getTemp(maskSpaceIBounds.fRight, maskSpaceIBounds.fBottom, &temp);
500 if (NULL == temp.texture()) { 501 if (NULL == temp.texture()) {
501 fAACache.reset(); 502 fAACache.reset();
502 return NULL; 503 return NULL;
503 } 504 }
504 dst = temp.texture(); 505 dst = temp.texture();
505 // clear the temp target and set blend to replace 506 // clear the temp target and set blend to replace
506 fGpu->clear(&maskSpaceElementIBounds, 507 fGpu->clear(&maskSpaceElementIBounds,
507 invert ? 0xffffffff : 0x00000000, 508 invert ? 0xffffffff : 0x00000000,
509 true,
508 dst->asRenderTarget()); 510 dst->asRenderTarget());
509 setup_boolean_blendcoeffs(drawState, SkRegion::kReplace_Op); 511 setup_boolean_blendcoeffs(drawState, SkRegion::kReplace_Op);
510 512
511 } else { 513 } else {
512 // draw directly into the result with the stencil set to make th e pixels affected 514 // draw directly into the result with the stencil set to make th e pixels affected
513 // by the clip shape be non-zero. 515 // by the clip shape be non-zero.
514 dst = result; 516 dst = result;
515 GR_STATIC_CONST_SAME_STENCIL(kStencilInElement, 517 GR_STATIC_CONST_SAME_STENCIL(kStencilInElement,
516 kReplace_StencilOp, 518 kReplace_StencilOp,
517 kReplace_StencilOp, 519 kReplace_StencilOp,
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 1033
1032 // TODO: dynamically attach a stencil buffer 1034 // TODO: dynamically attach a stencil buffer
1033 int stencilBits = 0; 1035 int stencilBits = 0;
1034 GrStencilBuffer* stencilBuffer = 1036 GrStencilBuffer* stencilBuffer =
1035 drawState.getRenderTarget()->getStencilBuffer(); 1037 drawState.getRenderTarget()->getStencilBuffer();
1036 if (NULL != stencilBuffer) { 1038 if (NULL != stencilBuffer) {
1037 stencilBits = stencilBuffer->bits(); 1039 stencilBits = stencilBuffer->bits();
1038 this->adjustStencilParams(settings, clipMode, stencilBits); 1040 this->adjustStencilParams(settings, clipMode, stencilBits);
1039 } 1041 }
1040 } 1042 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698