Index: src/gpu/GrDrawTarget.cpp |
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp |
index 9b7fa31ab03c8a55a1a4109a514a487cd489f1c7..4f91a3cf96ff340d34ce6654fc8de2bc0bb378d8 100644 |
--- a/src/gpu/GrDrawTarget.cpp |
+++ b/src/gpu/GrDrawTarget.cpp |
@@ -43,6 +43,8 @@ GrDrawTarget::GrDrawTarget(GrRenderTarget* rt, GrGpu* gpu, GrResourceProvider* r |
fContext = fGpu->getContext(); |
fClipMaskManager.reset(new GrClipMaskManager(this, options.fClipBatchToBounds)); |
+ fDrawBatchBounds = options.fDrawBatchBounds; |
+ |
rt->setLastDrawTarget(this); |
#ifdef SK_DEBUG |
@@ -195,7 +197,18 @@ void GrDrawTarget::prepareBatches(GrBatchFlushState* flushState) { |
void GrDrawTarget::drawBatches(GrBatchFlushState* flushState) { |
// Draw all the generated geometry. |
+ SkRandom random; |
for (int i = 0; i < fBatches.count(); ++i) { |
+ if (fDrawBatchBounds) { |
+ const SkRect& bounds = fBatches[i]->bounds(); |
+ SkIRect ibounds; |
+ bounds.roundOut(&ibounds); |
+ // In multi-draw buffer all the batches use the same render target and we won't need to |
+ // get the batchs bounds. |
+ if (GrRenderTarget* rt = fBatches[i]->renderTarget()) { |
+ fGpu->drawDebugWireRect(rt, ibounds, 0xFF000000 | random.nextU()); |
+ } |
+ } |
fBatches[i]->draw(flushState); |
} |