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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrClipMaskManager.h ('k') | src/gpu/GrDrawTarget.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 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 return true; 99 return true;
100 } 100 }
101 } 101 }
102 return false; 102 return false;
103 } 103 }
104 104
105 //////////////////////////////////////////////////////////////////////////////// 105 ////////////////////////////////////////////////////////////////////////////////
106 // sort out what kind of clip mask needs to be created: alpha, stencil, 106 // sort out what kind of clip mask needs to be created: alpha, stencil,
107 // scissor, or entirely software 107 // scissor, or entirely software
108 bool GrClipMaskManager::setupClipping(const GrClipData* clipDataIn, 108 bool GrClipMaskManager::setupClipping(const GrClipData* clipDataIn,
109 GrDrawState::AutoRestoreEffects* are) { 109 GrDrawState::AutoRestoreEffects* are,
110 const SkRect* devBounds) {
110 fCurrClipMaskType = kNone_ClipMaskType; 111 fCurrClipMaskType = kNone_ClipMaskType;
111 112
112 ElementList elements(16); 113 ElementList elements(16);
113 int32_t genID; 114 int32_t genID;
114 InitialState initialState; 115 InitialState initialState;
115 SkIRect clipSpaceIBounds; 116 SkIRect clipSpaceIBounds;
116 bool requiresAA; 117 bool requiresAA;
117 bool isRect = false; 118 bool isRect = false;
118 119
119 GrDrawState* drawState = fGpu->drawState(); 120 GrDrawState* drawState = fGpu->drawState();
(...skipping 23 matching lines...) Expand all
143 } 144 }
144 } 145 }
145 } 146 }
146 147
147 if (ignoreClip) { 148 if (ignoreClip) {
148 fGpu->disableScissor(); 149 fGpu->disableScissor();
149 this->setGpuStencil(); 150 this->setGpuStencil();
150 return true; 151 return true;
151 } 152 }
152 153
153 // If there is only one clip element and it is a convex polygon we just inst all an effect that 154 // If there is only one clip element we check whether the draw's bounds are contained
154 // clips against the edges. 155 // fully within the clip. If not, we install an effect that handles the clip for some
156 // cases.
155 if (1 == elements.count() && SkRegion::kReplace_Op == elements.tail()->getOp ()) { 157 if (1 == elements.count() && SkRegion::kReplace_Op == elements.tail()->getOp ()) {
158 if (NULL != devBounds) {
159 SkRect boundsInClipSpace = *devBounds;
160 boundsInClipSpace.offset(SkIntToScalar(clipDataIn->fOrigin.fX),
161 SkIntToScalar(clipDataIn->fOrigin.fY));
162 if (elements.tail()->contains(boundsInClipSpace)) {
163 fGpu->disableScissor();
164 this->setGpuStencil();
165 return true;
166 }
167 }
156 SkAutoTUnref<GrEffectRef> effect; 168 SkAutoTUnref<GrEffectRef> effect;
157 if (SkClipStack::Element::kPath_Type == elements.tail()->getType()) { 169 if (SkClipStack::Element::kPath_Type == elements.tail()->getType()) {
158 const SkPath& path = elements.tail()->getPath(); 170 const SkPath& path = elements.tail()->getPath();
159 bool isAA = GR_AA_CLIP && elements.tail()->isAA(); 171 bool isAA = GR_AA_CLIP && elements.tail()->isAA();
160 if (rt->isMultisampled()) { 172 if (rt->isMultisampled()) {
161 // A coverage effect for AA clipping won't play nicely with MSAA . 173 // A coverage effect for AA clipping won't play nicely with MSAA .
162 if (!isAA) { 174 if (!isAA) {
163 SkVector offset = { SkIntToScalar(-clipDataIn->fOrigin.fX), 175 SkVector offset = { SkIntToScalar(-clipDataIn->fOrigin.fX),
164 SkIntToScalar(-clipDataIn->fOrigin.fY) } ; 176 SkIntToScalar(-clipDataIn->fOrigin.fY) } ;
165 effect.reset(GrConvexPolyEffect::Create(GrConvexPolyEffect:: kFillNoAA_EdgeType, 177 effect.reset(GrConvexPolyEffect::Create(GrConvexPolyEffect:: kFillNoAA_EdgeType,
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 1096
1085 // TODO: dynamically attach a stencil buffer 1097 // TODO: dynamically attach a stencil buffer
1086 int stencilBits = 0; 1098 int stencilBits = 0;
1087 GrStencilBuffer* stencilBuffer = 1099 GrStencilBuffer* stencilBuffer =
1088 drawState.getRenderTarget()->getStencilBuffer(); 1100 drawState.getRenderTarget()->getStencilBuffer();
1089 if (NULL != stencilBuffer) { 1101 if (NULL != stencilBuffer) {
1090 stencilBits = stencilBuffer->bits(); 1102 stencilBits = stencilBuffer->bits();
1091 this->adjustStencilParams(settings, clipMode, stencilBits); 1103 this->adjustStencilParams(settings, clipMode, stencilBits);
1092 } 1104 }
1093 } 1105 }
OLDNEW
« 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