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 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 } else { | 564 } else { |
565 GrBATCH_INFO("\t\tFirstBatch\n"); | 565 GrBATCH_INFO("\t\tFirstBatch\n"); |
566 } | 566 } |
567 GR_AUDIT_TRAIL_BATCHING_RESULT_NEW(fAuditTrail, batch); | 567 GR_AUDIT_TRAIL_BATCHING_RESULT_NEW(fAuditTrail, batch); |
568 fRecordedBatches.emplace_back(RecordedBatch{sk_ref_sp(batch), clippedBounds}
); | 568 fRecordedBatches.emplace_back(RecordedBatch{sk_ref_sp(batch), clippedBounds}
); |
569 fLastFullClearBatch = nullptr; | 569 fLastFullClearBatch = nullptr; |
570 return batch; | 570 return batch; |
571 } | 571 } |
572 | 572 |
573 void GrDrawTarget::forwardCombine() { | 573 void GrDrawTarget::forwardCombine() { |
| 574 if (fMaxBatchLookahead <= 0) { |
| 575 return; |
| 576 } |
574 for (int i = 0; i < fRecordedBatches.count() - 2; ++i) { | 577 for (int i = 0; i < fRecordedBatches.count() - 2; ++i) { |
575 GrBatch* batch = fRecordedBatches[i].fBatch.get(); | 578 GrBatch* batch = fRecordedBatches[i].fBatch.get(); |
576 const SkRect& batchBounds = fRecordedBatches[i].fClippedBounds; | 579 const SkRect& batchBounds = fRecordedBatches[i].fClippedBounds; |
577 int maxCandidateIdx = SkTMin(i + fMaxBatchLookahead, fRecordedBatches.co
unt() - 1); | 580 int maxCandidateIdx = SkTMin(i + fMaxBatchLookahead, fRecordedBatches.co
unt() - 1); |
578 int j = i + 1; | 581 int j = i + 1; |
579 while (true) { | 582 while (true) { |
580 GrBatch* candidate = fRecordedBatches[j].fBatch.get(); | 583 GrBatch* candidate = fRecordedBatches[j].fBatch.get(); |
581 // We cannot continue to search if the render target changes | 584 // We cannot continue to search if the render target changes |
582 if (candidate->renderTargetUniqueID() != batch->renderTargetUniqueID
()) { | 585 if (candidate->renderTargetUniqueID() != batch->renderTargetUniqueID
()) { |
583 GrBATCH_INFO("\t\tBreaking because of (%s, B%u) Rendertarget\n", | 586 GrBATCH_INFO("\t\tBreaking because of (%s, B%u) Rendertarget\n", |
(...skipping 29 matching lines...) Expand all Loading... |
613 } | 616 } |
614 } | 617 } |
615 | 618 |
616 /////////////////////////////////////////////////////////////////////////////// | 619 /////////////////////////////////////////////////////////////////////////////// |
617 | 620 |
618 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { | 621 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { |
619 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); | 622 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); |
620 this->recordBatch(batch, batch->bounds()); | 623 this->recordBatch(batch, batch->bounds()); |
621 batch->unref(); | 624 batch->unref(); |
622 } | 625 } |
OLD | NEW |