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

Side by Side Diff: samplecode/SampleApp.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 | « bench/SKPBench.cpp ('k') | tools/VisualBench/VisualBenchmarkStream.cpp » ('j') | 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 2011 Google Inc. 2 * Copyright 2011 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 #include "SampleApp.h" 8 #include "SampleApp.h"
9 9
10 #include "OverView.h" 10 #include "OverView.h"
(...skipping 2239 matching lines...) Expand 10 before | Expand all | Expand 10 after
2250 void SampleView::onDraw(SkCanvas* canvas) { 2250 void SampleView::onDraw(SkCanvas* canvas) {
2251 if (!fHaveCalledOnceBeforeDraw) { 2251 if (!fHaveCalledOnceBeforeDraw) {
2252 fHaveCalledOnceBeforeDraw = true; 2252 fHaveCalledOnceBeforeDraw = true;
2253 this->onOnceBeforeDraw(); 2253 this->onOnceBeforeDraw();
2254 } 2254 }
2255 this->onDrawBackground(canvas); 2255 this->onDrawBackground(canvas);
2256 2256
2257 for (int i = 0; i < fRepeatCount; i++) { 2257 for (int i = 0; i < fRepeatCount; i++) {
2258 SkAutoCanvasRestore acr(canvas, true); 2258 SkAutoCanvasRestore acr(canvas, true);
2259 this->onDrawContent(canvas); 2259 this->onDrawContent(canvas);
2260 #if SK_SUPPORT_GPU
2261 // Ensure the GrContext doesn't batch across draw loops.
2262 if (GrContext* context = canvas->getGrContext()) {
2263 context->flush();
2264 }
2265 #endif
2260 } 2266 }
2261 } 2267 }
2262 2268
2263 void SampleView::onDrawBackground(SkCanvas* canvas) { 2269 void SampleView::onDrawBackground(SkCanvas* canvas) {
2264 canvas->drawColor(fBGColor); 2270 canvas->drawColor(fBGColor);
2265 } 2271 }
2266 2272
2267 /////////////////////////////////////////////////////////////////////////////// 2273 ///////////////////////////////////////////////////////////////////////////////
2268 2274
2269 template <typename T> void SkTBSort(T array[], int count) { 2275 template <typename T> void SkTBSort(T array[], int count) {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2397 #ifdef SK_BUILD_FOR_MAC 2403 #ifdef SK_BUILD_FOR_MAC
2398 setenv("ANDROID_ROOT", "/android/device/data", 0); 2404 setenv("ANDROID_ROOT", "/android/device/data", 0);
2399 #endif 2405 #endif
2400 SkGraphics::Init(); 2406 SkGraphics::Init();
2401 SkEvent::Init(); 2407 SkEvent::Init();
2402 } 2408 }
2403 2409
2404 void application_term() { 2410 void application_term() {
2405 SkEvent::Term(); 2411 SkEvent::Term();
2406 } 2412 }
OLDNEW
« no previous file with comments | « bench/SKPBench.cpp ('k') | tools/VisualBench/VisualBenchmarkStream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698