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

Side by Side Diff: tools/VisualBench/VisualSKPBench.cpp

Issue 1427533002: Flush GrContext between benchmark draw loops (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Check for SK_SUPPORT_GPU Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « tools/VisualBench/VisualBenchmarkStream.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 * 6 *
7 */ 7 */
8 8
9 #include "VisualSKPBench.h" 9 #include "VisualSKPBench.h"
10 10
11 #if SK_SUPPORT_GPU
12 #include "GrContext.h"
13 #endif
14
11 VisualSKPBench::VisualSKPBench(const char* name, const SkPicture* pic) 15 VisualSKPBench::VisualSKPBench(const char* name, const SkPicture* pic)
12 : fPic(SkRef(pic)) 16 : fPic(SkRef(pic))
13 , fName(name) { 17 , fName(name) {
14 fUniqueName.printf("%s", name); 18 fUniqueName.printf("%s", name);
15 } 19 }
16 20
17 const char* VisualSKPBench::onGetName() { 21 const char* VisualSKPBench::onGetName() {
18 return fName.c_str(); 22 return fName.c_str();
19 } 23 }
20 24
21 const char* VisualSKPBench::onGetUniqueName() { 25 const char* VisualSKPBench::onGetUniqueName() {
22 return fUniqueName.c_str(); 26 return fUniqueName.c_str();
23 } 27 }
24 28
25 bool VisualSKPBench::isSuitableFor(Backend backend) { 29 bool VisualSKPBench::isSuitableFor(Backend backend) {
26 return backend != kNonRendering_Backend; 30 return backend != kNonRendering_Backend;
27 } 31 }
28 32
29 void VisualSKPBench::onDraw(int loops, SkCanvas* canvas) { 33 void VisualSKPBench::onDraw(int loops, SkCanvas* canvas) {
30 for (int i = 0; i < loops; i++) { 34 for (int i = 0; i < loops; i++) {
31 canvas->drawPicture(fPic); 35 canvas->drawPicture(fPic);
36 #if SK_SUPPORT_GPU
37 // Ensure the GrContext doesn't batch across draw loops.
38 if (GrContext* context = canvas->getGrContext()) {
39 context->flush();
40 }
41 #endif
32 } 42 }
33 } 43 }
OLDNEW
« no previous file with comments | « tools/VisualBench/VisualBenchmarkStream.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698