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

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

Issue 1228763005: small cleanups after fixing const of GrPipelineBuilder on DrawTarget (Closed) Base URL: https://skia.googlesource.com/skia.git@const-fix3
Patch Set: tweaks Created 5 years, 5 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/GrDrawTarget.h ('k') | src/gpu/GrOvalRenderer.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 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 fFlushing = false; 125 fFlushing = false;
126 this->reset(); 126 this->reset();
127 } 127 }
128 128
129 void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrBatch* batch) { 129 void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrBatch* batch) {
130 // TODO some kind of checkdraw, but not at this level 130 // TODO some kind of checkdraw, but not at this level
131 131
132 // Setup clip 132 // Setup clip
133 GrScissorState scissorState; 133 GrScissorState scissorState;
134 GrPipelineBuilder::AutoRestoreFragmentProcessors arfp; 134 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
135 GrPipelineBuilder::AutoRestoreStencil ars; 135 GrPipelineBuilder::AutoRestoreStencil ars;
136 GrPipelineBuilder::AutoRestoreProcessorDataManager arpdm; 136 if (!this->setupClip(pipelineBuilder, &arfps, &ars, &scissorState, &batch->b ounds())) {
137 if (!this->setupClip(pipelineBuilder, &arfp, &ars, &arpdm, &scissorState, &b atch->bounds())) {
138 return; 137 return;
139 } 138 }
140 139
141 // Batch bounds are tight, so for dev copies 140 // Batch bounds are tight, so for dev copies
142 // TODO move this into setupDstReadIfNecessary when paths are in batch 141 // TODO move this into setupDstReadIfNecessary when paths are in batch
143 SkRect bounds = batch->bounds(); 142 SkRect bounds = batch->bounds();
144 bounds.outset(0.5f, 0.5f); 143 bounds.outset(0.5f, 0.5f);
145 144
146 GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, batc h, &bounds, 145 GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, batc h, &bounds,
147 this); 146 this);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder, 189 void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder,
191 const GrPathProcessor* pathProc, 190 const GrPathProcessor* pathProc,
192 const GrPath* path, 191 const GrPath* path,
193 GrPathRendering::FillType fill) { 192 GrPathRendering::FillType fill) {
194 // TODO: extract portions of checkDraw that are relevant to path stenciling. 193 // TODO: extract portions of checkDraw that are relevant to path stenciling.
195 SkASSERT(path); 194 SkASSERT(path);
196 SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport()); 195 SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport());
197 196
198 // Setup clip 197 // Setup clip
199 GrScissorState scissorState; 198 GrScissorState scissorState;
200 GrPipelineBuilder::AutoRestoreFragmentProcessors arfp; 199 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
201 GrPipelineBuilder::AutoRestoreStencil ars; 200 GrPipelineBuilder::AutoRestoreStencil ars;
202 GrPipelineBuilder::AutoRestoreProcessorDataManager arpdm; 201 if (!this->setupClip(pipelineBuilder, &arfps, &ars, &scissorState, NULL)) {
203 if (!this->setupClip(pipelineBuilder, &arfp, &ars, &arpdm, &scissorState, NU LL)) {
204 return; 202 return;
205 } 203 }
206 204
207 // set stencil settings for path 205 // set stencil settings for path
208 GrStencilSettings stencilSettings; 206 GrStencilSettings stencilSettings;
209 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); 207 GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
210 GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment(); 208 GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment();
211 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); 209 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings);
212 210
213 this->onStencilPath(pipelineBuilder, pathProc, path, scissorState, stencilSe ttings); 211 this->onStencilPath(pipelineBuilder, pathProc, path, scissorState, stencilSe ttings);
214 } 212 }
215 213
216 void GrDrawTarget::drawPath(const GrPipelineBuilder& pipelineBuilder, 214 void GrDrawTarget::drawPath(const GrPipelineBuilder& pipelineBuilder,
217 const GrPathProcessor* pathProc, 215 const GrPathProcessor* pathProc,
218 const GrPath* path, 216 const GrPath* path,
219 GrPathRendering::FillType fill) { 217 GrPathRendering::FillType fill) {
220 // TODO: extract portions of checkDraw that are relevant to path rendering. 218 // TODO: extract portions of checkDraw that are relevant to path rendering.
221 SkASSERT(path); 219 SkASSERT(path);
222 SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport()); 220 SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport());
223 221
224 SkRect devBounds = path->getBounds(); 222 SkRect devBounds = path->getBounds();
225 pathProc->viewMatrix().mapRect(&devBounds); 223 pathProc->viewMatrix().mapRect(&devBounds);
226 224
227 // Setup clip 225 // Setup clip
228 GrScissorState scissorState; 226 GrScissorState scissorState;
229 GrPipelineBuilder::AutoRestoreFragmentProcessors arfp; 227 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
230 GrPipelineBuilder::AutoRestoreStencil ars; 228 GrPipelineBuilder::AutoRestoreStencil ars;
231 GrPipelineBuilder::AutoRestoreProcessorDataManager arpdm; 229 if (!this->setupClip(pipelineBuilder, &arfps, &ars, &scissorState, &devBound s)) {
232 if (!this->setupClip(pipelineBuilder, &arfp, &ars, &arpdm, &scissorState, &d evBounds)) {
233 return; 230 return;
234 } 231 }
235 232
236 // set stencil settings for path 233 // set stencil settings for path
237 GrStencilSettings stencilSettings; 234 GrStencilSettings stencilSettings;
238 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); 235 GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
239 GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment(); 236 GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment();
240 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); 237 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings);
241 238
242 GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, path Proc, &devBounds, 239 GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, path Proc, &devBounds,
(...skipping 15 matching lines...) Expand all
258 int count, 255 int count,
259 GrPathRendering::FillType fill) { 256 GrPathRendering::FillType fill) {
260 SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport()); 257 SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport());
261 SkASSERT(pathRange); 258 SkASSERT(pathRange);
262 SkASSERT(indices); 259 SkASSERT(indices);
263 SkASSERT(0 == reinterpret_cast<long>(indices) % GrPathRange::PathIndexSizeIn Bytes(indexType)); 260 SkASSERT(0 == reinterpret_cast<long>(indices) % GrPathRange::PathIndexSizeIn Bytes(indexType));
264 SkASSERT(transformValues); 261 SkASSERT(transformValues);
265 262
266 // Setup clip 263 // Setup clip
267 GrScissorState scissorState; 264 GrScissorState scissorState;
268 GrPipelineBuilder::AutoRestoreFragmentProcessors arfp; 265 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
269 GrPipelineBuilder::AutoRestoreStencil ars; 266 GrPipelineBuilder::AutoRestoreStencil ars;
270 GrPipelineBuilder::AutoRestoreProcessorDataManager arpdm; 267 if (!this->setupClip(pipelineBuilder, &arfps, &ars, &scissorState, NULL)) {
271 if (!this->setupClip(pipelineBuilder, &arfp, &ars, &arpdm, &scissorState, NU LL)) {
272 return; 268 return;
273 } 269 }
274 270
275 // set stencil settings for path 271 // set stencil settings for path
276 GrStencilSettings stencilSettings; 272 GrStencilSettings stencilSettings;
277 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); 273 GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
278 GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment(); 274 GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment();
279 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); 275 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings);
280 276
281 // Don't compute a bounding box for dst copy texture, we'll opt 277 // Don't compute a bounding box for dst copy texture, we'll opt
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 489
494 /////////////////////////////////////////////////////////////////////////////// 490 ///////////////////////////////////////////////////////////////////////////////
495 GrClipTarget::GrClipTarget(GrContext* context) 491 GrClipTarget::GrClipTarget(GrContext* context)
496 : INHERITED(context->getGpu(), context->resourceProvider()) 492 : INHERITED(context->getGpu(), context->resourceProvider())
497 , fContext(context) { 493 , fContext(context) {
498 fClipMaskManager.reset(SkNEW_ARGS(GrClipMaskManager, (this))); 494 fClipMaskManager.reset(SkNEW_ARGS(GrClipMaskManager, (this)));
499 } 495 }
500 496
501 497
502 bool GrClipTarget::setupClip(const GrPipelineBuilder& pipelineBuilder, 498 bool GrClipTarget::setupClip(const GrPipelineBuilder& pipelineBuilder,
503 GrPipelineBuilder::AutoRestoreFragmentProcessors* a rfp, 499 GrPipelineBuilder::AutoRestoreFragmentProcessorStat e* arfps,
504 GrPipelineBuilder::AutoRestoreStencil* ars, 500 GrPipelineBuilder::AutoRestoreStencil* ars,
505 GrPipelineBuilder::AutoRestoreProcessorDataManager* arpdm,
506 GrScissorState* scissorState, 501 GrScissorState* scissorState,
507 const SkRect* devBounds) { 502 const SkRect* devBounds) {
508 return fClipMaskManager->setupClipping(pipelineBuilder, 503 return fClipMaskManager->setupClipping(pipelineBuilder,
509 arfp, 504 arfps,
510 ars, 505 ars,
511 arpdm,
512 scissorState, 506 scissorState,
513 devBounds); 507 devBounds);
514 } 508 }
515 509
516 void GrClipTarget::purgeResources() { 510 void GrClipTarget::purgeResources() {
517 // The clip mask manager can rebuild all its clip masks so just 511 // The clip mask manager can rebuild all its clip masks so just
518 // get rid of them all. 512 // get rid of them all.
519 fClipMaskManager->purgeResources(); 513 fClipMaskManager->purgeResources();
520 }; 514 };
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrOvalRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698