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

Unified Diff: bench/SKPBench.cpp

Issue 1715873002: Fix nanobench SKP flushes between loops (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/SKPBench.cpp
diff --git a/bench/SKPBench.cpp b/bench/SKPBench.cpp
index db55b45f435601bad64d2c371273549a4c6e7f9a..b4724195df27d84749dc7c3f4f32ed37e38710ae 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() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698