| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &batch->bounds()
, &clip)) { | 221 if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &batch->bounds()
, &clip)) { |
| 222 return; | 222 return; |
| 223 } | 223 } |
| 224 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; | 224 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; |
| 225 if (clip.clipCoverageFragmentProcessor()) { | 225 if (clip.clipCoverageFragmentProcessor()) { |
| 226 arfps.set(&pipelineBuilder); | 226 arfps.set(&pipelineBuilder); |
| 227 arfps.addCoverageFragmentProcessor(clip.clipCoverageFragmentProcessor())
; | 227 arfps.addCoverageFragmentProcessor(clip.clipCoverageFragmentProcessor())
; |
| 228 } | 228 } |
| 229 | 229 |
| 230 GrPipeline::CreateArgs args; | 230 GrPipeline::CreateArgs args; |
| 231 if (!this->installPipelineInDrawBatch(&pipelineBuilder, &clip.scissorState()
, batch)) { | 231 if (!this->installPipelineInDrawBatch(&pipelineBuilder, clip, batch)) { |
| 232 return; | 232 return; |
| 233 } | 233 } |
| 234 | 234 |
| 235 #ifdef ENABLE_MDB | 235 #ifdef ENABLE_MDB |
| 236 SkASSERT(fRenderTarget); | 236 SkASSERT(fRenderTarget); |
| 237 batch->pipeline()->addDependenciesTo(fRenderTarget); | 237 batch->pipeline()->addDependenciesTo(fRenderTarget); |
| 238 #endif | 238 #endif |
| 239 | 239 |
| 240 this->recordBatch(batch); | 240 this->recordBatch(batch); |
| 241 } | 241 } |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 } | 358 } |
| 359 | 359 |
| 360 // Ensure the render target has a stencil buffer and get the stencil setting
s. | 360 // Ensure the render target has a stencil buffer and get the stencil setting
s. |
| 361 GrStencilSettings stencilSettings; | 361 GrStencilSettings stencilSettings; |
| 362 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); | 362 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); |
| 363 GrStencilAttachment* sb = fResourceProvider->attachStencilAttachment(rt); | 363 GrStencilAttachment* sb = fResourceProvider->attachStencilAttachment(rt); |
| 364 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); | 364 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); |
| 365 batch->setStencilSettings(stencilSettings); | 365 batch->setStencilSettings(stencilSettings); |
| 366 | 366 |
| 367 GrPipeline::CreateArgs args; | 367 GrPipeline::CreateArgs args; |
| 368 if (!this->installPipelineInDrawBatch(&pipelineBuilder, &clip.scissorState()
, batch)) { | 368 if (!this->installPipelineInDrawBatch(&pipelineBuilder, clip, batch)) { |
| 369 return; | 369 return; |
| 370 } | 370 } |
| 371 | 371 |
| 372 this->recordBatch(batch); | 372 this->recordBatch(batch); |
| 373 } | 373 } |
| 374 | 374 |
| 375 void GrDrawTarget::drawNonAARect(const GrPipelineBuilder& pipelineBuilder, | 375 void GrDrawTarget::drawNonAARect(const GrPipelineBuilder& pipelineBuilder, |
| 376 GrColor color, | 376 GrColor color, |
| 377 const SkMatrix& viewMatrix, | 377 const SkMatrix& viewMatrix, |
| 378 const SkRect& rect) { | 378 const SkRect& rect) { |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 fBatches[fFirstUnpreparedBatch++]->prepare(&fFlushState); | 538 fBatches[fFirstUnpreparedBatch++]->prepare(&fFlushState); |
| 539 } | 539 } |
| 540 if (fOptions.fImmediateMode) { | 540 if (fOptions.fImmediateMode) { |
| 541 this->flush(); | 541 this->flush(); |
| 542 } | 542 } |
| 543 } | 543 } |
| 544 | 544 |
| 545 /////////////////////////////////////////////////////////////////////////////// | 545 /////////////////////////////////////////////////////////////////////////////// |
| 546 | 546 |
| 547 bool GrDrawTarget::installPipelineInDrawBatch(const GrPipelineBuilder* pipelineB
uilder, | 547 bool GrDrawTarget::installPipelineInDrawBatch(const GrPipelineBuilder* pipelineB
uilder, |
| 548 const GrScissorState* scissor, | 548 const GrAppliedClip& clip, |
| 549 GrDrawBatch* batch) { | 549 GrDrawBatch* batch) { |
| 550 GrPipeline::CreateArgs args; | 550 GrPipeline::CreateArgs args; |
| 551 args.fPipelineBuilder = pipelineBuilder; | 551 args.fPipelineBuilder = pipelineBuilder; |
| 552 args.fCaps = this->caps(); | 552 args.fCaps = this->caps(); |
| 553 args.fScissor = scissor; | 553 args.fScissor = &clip.scissorState(); |
| 554 args.fColorPOI = pipelineBuilder->colorProcInfo(batch); | 554 args.fColorPOI = pipelineBuilder->colorProcInfo(batch); |
| 555 args.fCoveragePOI = pipelineBuilder->coverageProcInfo(batch); | 555 args.fCoveragePOI = pipelineBuilder->coverageProcInfo(batch); |
| 556 args.fAdditionalFlags = clip.additionalPipelineFlags(); |
| 557 args.fBlockedFlags = clip.blockedPipelineFlags(); |
| 556 if (!this->setupDstReadIfNecessary(*pipelineBuilder, args.fColorPOI, | 558 if (!this->setupDstReadIfNecessary(*pipelineBuilder, args.fColorPOI, |
| 557 args.fCoveragePOI, &args.fDstTexture, | 559 args.fCoveragePOI, &args.fDstTexture, |
| 558 batch->bounds())) { | 560 batch->bounds())) { |
| 559 return false; | 561 return false; |
| 560 } | 562 } |
| 561 | 563 |
| 562 if (!batch->installPipeline(args)) { | 564 if (!batch->installPipeline(args)) { |
| 563 return false; | 565 return false; |
| 564 } | 566 } |
| 565 | 567 |
| 566 return true; | 568 return true; |
| 567 } | 569 } |
| 568 | 570 |
| 569 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { | 571 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { |
| 570 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); | 572 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); |
| 571 this->recordBatch(batch); | 573 this->recordBatch(batch); |
| 572 batch->unref(); | 574 batch->unref(); |
| 573 } | 575 } |
| OLD | NEW |