Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(605)

Unified Diff: src/gpu/GrDrawTarget.cpp

Issue 1494473005: Add option to draw wireframe batch bounds (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: init vbo id to 0 Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrGpu.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698