From 31c45bbd5a4129b73843872e00b3bd86bd32008f Mon Sep 17 00:00:00 2001 From: cdalton Date: Mon, 22 Feb 2016 08:08:25 -0800 Subject: Fix nanobench SKP flushes between loops Updates SKPBench to actually flush between draw loops, as this was the original intent of the flush logic. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1715873002 Review URL: https://codereview.chromium.org/1715873002 --- bench/SKPBench.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'bench/SKPBench.cpp') diff --git a/bench/SKPBench.cpp b/bench/SKPBench.cpp index db55b45f43..b4724195df 100644 --- a/bench/SKPBench.cpp +++ b/bench/SKPBench.cpp @@ -110,21 +110,22 @@ SkIPoint SKPBench::onGetSize() { void SKPBench::onDraw(int loops, SkCanvas* canvas) { SkASSERT(fDoLooping || 1 == loops); - if (fUseMultiPictureDraw) { - for (int i = 0; i < loops; i++) { + while (1) { + if (fUseMultiPictureDraw) { this->drawMPDPicture(); - } - } else { - for (int i = 0; i < loops; i++) { + } else { this->drawPicture(); } - } + if (0 == --loops) { + break; + } #if SK_SUPPORT_GPU - // Ensure the GrContext doesn't batch across draw loops. - if (GrContext* context = canvas->getGrContext()) { - context->flush(); - } + // Ensure the GrContext doesn't batch across draw loops. + if (GrContext* context = canvas->getGrContext()) { + context->flush(); + } #endif + } } void SKPBench::drawMPDPicture() { -- cgit v1.2.3