Index: src/gpu/GrDrawTarget.cpp |
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp |
index 59488c4d0352b596ea32334b956a291955bdeb5e..55f66249847c1970733415521fe2ba05251e0347 100644 |
--- a/src/gpu/GrDrawTarget.cpp |
+++ b/src/gpu/GrDrawTarget.cpp |
@@ -32,6 +32,9 @@ |
//////////////////////////////////////////////////////////////////////////////// |
+// Experimentally we have found that most batching occurs within the first 10 comparisons. |
+static const int kDefaultMaxBatchLookback = 10; |
+ |
GrDrawTarget::GrDrawTarget(GrRenderTarget* rt, GrGpu* gpu, GrResourceProvider* resourceProvider, |
const Options& options) |
: fGpu(SkRef(gpu)) |
@@ -44,6 +47,8 @@ GrDrawTarget::GrDrawTarget(GrRenderTarget* rt, GrGpu* gpu, GrResourceProvider* r |
fClipMaskManager.reset(new GrClipMaskManager(this, options.fClipBatchToBounds)); |
fDrawBatchBounds = options.fDrawBatchBounds; |
+ fMaxBatchLookback = (options.fMaxBatchLookback < 0) ? kDefaultMaxBatchLookback : |
+ options.fMaxBatchLookback; |
rt->setLastDrawTarget(this); |
@@ -469,8 +474,6 @@ void GrDrawTarget::recordBatch(GrBatch* batch) { |
// 1) check every draw |
// 2) intersect with something |
// 3) find a 'blocker' |
- // Experimentally we have found that most batching occurs within the first 10 comparisons. |
- static const int kMaxLookback = 10; |
GrBATCH_INFO("Re-Recording (%s, B%u)\n" |
"\tBounds LRTB (%f, %f, %f, %f)\n", |
@@ -480,7 +483,7 @@ void GrDrawTarget::recordBatch(GrBatch* batch) { |
batch->bounds().fTop, batch->bounds().fBottom); |
GrBATCH_INFO(SkTabString(batch->dumpInfo(), 1).c_str()); |
GrBATCH_INFO("\tOutcome:\n"); |
- int maxCandidates = SkTMin(kMaxLookback, fBatches.count()); |
+ int maxCandidates = SkTMin(fMaxBatchLookback, fBatches.count()); |
if (maxCandidates) { |
int i = 0; |
while (true) { |