| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 void GLBench::onPostDraw(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(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 } | 59 } |
| 60 | 60 |
| 61 GrGLuint GLBench::CompileShader(const GrGLInterface* gl, const char* shaderSrc,
GrGLenum type) { | 61 GrGLuint GLBench::CompileShader(const GrGLInterface* gl, const char* shaderSrc,
GrGLenum type) { |
| 62 GrGLuint shader; | 62 GrGLuint shader; |
| 63 // Create the shader object | 63 // Create the shader object |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |