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

Unified Diff: src/gpu/GrClipMaskManager.cpp

Issue 144283004: Add dev bounds to bmp txt context, use bounds to ignore clips (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: cleanup comment Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrClipMaskManager.h ('k') | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrClipMaskManager.cpp
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index 35e0818dd0577d3f41397a26dea3bc2506d9722a..bf67c361f3b2d8d280e7aa6956e579ad22c79cf3 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -106,7 +106,8 @@ bool GrClipMaskManager::useSWOnlyPath(const ElementList& elements) {
// sort out what kind of clip mask needs to be created: alpha, stencil,
// scissor, or entirely software
bool GrClipMaskManager::setupClipping(const GrClipData* clipDataIn,
- GrDrawState::AutoRestoreEffects* are) {
+ GrDrawState::AutoRestoreEffects* are,
+ const SkRect* devBounds) {
fCurrClipMaskType = kNone_ClipMaskType;
ElementList elements(16);
@@ -150,9 +151,20 @@ bool GrClipMaskManager::setupClipping(const GrClipData* clipDataIn,
return true;
}
- // If there is only one clip element and it is a convex polygon we just install an effect that
- // clips against the edges.
+ // If there is only one clip element we check whether the draw's bounds are contained
+ // fully within the clip. If not, we install an effect that handles the clip for some
+ // cases.
if (1 == elements.count() && SkRegion::kReplace_Op == elements.tail()->getOp()) {
+ if (NULL != devBounds) {
+ SkRect boundsInClipSpace = *devBounds;
+ boundsInClipSpace.offset(SkIntToScalar(clipDataIn->fOrigin.fX),
+ SkIntToScalar(clipDataIn->fOrigin.fY));
+ if (elements.tail()->contains(boundsInClipSpace)) {
+ fGpu->disableScissor();
+ this->setGpuStencil();
+ return true;
+ }
+ }
SkAutoTUnref<GrEffectRef> effect;
if (SkClipStack::Element::kPath_Type == elements.tail()->getType()) {
const SkPath& path = elements.tail()->getPath();
« no previous file with comments | « src/gpu/GrClipMaskManager.h ('k') | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698