| 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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 } | 442 } |
| 443 | 443 |
| 444 void GrDrawTarget::recordBatch(GrBatch* batch) { | 444 void GrDrawTarget::recordBatch(GrBatch* batch) { |
| 445 // A closed drawTarget should never receive new/more batches | 445 // A closed drawTarget should never receive new/more batches |
| 446 SkASSERT(!this->isClosed()); | 446 SkASSERT(!this->isClosed()); |
| 447 | 447 |
| 448 // Check if there is a Batch Draw we can batch with by linearly searching ba
ck until we either | 448 // Check if there is a Batch Draw we can batch with by linearly searching ba
ck until we either |
| 449 // 1) check every draw | 449 // 1) check every draw |
| 450 // 2) intersect with something | 450 // 2) intersect with something |
| 451 // 3) find a 'blocker' | 451 // 3) find a 'blocker' |
| 452 GR_AUDIT_TRAIL_ADDBATCH(fAuditTrail, batch->name(), batch->bounds()); | 452 GR_AUDIT_TRAIL_ADDBATCH(fAuditTrail, batch); |
| 453 GrBATCH_INFO("Re-Recording (%s, B%u)\n" | 453 GrBATCH_INFO("Re-Recording (%s, B%u)\n" |
| 454 "\tBounds LRTB (%f, %f, %f, %f)\n", | 454 "\tBounds LRTB (%f, %f, %f, %f)\n", |
| 455 batch->name(), | 455 batch->name(), |
| 456 batch->uniqueID(), | 456 batch->uniqueID(), |
| 457 batch->bounds().fLeft, batch->bounds().fRight, | 457 batch->bounds().fLeft, batch->bounds().fRight, |
| 458 batch->bounds().fTop, batch->bounds().fBottom); | 458 batch->bounds().fTop, batch->bounds().fBottom); |
| 459 GrBATCH_INFO(SkTabString(batch->dumpInfo(), 1).c_str()); | 459 GrBATCH_INFO(SkTabString(batch->dumpInfo(), 1).c_str()); |
| 460 GrBATCH_INFO("\tOutcome:\n"); | 460 GrBATCH_INFO("\tOutcome:\n"); |
| 461 int maxCandidates = SkTMin(fMaxBatchLookback, fBatches.count()); | 461 int maxCandidates = SkTMin(fMaxBatchLookback, fBatches.count()); |
| 462 if (maxCandidates) { | 462 if (maxCandidates) { |
| 463 int i = 0; | 463 int i = 0; |
| 464 while (true) { | 464 while (true) { |
| 465 GrBatch* candidate = fBatches.fromBack(i); | 465 GrBatch* candidate = fBatches.fromBack(i); |
| 466 // We cannot continue to search backwards if the render target chang
es | 466 // We cannot continue to search backwards if the render target chang
es |
| 467 if (candidate->renderTargetUniqueID() != batch->renderTargetUniqueID
()) { | 467 if (candidate->renderTargetUniqueID() != batch->renderTargetUniqueID
()) { |
| 468 GrBATCH_INFO("\t\tBreaking because of (%s, B%u) Rendertarget\n", | 468 GrBATCH_INFO("\t\tBreaking because of (%s, B%u) Rendertarget\n", |
| 469 candidate->name(), candidate->uniqueID()); | 469 candidate->name(), candidate->uniqueID()); |
| 470 break; | 470 break; |
| 471 } | 471 } |
| 472 if (candidate->combineIfPossible(batch, *this->caps())) { | 472 if (candidate->combineIfPossible(batch, *this->caps())) { |
| 473 GrBATCH_INFO("\t\tCombining with (%s, B%u)\n", candidate->name()
, | 473 GrBATCH_INFO("\t\tCombining with (%s, B%u)\n", candidate->name()
, |
| 474 candidate->uniqueID()); | 474 candidate->uniqueID()); |
| 475 GR_AUDIT_TRAIL_BATCHING_RESULT_COMBINED(fAuditTrail, candidate); | 475 GR_AUDIT_TRAIL_BATCHING_RESULT_COMBINED(fAuditTrail, candidate,
batch); |
| 476 return; | 476 return; |
| 477 } | 477 } |
| 478 // Stop going backwards if we would cause a painter's order violatio
n. | 478 // Stop going backwards if we would cause a painter's order violatio
n. |
| 479 // TODO: The bounds used here do not fully consider the clip. It may
be advantageous | 479 // TODO: The bounds used here do not fully consider the clip. It may
be advantageous |
| 480 // to clip each batch's bounds to the clip. | 480 // to clip each batch's bounds to the clip. |
| 481 if (intersect(candidate->bounds(), batch->bounds())) { | 481 if (intersect(candidate->bounds(), batch->bounds())) { |
| 482 GrBATCH_INFO("\t\tIntersects with (%s, B%u)\n", candidate->name(
), | 482 GrBATCH_INFO("\t\tIntersects with (%s, B%u)\n", candidate->name(
), |
| 483 candidate->uniqueID()); | 483 candidate->uniqueID()); |
| 484 break; | 484 break; |
| 485 } | 485 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 } | 546 } |
| 547 | 547 |
| 548 return true; | 548 return true; |
| 549 } | 549 } |
| 550 | 550 |
| 551 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { | 551 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { |
| 552 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); | 552 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); |
| 553 this->recordBatch(batch); | 553 this->recordBatch(batch); |
| 554 batch->unref(); | 554 batch->unref(); |
| 555 } | 555 } |
| OLD | NEW |