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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 109 |
110 // Can't make it closed in the self-read case | 110 // Can't make it closed in the self-read case |
111 dt->makeClosed(); | 111 dt->makeClosed(); |
112 } | 112 } |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 #ifdef SK_DEBUG | 116 #ifdef SK_DEBUG |
117 void GrDrawTarget::dump() const { | 117 void GrDrawTarget::dump() const { |
118 SkDebugf("--------------------------------------------------------------\n")
; | 118 SkDebugf("--------------------------------------------------------------\n")
; |
119 SkDebugf("node: %d -> RT: %d\n", fDebugID, fRenderTarget ? fRenderTarget->ge
tUniqueID() : -1); | 119 SkDebugf("node: %d -> RT: %d\n", fDebugID, fRenderTarget ? fRenderTarget->un
iqueID() : -1); |
120 SkDebugf("relies On (%d): ", fDependencies.count()); | 120 SkDebugf("relies On (%d): ", fDependencies.count()); |
121 for (int i = 0; i < fDependencies.count(); ++i) { | 121 for (int i = 0; i < fDependencies.count(); ++i) { |
122 SkDebugf("%d, ", fDependencies[i]->fDebugID); | 122 SkDebugf("%d, ", fDependencies[i]->fDebugID); |
123 } | 123 } |
124 SkDebugf("\n"); | 124 SkDebugf("\n"); |
125 SkDebugf("batches (%d):\n", fRecordedBatches.count()); | 125 SkDebugf("batches (%d):\n", fRecordedBatches.count()); |
126 for (int i = 0; i < fRecordedBatches.count(); ++i) { | 126 for (int i = 0; i < fRecordedBatches.count(); ++i) { |
127 SkDebugf("*******************************\n"); | 127 SkDebugf("*******************************\n"); |
128 if (!fRecordedBatches[i].fBatch) { | 128 if (!fRecordedBatches[i].fBatch) { |
129 SkDebugf("%d: <combined forward>\n", i); | 129 SkDebugf("%d: <combined forward>\n", i); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 | 445 |
446 void GrDrawTarget::addBatch(sk_sp<GrBatch> batch) { | 446 void GrDrawTarget::addBatch(sk_sp<GrBatch> batch) { |
447 this->recordBatch(batch.get(), batch->bounds()); | 447 this->recordBatch(batch.get(), batch->bounds()); |
448 } | 448 } |
449 | 449 |
450 void GrDrawTarget::fullClear(GrRenderTarget* renderTarget, GrColor color) { | 450 void GrDrawTarget::fullClear(GrRenderTarget* renderTarget, GrColor color) { |
451 // Currently this just inserts or updates the last clear batch. However, onc
e in MDB this can | 451 // Currently this just inserts or updates the last clear batch. However, onc
e in MDB this can |
452 // remove all the previously recorded batches and change the load op to clea
r with supplied | 452 // remove all the previously recorded batches and change the load op to clea
r with supplied |
453 // color. | 453 // color. |
454 if (fLastFullClearBatch && | 454 if (fLastFullClearBatch && |
455 fLastFullClearBatch->renderTargetUniqueID() == renderTarget->getUniqueID
()) { | 455 fLastFullClearBatch->renderTargetUniqueID() == renderTarget->uniqueID())
{ |
456 // As currently implemented, fLastFullClearBatch should be the last batc
h because we would | 456 // As currently implemented, fLastFullClearBatch should be the last batc
h because we would |
457 // have cleared it when another batch was recorded. | 457 // have cleared it when another batch was recorded. |
458 SkASSERT(fRecordedBatches.back().fBatch.get() == fLastFullClearBatch); | 458 SkASSERT(fRecordedBatches.back().fBatch.get() == fLastFullClearBatch); |
459 fLastFullClearBatch->setColor(color); | 459 fLastFullClearBatch->setColor(color); |
460 return; | 460 return; |
461 } | 461 } |
462 sk_sp<GrClearBatch> batch(GrClearBatch::Make(GrFixedClip::Disabled(), color,
renderTarget)); | 462 sk_sp<GrClearBatch> batch(GrClearBatch::Make(GrFixedClip::Disabled(), color,
renderTarget)); |
463 if (batch.get() == this->recordBatch(batch.get(), batch->bounds())) { | 463 if (batch.get() == this->recordBatch(batch.get(), batch->bounds())) { |
464 fLastFullClearBatch = batch.get(); | 464 fLastFullClearBatch = batch.get(); |
465 } | 465 } |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 | 617 |
618 /////////////////////////////////////////////////////////////////////////////// | 618 /////////////////////////////////////////////////////////////////////////////// |
619 | 619 |
620 void GrDrawTarget::clearStencilClip(const GrFixedClip& clip, | 620 void GrDrawTarget::clearStencilClip(const GrFixedClip& clip, |
621 bool insideStencilMask, | 621 bool insideStencilMask, |
622 GrRenderTarget* rt) { | 622 GrRenderTarget* rt) { |
623 GrBatch* batch = new GrClearStencilClipBatch(clip, insideStencilMask, rt); | 623 GrBatch* batch = new GrClearStencilClipBatch(clip, insideStencilMask, rt); |
624 this->recordBatch(batch, batch->bounds()); | 624 this->recordBatch(batch, batch->bounds()); |
625 batch->unref(); | 625 batch->unref(); |
626 } | 626 } |
OLD | NEW |