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

Side by Side Diff: bench/GLBench.cpp

Issue 1379853003: Fix for nexus 5 crashing in GL benches (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « bench/GLBench.h ('k') | bench/GameBench.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 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 #include "GLBench.h" 8 #include "GLBench.h"
9 9
10 #if SK_SUPPORT_GPU 10 #if SK_SUPPORT_GPU
(...skipping 14 matching lines...) Expand all
25 25
26 const GrGLContext* ctx = gpu->glContextForTesting(); 26 const GrGLContext* ctx = gpu->glContextForTesting();
27 if (!ctx) { 27 if (!ctx) {
28 SkDebugf("Couldn't get an interface\n"); 28 SkDebugf("Couldn't get an interface\n");
29 return nullptr; 29 return nullptr;
30 } 30 }
31 31
32 return this->onGetGLContext(ctx); 32 return this->onGetGLContext(ctx);
33 } 33 }
34 34
35 void GLBench::onPerCanvasPreDraw(SkCanvas* canvas) { 35 void GLBench::onPreDraw(SkCanvas* canvas) {
36 // This bench exclusively tests GL calls directly 36 // This bench exclusively tests GL calls directly
37 const GrGLContext* ctx = this->getGLContext(canvas); 37 const GrGLContext* ctx = this->getGLContext(canvas);
38 if (!ctx) { 38 if (!ctx) {
39 return; 39 return;
40 } 40 }
41 this->setup(ctx); 41 this->setup(ctx);
42 } 42 }
43 43
44 void GLBench::onPerCanvasPostDraw(SkCanvas* canvas) { 44 void GLBench::onPostDraw(SkCanvas* canvas) {
45 // This bench exclusively tests GL calls directly 45 // This bench exclusively tests GL calls directly
46 const GrGLContext* ctx = this->getGLContext(canvas); 46 const GrGLContext* ctx = this->getGLContext(canvas);
47 if (!ctx) { 47 if (!ctx) {
48 return; 48 return;
49 } 49 }
50 this->teardown(ctx->interface()); 50 this->teardown(ctx->interface());
51 } 51 }
52 52
53 void GLBench::onDraw(const int loops, SkCanvas* canvas) { 53 void GLBench::onDraw(const int loops, SkCanvas* canvas) {
54 const GrGLContext* ctx = this->getGLContext(canvas); 54 const GrGLContext* ctx = this->getGLContext(canvas);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 bm.setPixels(readback.get()); 163 bm.setPixels(readback.get());
164 164
165 if (!SkImageEncoder::EncodeFile(filename, bm, SkImageEncoder::kPNG_Type, 100 )) { 165 if (!SkImageEncoder::EncodeFile(filename, bm, SkImageEncoder::kPNG_Type, 100 )) {
166 SkDebugf("------ failed to encode %s\n", filename); 166 SkDebugf("------ failed to encode %s\n", filename);
167 remove(filename); // remove any partial file 167 remove(filename); // remove any partial file
168 return; 168 return;
169 } 169 }
170 } 170 }
171 171
172 #endif 172 #endif
OLDNEW
« no previous file with comments | « bench/GLBench.h ('k') | bench/GameBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698