Index: src/gpu/GrContext.cpp |
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp |
index e5bbb8fd918fcf0f4c3da9b0fba595979fb8273b..f05d8e66144966a6c7fefc52675edfbd82554faa 100644 |
--- a/src/gpu/GrContext.cpp |
+++ b/src/gpu/GrContext.cpp |
@@ -45,7 +45,7 @@ |
#include "SkTLazy.h" |
#include "SkTLS.h" |
#include "SkTraceEvent.h" |
- |
+#include "SkTTopoSort.h" |
#include "batches/GrBatch.h" |
@@ -95,9 +95,21 @@ void GrDrawingManager::reset() { |
} |
void GrDrawingManager::flush() { |
+ SkDEBUGCODE(bool result =) |
+ SkTTopoSort<GrDrawTarget, GrDrawTarget::TopoSortTraits>(&fDrawTargets); |
+ SkASSERT(result); |
+ |
for (int i = 0; i < fDrawTargets.count(); ++i) { |
fDrawTargets[i]->flush(); |
} |
+ |
+#ifndef ENABLE_MDB |
+ // When MDB is disabled we keep reusing the same drawTarget |
+ if (fDrawTargets.count()) { |
+ SkASSERT(fDrawTargets.count() == 1); |
+ fDrawTargets[0]->resetFlag(GrDrawTarget::kWasOutput_Flag); |
+ } |
+#endif |
} |
GrTextContext* GrDrawingManager::textContext(const SkSurfaceProps& props, |
@@ -131,8 +143,8 @@ GrTextContext* GrDrawingManager::textContext(const SkSurfaceProps& props, |
GrDrawTarget* GrDrawingManager::newDrawTarget(GrRenderTarget* rt) { |
SkASSERT(fContext); |
- // When MDB is disabled we always just return the single drawTarget |
#ifndef ENABLE_MDB |
+ // When MDB is disabled we always just return the single drawTarget |
if (fDrawTargets.count()) { |
SkASSERT(fDrawTargets.count() == 1); |
// DrawingManager gets the creation ref - this ref is for the caller |