| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 fBatches[i]->draw(flushState); | 214 fBatches[i]->draw(flushState); |
| 215 } | 215 } |
| 216 | 216 |
| 217 fGpu->finishDrawTarget(); | 217 fGpu->finishDrawTarget(); |
| 218 } | 218 } |
| 219 | 219 |
| 220 void GrDrawTarget::reset() { | 220 void GrDrawTarget::reset() { |
| 221 fBatches.reset(); | 221 fBatches.reset(); |
| 222 } | 222 } |
| 223 | 223 |
| 224 void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, | 224 void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawBat
ch* batch) { |
| 225 GrDrawBatch* batch, | |
| 226 const SkIRect* scissorRect) { | |
| 227 // Setup clip | 225 // Setup clip |
| 228 GrPipelineBuilder::AutoRestoreStencil ars; | 226 GrPipelineBuilder::AutoRestoreStencil ars; |
| 229 GrAppliedClip clip; | 227 GrAppliedClip clip; |
| 230 | 228 if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &batch->bounds()
, &clip)) { |
| 231 if (scissorRect) { | 229 return; |
| 232 SkASSERT(GrClip::kWideOpen_ClipType == pipelineBuilder.clip().clipType()
); | |
| 233 if (!fClipMaskManager->setupScissorClip(pipelineBuilder, &ars, *scissorR
ect, | |
| 234 &batch->bounds(), &clip)) { | |
| 235 return; | |
| 236 } | |
| 237 } else { | |
| 238 if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &batch->boun
ds(), &clip)) { | |
| 239 return; | |
| 240 } | |
| 241 } | 230 } |
| 242 | |
| 243 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; | 231 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; |
| 244 if (clip.clipCoverageFragmentProcessor()) { | 232 if (clip.clipCoverageFragmentProcessor()) { |
| 245 arfps.set(&pipelineBuilder); | 233 arfps.set(&pipelineBuilder); |
| 246 arfps.addCoverageFragmentProcessor(clip.clipCoverageFragmentProcessor())
; | 234 arfps.addCoverageFragmentProcessor(clip.clipCoverageFragmentProcessor())
; |
| 247 } | 235 } |
| 248 | 236 |
| 249 GrPipeline::CreateArgs args; | 237 GrPipeline::CreateArgs args; |
| 250 if (!this->installPipelineInDrawBatch(&pipelineBuilder, &clip.scissorState()
, batch)) { | 238 if (!this->installPipelineInDrawBatch(&pipelineBuilder, &clip.scissorState()
, batch)) { |
| 251 return; | 239 return; |
| 252 } | 240 } |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 } | 534 } |
| 547 | 535 |
| 548 return true; | 536 return true; |
| 549 } | 537 } |
| 550 | 538 |
| 551 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { | 539 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { |
| 552 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); | 540 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); |
| 553 this->recordBatch(batch); | 541 this->recordBatch(batch); |
| 554 batch->unref(); | 542 batch->unref(); |
| 555 } | 543 } |
| OLD | NEW |