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

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

Issue 1393553002: Insert clip fragment processor outside GrCMM (Closed) Base URL: https://skia.googlesource.com/skia.git@byebye
Patch Set: add class to friends Created 5 years, 2 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 | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/effects/GrTextureDomain.h » ('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 2010 Google Inc. 3 * Copyright 2010 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 "GrDrawTarget.h" 9 #include "GrDrawTarget.h"
10 10
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 void GrDrawTarget::reset() { 140 void GrDrawTarget::reset() {
141 fFirstUnpreparedBatch = 0; 141 fFirstUnpreparedBatch = 0;
142 fBatches.reset(); 142 fBatches.reset();
143 fFlushState.reset(); 143 fFlushState.reset();
144 } 144 }
145 145
146 void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawBat ch* batch) { 146 void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawBat ch* batch) {
147 // Setup clip 147 // Setup clip
148 GrScissorState scissorState; 148 GrScissorState scissorState;
149 GrPipelineBuilder::AutoRestoreStencil ars;
150 GrAppliedClip clip;
151 if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &scissorState, & batch->bounds(),
152 &clip)) {
153 return;
154 }
149 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; 155 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
150 GrPipelineBuilder::AutoRestoreStencil ars; 156 if (clip.clipCoverageFragmentProcessor()) {
151 if (!fClipMaskManager->setupClipping(pipelineBuilder, &arfps, &ars, &scissor State, 157 arfps.set(&pipelineBuilder);
152 &batch->bounds())) { 158 arfps.addCoverageFragmentProcessor(clip.clipCoverageFragmentProcessor()) ;
153 return;
154 } 159 }
155 160
156 GrPipeline::CreateArgs args; 161 GrPipeline::CreateArgs args;
157 if (!this->installPipelineInDrawBatch(&pipelineBuilder, &scissorState, batch )) { 162 if (!this->installPipelineInDrawBatch(&pipelineBuilder, &scissorState, batch )) {
158 return; 163 return;
159 } 164 }
160 165
161 this->recordBatch(batch); 166 this->recordBatch(batch);
162 } 167 }
163 168
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder, 204 void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder,
200 const SkMatrix& viewMatrix, 205 const SkMatrix& viewMatrix,
201 const GrPath* path, 206 const GrPath* path,
202 GrPathRendering::FillType fill) { 207 GrPathRendering::FillType fill) {
203 // TODO: extract portions of checkDraw that are relevant to path stenciling. 208 // TODO: extract portions of checkDraw that are relevant to path stenciling.
204 SkASSERT(path); 209 SkASSERT(path);
205 SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport()); 210 SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport());
206 211
207 // Setup clip 212 // Setup clip
208 GrScissorState scissorState; 213 GrScissorState scissorState;
214 GrPipelineBuilder::AutoRestoreStencil ars;
215 GrAppliedClip clip;
216 if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &scissorState, n ullptr, &clip)) {
217 return;
218 }
219
209 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; 220 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
210 GrPipelineBuilder::AutoRestoreStencil ars; 221 if (clip.clipCoverageFragmentProcessor()) {
211 222 arfps.set(&pipelineBuilder);
212 if (!fClipMaskManager->setupClipping(pipelineBuilder, &arfps, &ars, &scissor State, nullptr)) { 223 arfps.addCoverageFragmentProcessor(clip.clipCoverageFragmentProcessor()) ;
213 return;
214 } 224 }
215 225
216 // set stencil settings for path 226 // set stencil settings for path
217 GrStencilSettings stencilSettings; 227 GrStencilSettings stencilSettings;
218 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); 228 GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
219 GrStencilAttachment* sb = fResourceProvider->attachStencilAttachment(rt); 229 GrStencilAttachment* sb = fResourceProvider->attachStencilAttachment(rt);
220 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); 230 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings);
221 231
222 GrBatch* batch = GrStencilPathBatch::Create(viewMatrix, 232 GrBatch* batch = GrStencilPathBatch::Create(viewMatrix,
223 pipelineBuilder.isHWAntialias(), 233 pipelineBuilder.isHWAntialias(),
(...skipping 30 matching lines...) Expand all
254 264
255 void GrDrawTarget::drawPathBatch(const GrPipelineBuilder& pipelineBuilder, 265 void GrDrawTarget::drawPathBatch(const GrPipelineBuilder& pipelineBuilder,
256 GrDrawPathBatchBase* batch, 266 GrDrawPathBatchBase* batch,
257 GrPathRendering::FillType fill) { 267 GrPathRendering::FillType fill) {
258 // This looks like drawBatch() but there is an added wrinkle that stencil se ttings get inserted 268 // This looks like drawBatch() but there is an added wrinkle that stencil se ttings get inserted
259 // after setting up clipping but before onDrawBatch(). TODO: Figure out a be tter model for 269 // after setting up clipping but before onDrawBatch(). TODO: Figure out a be tter model for
260 // handling stencil settings WRT interactions between pipeline(builder), cli pmaskmanager, and 270 // handling stencil settings WRT interactions between pipeline(builder), cli pmaskmanager, and
261 // batches. 271 // batches.
262 272
263 GrScissorState scissorState; 273 GrScissorState scissorState;
274 GrPipelineBuilder::AutoRestoreStencil ars;
275 GrAppliedClip clip;
276 if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &scissorState, & batch->bounds(),
277 &clip)) {
278 return;
279 }
280
264 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; 281 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
265 GrPipelineBuilder::AutoRestoreStencil ars; 282 if (clip.clipCoverageFragmentProcessor()) {
266 if (!fClipMaskManager->setupClipping(pipelineBuilder, &arfps, &ars, &scissor State, 283 arfps.set(&pipelineBuilder);
267 &batch->bounds())) { 284 arfps.addCoverageFragmentProcessor(clip.clipCoverageFragmentProcessor()) ;
268 return;
269 } 285 }
270 286
271 // Ensure the render target has a stencil buffer and get the stencil setting s. 287 // Ensure the render target has a stencil buffer and get the stencil setting s.
272 GrStencilSettings stencilSettings; 288 GrStencilSettings stencilSettings;
273 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); 289 GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
274 GrStencilAttachment* sb = fResourceProvider->attachStencilAttachment(rt); 290 GrStencilAttachment* sb = fResourceProvider->attachStencilAttachment(rt);
275 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); 291 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings);
276 batch->setStencilSettings(stencilSettings); 292 batch->setStencilSettings(stencilSettings);
277 293
278 GrPipeline::CreateArgs args; 294 GrPipeline::CreateArgs args;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 } 479 }
464 480
465 return true; 481 return true;
466 } 482 }
467 483
468 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) { 484 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) {
469 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); 485 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt);
470 this->recordBatch(batch); 486 this->recordBatch(batch);
471 batch->unref(); 487 batch->unref();
472 } 488 }
OLDNEW
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/effects/GrTextureDomain.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698