OLD | NEW |
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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 const GrPath* path, | 196 const GrPath* path, |
197 GrPathRendering::FillType fill) { | 197 GrPathRendering::FillType fill) { |
198 // TODO: extract portions of checkDraw that are relevant to path stenciling. | 198 // TODO: extract portions of checkDraw that are relevant to path stenciling. |
199 SkASSERT(path); | 199 SkASSERT(path); |
200 SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport()); | 200 SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport()); |
201 | 201 |
202 // Setup clip | 202 // Setup clip |
203 GrScissorState scissorState; | 203 GrScissorState scissorState; |
204 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; | 204 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; |
205 GrPipelineBuilder::AutoRestoreStencil ars; | 205 GrPipelineBuilder::AutoRestoreStencil ars; |
206 if (!this->setupClip(pipelineBuilder, &arfps, &ars, &scissorState, NULL)) { | 206 if (!this->setupClip(pipelineBuilder, &arfps, &ars, &scissorState, nullptr))
{ |
207 return; | 207 return; |
208 } | 208 } |
209 | 209 |
210 // set stencil settings for path | 210 // set stencil settings for path |
211 GrStencilSettings stencilSettings; | 211 GrStencilSettings stencilSettings; |
212 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); | 212 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); |
213 GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment(); | 213 GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment(); |
214 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); | 214 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); |
215 | 215 |
216 GrBatch* batch = GrStencilPathBatch::Create(pathProc->viewMatrix(), | 216 GrBatch* batch = GrStencilPathBatch::Create(pathProc->viewMatrix(), |
(...skipping 29 matching lines...) Expand all Loading... |
246 GrStencilSettings stencilSettings; | 246 GrStencilSettings stencilSettings; |
247 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); | 247 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); |
248 GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment(); | 248 GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment(); |
249 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); | 249 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); |
250 batch->setStencilSettings(stencilSettings); | 250 batch->setStencilSettings(stencilSettings); |
251 | 251 |
252 // Don't compute a bounding box for dst copy texture, we'll opt | 252 // Don't compute a bounding box for dst copy texture, we'll opt |
253 // instead for it to just copy the entire dst. Realistically this is a moot | 253 // instead for it to just copy the entire dst. Realistically this is a moot |
254 // point, because any context that supports NV_path_rendering will also | 254 // point, because any context that supports NV_path_rendering will also |
255 // support NV_blend_equation_advanced. | 255 // support NV_blend_equation_advanced. |
256 GrDrawTarget::PipelineInfo pipelineInfo(&pipelineBuilder, &scissorState, bat
ch, NULL, this); | 256 GrDrawTarget::PipelineInfo pipelineInfo(&pipelineBuilder, &scissorState, bat
ch, nullptr, this); |
257 | 257 |
258 if (!pipelineInfo.valid()) { | 258 if (!pipelineInfo.valid()) { |
259 return; | 259 return; |
260 } | 260 } |
261 if (!batch->installPipeline(pipelineInfo.pipelineCreateArgs())) { | 261 if (!batch->installPipeline(pipelineInfo.pipelineCreateArgs())) { |
262 return; | 262 return; |
263 } | 263 } |
264 | 264 |
265 this->onDrawBatch(batch); | 265 this->onDrawBatch(batch); |
266 batch->unref(); | 266 batch->unref(); |
(...skipping 12 matching lines...) Expand all Loading... |
279 SkASSERT(pathRange); | 279 SkASSERT(pathRange); |
280 SkASSERT(indices); | 280 SkASSERT(indices); |
281 SkASSERT(0 == reinterpret_cast<intptr_t>(indices) % | 281 SkASSERT(0 == reinterpret_cast<intptr_t>(indices) % |
282 GrPathRange::PathIndexSizeInBytes(indexType)); | 282 GrPathRange::PathIndexSizeInBytes(indexType)); |
283 SkASSERT(transformValues); | 283 SkASSERT(transformValues); |
284 | 284 |
285 // Setup clip | 285 // Setup clip |
286 GrScissorState scissorState; | 286 GrScissorState scissorState; |
287 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; | 287 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; |
288 GrPipelineBuilder::AutoRestoreStencil ars; | 288 GrPipelineBuilder::AutoRestoreStencil ars; |
289 if (!this->setupClip(pipelineBuilder, &arfps, &ars, &scissorState, NULL)) { | 289 if (!this->setupClip(pipelineBuilder, &arfps, &ars, &scissorState, nullptr))
{ |
290 return; | 290 return; |
291 } | 291 } |
292 | 292 |
293 // set stencil settings for path | 293 // set stencil settings for path |
294 GrStencilSettings stencilSettings; | 294 GrStencilSettings stencilSettings; |
295 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); | 295 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); |
296 GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment(); | 296 GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment(); |
297 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); | 297 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); |
298 | 298 |
299 // Don't compute a bounding box for dst copy texture, we'll opt | 299 // Don't compute a bounding box for dst copy texture, we'll opt |
300 // instead for it to just copy the entire dst. Realistically this is a moot | 300 // instead for it to just copy the entire dst. Realistically this is a moot |
301 // point, because any context that supports NV_path_rendering will also | 301 // point, because any context that supports NV_path_rendering will also |
302 // support NV_blend_equation_advanced. | 302 // support NV_blend_equation_advanced. |
303 GrDrawTarget::PipelineInfo pipelineInfo(&pipelineBuilder, &scissorState, pat
hProc, NULL, this); | 303 GrDrawTarget::PipelineInfo pipelineInfo(&pipelineBuilder, &scissorState, pat
hProc, nullptr, this); |
304 if (!pipelineInfo.valid()) { | 304 if (!pipelineInfo.valid()) { |
305 return; | 305 return; |
306 } | 306 } |
307 | 307 |
308 this->onDrawPaths(pathProc, pathRange, indices, indexType, transformValues, | 308 this->onDrawPaths(pathProc, pathRange, indices, indexType, transformValues, |
309 transformType, count, stencilSettings, pipelineInfo); | 309 transformType, count, stencilSettings, pipelineInfo); |
310 } | 310 } |
311 | 311 |
312 void GrDrawTarget::drawNonAARect(const GrPipelineBuilder& pipelineBuilder, | 312 void GrDrawTarget::drawNonAARect(const GrPipelineBuilder& pipelineBuilder, |
313 GrColor color, | 313 GrColor color, |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 const GrPrimitiveProcessor* primProc, | 453 const GrPrimitiveProcessor* primProc, |
454 const SkRect* devBounds, | 454 const SkRect* devBounds, |
455 GrDrawTarget* target) { | 455 GrDrawTarget* target) { |
456 fArgs.fPipelineBuilder = pipelineBuilder; | 456 fArgs.fPipelineBuilder = pipelineBuilder; |
457 fArgs.fCaps = target->caps(); | 457 fArgs.fCaps = target->caps(); |
458 fArgs.fScissor = scissor; | 458 fArgs.fScissor = scissor; |
459 fArgs.fColorPOI = fArgs.fPipelineBuilder->colorProcInfo(primProc); | 459 fArgs.fColorPOI = fArgs.fPipelineBuilder->colorProcInfo(primProc); |
460 fArgs.fCoveragePOI = fArgs.fPipelineBuilder->coverageProcInfo(primProc); | 460 fArgs.fCoveragePOI = fArgs.fPipelineBuilder->coverageProcInfo(primProc); |
461 if (!target->setupDstReadIfNecessary(*fArgs.fPipelineBuilder, fArgs.fColorPO
I, | 461 if (!target->setupDstReadIfNecessary(*fArgs.fPipelineBuilder, fArgs.fColorPO
I, |
462 fArgs.fCoveragePOI, &fArgs.fDstTexture,
devBounds)) { | 462 fArgs.fCoveragePOI, &fArgs.fDstTexture,
devBounds)) { |
463 fArgs.fPipelineBuilder = NULL; | 463 fArgs.fPipelineBuilder = nullptr; |
464 } | 464 } |
465 } | 465 } |
466 | 466 |
467 GrDrawTarget::PipelineInfo::PipelineInfo(const GrPipelineBuilder* pipelineBuilde
r, | 467 GrDrawTarget::PipelineInfo::PipelineInfo(const GrPipelineBuilder* pipelineBuilde
r, |
468 const GrScissorState* scissor, | 468 const GrScissorState* scissor, |
469 const GrDrawBatch* batch, | 469 const GrDrawBatch* batch, |
470 const SkRect* devBounds, | 470 const SkRect* devBounds, |
471 GrDrawTarget* target) { | 471 GrDrawTarget* target) { |
472 fArgs.fPipelineBuilder = pipelineBuilder; | 472 fArgs.fPipelineBuilder = pipelineBuilder; |
473 fArgs.fCaps = target->caps(); | 473 fArgs.fCaps = target->caps(); |
474 fArgs.fScissor = scissor; | 474 fArgs.fScissor = scissor; |
475 fArgs.fColorPOI = fArgs.fPipelineBuilder->colorProcInfo(batch); | 475 fArgs.fColorPOI = fArgs.fPipelineBuilder->colorProcInfo(batch); |
476 fArgs.fCoveragePOI = fArgs.fPipelineBuilder->coverageProcInfo(batch); | 476 fArgs.fCoveragePOI = fArgs.fPipelineBuilder->coverageProcInfo(batch); |
477 if (!target->setupDstReadIfNecessary(*fArgs.fPipelineBuilder, fArgs.fColorPO
I, | 477 if (!target->setupDstReadIfNecessary(*fArgs.fPipelineBuilder, fArgs.fColorPO
I, |
478 fArgs.fCoveragePOI, &fArgs.fDstTexture,
devBounds)) { | 478 fArgs.fCoveragePOI, &fArgs.fDstTexture,
devBounds)) { |
479 fArgs.fPipelineBuilder = NULL; | 479 fArgs.fPipelineBuilder = nullptr; |
480 } | 480 } |
481 } | 481 } |
482 | 482 |
483 /////////////////////////////////////////////////////////////////////////////// | 483 /////////////////////////////////////////////////////////////////////////////// |
484 GrClipTarget::GrClipTarget(GrContext* context) | 484 GrClipTarget::GrClipTarget(GrContext* context) |
485 : INHERITED(context->getGpu(), context->resourceProvider()) | 485 : INHERITED(context->getGpu(), context->resourceProvider()) |
486 , fContext(context) { | 486 , fContext(context) { |
487 fClipMaskManager.reset(new GrClipMaskManager(this)); | 487 fClipMaskManager.reset(new GrClipMaskManager(this)); |
488 } | 488 } |
489 | 489 |
(...skipping 14 matching lines...) Expand all Loading... |
504 // The clip mask manager can rebuild all its clip masks so just | 504 // The clip mask manager can rebuild all its clip masks so just |
505 // get rid of them all. | 505 // get rid of them all. |
506 fClipMaskManager->purgeResources(); | 506 fClipMaskManager->purgeResources(); |
507 }; | 507 }; |
508 | 508 |
509 void GrClipTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { | 509 void GrClipTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { |
510 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); | 510 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); |
511 this->onDrawBatch(batch); | 511 this->onDrawBatch(batch); |
512 batch->unref(); | 512 batch->unref(); |
513 } | 513 } |
OLD | NEW |