OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrDrawTarget.h" | 8 #include "GrDrawTarget.h" |
9 | 9 |
10 #include "GrAppliedClip.h" | 10 #include "GrAppliedClip.h" |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 // remove all the previously recorded batches and change the load op to clea
r with supplied | 451 // remove all the previously recorded batches and change the load op to clea
r with supplied |
452 // color. | 452 // color. |
453 if (fLastFullClearBatch && | 453 if (fLastFullClearBatch && |
454 fLastFullClearBatch->renderTargetUniqueID() == renderTarget->getUniqueID
()) { | 454 fLastFullClearBatch->renderTargetUniqueID() == renderTarget->getUniqueID
()) { |
455 // As currently implemented, fLastFullClearBatch should be the last batc
h because we would | 455 // As currently implemented, fLastFullClearBatch should be the last batc
h because we would |
456 // have cleared it when another batch was recorded. | 456 // have cleared it when another batch was recorded. |
457 SkASSERT(fRecordedBatches.back().fBatch.get() == fLastFullClearBatch); | 457 SkASSERT(fRecordedBatches.back().fBatch.get() == fLastFullClearBatch); |
458 fLastFullClearBatch->setColor(color); | 458 fLastFullClearBatch->setColor(color); |
459 return; | 459 return; |
460 } | 460 } |
461 sk_sp<GrClearBatch> batch(GrClearBatch::Make(SkIRect::MakeWH(renderTarget->w
idth(), | 461 sk_sp<GrClearBatch> batch(GrClearBatch::Make(GrFixedClip::Disabled(), color,
renderTarget)); |
462 renderTarget->h
eight()), | |
463 color, renderTarget)); | |
464 if (batch.get() == this->recordBatch(batch.get(), batch->bounds())) { | 462 if (batch.get() == this->recordBatch(batch.get(), batch->bounds())) { |
465 fLastFullClearBatch = batch.get(); | 463 fLastFullClearBatch = batch.get(); |
466 } | 464 } |
467 } | 465 } |
468 | 466 |
469 void GrDrawTarget::discard(GrRenderTarget* renderTarget) { | 467 void GrDrawTarget::discard(GrRenderTarget* renderTarget) { |
470 // Currently this just inserts a discard batch. However, once in MDB this ca
n remove all the | 468 // Currently this just inserts a discard batch. However, once in MDB this ca
n remove all the |
471 // previously recorded batches and change the load op to discard. | 469 // previously recorded batches and change the load op to discard. |
472 if (this->caps()->discardRenderTargetSupport()) { | 470 if (this->caps()->discardRenderTargetSupport()) { |
473 GrBatch* batch = new GrDiscardBatch(renderTarget); | 471 GrBatch* batch = new GrDiscardBatch(renderTarget); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 if (j > maxCandidateIdx) { | 609 if (j > maxCandidateIdx) { |
612 GrBATCH_INFO("\t\tReached max lookahead or end of batch array %d
\n", i); | 610 GrBATCH_INFO("\t\tReached max lookahead or end of batch array %d
\n", i); |
613 break; | 611 break; |
614 } | 612 } |
615 } | 613 } |
616 } | 614 } |
617 } | 615 } |
618 | 616 |
619 /////////////////////////////////////////////////////////////////////////////// | 617 /////////////////////////////////////////////////////////////////////////////// |
620 | 618 |
621 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { | 619 void GrDrawTarget::clearStencilClip(const GrFixedClip& clip, |
622 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); | 620 bool insideStencilMask, |
| 621 GrRenderTarget* rt) { |
| 622 GrBatch* batch = new GrClearStencilClipBatch(clip, insideStencilMask, rt); |
623 this->recordBatch(batch, batch->bounds()); | 623 this->recordBatch(batch, batch->bounds()); |
624 batch->unref(); | 624 batch->unref(); |
625 } | 625 } |
OLD | NEW |