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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 // target before the target is read. | 373 // target before the target is read. |
374 if (rect == &rtRect) { | 374 if (rect == &rtRect) { |
375 this->discard(renderTarget); | 375 this->discard(renderTarget); |
376 } | 376 } |
377 | 377 |
378 GrPipelineBuilder pipelineBuilder; | 378 GrPipelineBuilder pipelineBuilder; |
379 pipelineBuilder.setRenderTarget(renderTarget); | 379 pipelineBuilder.setRenderTarget(renderTarget); |
380 | 380 |
381 this->drawNonAARect(pipelineBuilder, color, SkMatrix::I(), *rect); | 381 this->drawNonAARect(pipelineBuilder, color, SkMatrix::I(), *rect); |
382 } else { | 382 } else { |
383 GrBatch* batch = SkNEW_ARGS(GrClearBatch, (*rect, color, renderTarget)); | 383 GrBatch* batch = new GrClearBatch(*rect, color, renderTarget); |
384 this->onDrawBatch(batch); | 384 this->onDrawBatch(batch); |
385 batch->unref(); | 385 batch->unref(); |
386 } | 386 } |
387 } | 387 } |
388 | 388 |
389 void GrDrawTarget::discard(GrRenderTarget* renderTarget) { | 389 void GrDrawTarget::discard(GrRenderTarget* renderTarget) { |
390 if (this->caps()->discardRenderTargetSupport()) { | 390 if (this->caps()->discardRenderTargetSupport()) { |
391 GrBatch* batch = SkNEW_ARGS(GrDiscardBatch, (renderTarget)); | 391 GrBatch* batch = new GrDiscardBatch(renderTarget); |
392 this->onDrawBatch(batch); | 392 this->onDrawBatch(batch); |
393 batch->unref(); | 393 batch->unref(); |
394 } | 394 } |
395 } | 395 } |
396 | 396 |
397 typedef GrTraceMarkerSet::Iter TMIter; | 397 typedef GrTraceMarkerSet::Iter TMIter; |
398 void GrDrawTarget::saveActiveTraceMarkers() { | 398 void GrDrawTarget::saveActiveTraceMarkers() { |
399 if (this->caps()->gpuTracingSupport()) { | 399 if (this->caps()->gpuTracingSupport()) { |
400 SkASSERT(0 == fStoredTraceMarkers.count()); | 400 SkASSERT(0 == fStoredTraceMarkers.count()); |
401 fStoredTraceMarkers.addSet(fActiveTraceMarkers); | 401 fStoredTraceMarkers.addSet(fActiveTraceMarkers); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 = NULL; |
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(SkNEW_ARGS(GrClipMaskManager, (this))); | 487 fClipMaskManager.reset(new GrClipMaskManager(this)); |
488 } | 488 } |
489 | 489 |
490 | 490 |
491 bool GrClipTarget::setupClip(const GrPipelineBuilder& pipelineBuilder, | 491 bool GrClipTarget::setupClip(const GrPipelineBuilder& pipelineBuilder, |
492 GrPipelineBuilder::AutoRestoreFragmentProcessorStat
e* arfps, | 492 GrPipelineBuilder::AutoRestoreFragmentProcessorStat
e* arfps, |
493 GrPipelineBuilder::AutoRestoreStencil* ars, | 493 GrPipelineBuilder::AutoRestoreStencil* ars, |
494 GrScissorState* scissorState, | 494 GrScissorState* scissorState, |
495 const SkRect* devBounds) { | 495 const SkRect* devBounds) { |
496 return fClipMaskManager->setupClipping(pipelineBuilder, | 496 return fClipMaskManager->setupClipping(pipelineBuilder, |
497 arfps, | 497 arfps, |
498 ars, | 498 ars, |
499 scissorState, | 499 scissorState, |
500 devBounds); | 500 devBounds); |
501 } | 501 } |
502 | 502 |
503 void GrClipTarget::purgeResources() { | 503 void GrClipTarget::purgeResources() { |
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 = SkNEW_ARGS(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 |