Index: tools/VisualBench/VisualSKPBench.cpp |
diff --git a/tools/VisualBench/VisualSKPBench.cpp b/tools/VisualBench/VisualSKPBench.cpp |
index 649d324a668474e69ed0e36ba44fc9f7546859f2..628265e53e103d9a485fd4d5c6dc76fc01c960a8 100644 |
--- a/tools/VisualBench/VisualSKPBench.cpp |
+++ b/tools/VisualBench/VisualSKPBench.cpp |
@@ -8,6 +8,10 @@ |
#include "VisualSKPBench.h" |
+#if SK_SUPPORT_GPU |
+#include "GrContext.h" |
+#endif |
+ |
VisualSKPBench::VisualSKPBench(const char* name, const SkPicture* pic) |
: fPic(SkRef(pic)) |
, fName(name) { |
@@ -29,5 +33,11 @@ bool VisualSKPBench::isSuitableFor(Backend backend) { |
void VisualSKPBench::onDraw(int loops, SkCanvas* canvas) { |
for (int i = 0; i < loops; i++) { |
canvas->drawPicture(fPic); |
+#if SK_SUPPORT_GPU |
+ // Ensure the GrContext doesn't batch across draw loops. |
+ if (GrContext* context = canvas->getGrContext()) { |
+ context->flush(); |
+ } |
+#endif |
} |
} |