OLD | NEW |
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 } | 49 } |
50 this->teardown(ctx->interface()); | 50 this->teardown(ctx->interface()); |
51 } | 51 } |
52 | 52 |
53 void GLBench::onDraw(int loops, SkCanvas* canvas) { | 53 void GLBench::onDraw(int loops, SkCanvas* canvas) { |
54 const GrGLContext* ctx = this->getGLContext(canvas); | 54 const GrGLContext* ctx = this->getGLContext(canvas); |
55 if (!ctx) { | 55 if (!ctx) { |
56 return; | 56 return; |
57 } | 57 } |
58 this->glDraw(loops, ctx); | 58 this->glDraw(loops, ctx); |
| 59 canvas->getGrContext()->resetContext(); |
59 } | 60 } |
60 | 61 |
61 GrGLuint GLBench::CompileShader(const GrGLInterface* gl, const char* shaderSrc,
GrGLenum type) { | 62 GrGLuint GLBench::CompileShader(const GrGLInterface* gl, const char* shaderSrc,
GrGLenum type) { |
62 GrGLuint shader; | 63 GrGLuint shader; |
63 // Create the shader object | 64 // Create the shader object |
64 GR_GL_CALL_RET(gl, shader, CreateShader(type)); | 65 GR_GL_CALL_RET(gl, shader, CreateShader(type)); |
65 | 66 |
66 // Load the shader source | 67 // Load the shader source |
67 GR_GL_CALL(gl, ShaderSource(shader, 1, &shaderSrc, nullptr)); | 68 GR_GL_CALL(gl, ShaderSource(shader, 1, &shaderSrc, nullptr)); |
68 | 69 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 bm.setPixels(readback.get()); | 164 bm.setPixels(readback.get()); |
164 | 165 |
165 if (!SkImageEncoder::EncodeFile(filename, bm, SkImageEncoder::kPNG_Type, 100
)) { | 166 if (!SkImageEncoder::EncodeFile(filename, bm, SkImageEncoder::kPNG_Type, 100
)) { |
166 SkDebugf("------ failed to encode %s\n", filename); | 167 SkDebugf("------ failed to encode %s\n", filename); |
167 remove(filename); // remove any partial file | 168 remove(filename); // remove any partial file |
168 return; | 169 return; |
169 } | 170 } |
170 } | 171 } |
171 | 172 |
172 #endif | 173 #endif |
OLD | NEW |