| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 <ctype.h> | 8 #include <ctype.h> |
| 9 | 9 |
| 10 #include "nanobench.h" | 10 #include "nanobench.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 51 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
| 52 #include "nanobenchAndroid.h" | 52 #include "nanobenchAndroid.h" |
| 53 #endif | 53 #endif |
| 54 | 54 |
| 55 #if SK_SUPPORT_GPU | 55 #if SK_SUPPORT_GPU |
| 56 #include "gl/GrGLDefines.h" | 56 #include "gl/GrGLDefines.h" |
| 57 #include "GrCaps.h" | 57 #include "GrCaps.h" |
| 58 #include "GrContextFactory.h" | 58 #include "GrContextFactory.h" |
| 59 #include "gl/GrGLUtil.h" | 59 #include "gl/GrGLUtil.h" |
| 60 using sk_gpu_test::GrContextFactory; | 60 using sk_gpu_test::GrContextFactory; |
| 61 using sk_gpu_test::GLContext; | 61 using sk_gpu_test::GLTestContext; |
| 62 SkAutoTDelete<GrContextFactory> gGrFactory; | 62 SkAutoTDelete<GrContextFactory> gGrFactory; |
| 63 #endif | 63 #endif |
| 64 | 64 |
| 65 struct GrContextOptions; | 65 struct GrContextOptions; |
| 66 | 66 |
| 67 __SK_FORCE_IMAGE_DECODER_LINKING; | 67 __SK_FORCE_IMAGE_DECODER_LINKING; |
| 68 | 68 |
| 69 static const int kAutoTuneLoops = 0; | 69 static const int kAutoTuneLoops = 0; |
| 70 | 70 |
| 71 static const int kDefaultLoops = | 71 static const int kDefaultLoops = |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 if (!canvas->readPixels(bmp, 0, 0)) { | 151 if (!canvas->readPixels(bmp, 0, 0)) { |
| 152 SkDebugf("Can't read canvas pixels.\n"); | 152 SkDebugf("Can't read canvas pixels.\n"); |
| 153 return false; | 153 return false; |
| 154 } | 154 } |
| 155 return true; | 155 return true; |
| 156 } | 156 } |
| 157 | 157 |
| 158 #if SK_SUPPORT_GPU | 158 #if SK_SUPPORT_GPU |
| 159 struct GPUTarget : public Target { | 159 struct GPUTarget : public Target { |
| 160 explicit GPUTarget(const Config& c) : Target(c), gl(nullptr) { } | 160 explicit GPUTarget(const Config& c) : Target(c), gl(nullptr) { } |
| 161 GLContext* gl; | 161 GLTestContext* gl; |
| 162 | 162 |
| 163 void setup() override { | 163 void setup() override { |
| 164 this->gl->makeCurrent(); | 164 this->gl->makeCurrent(); |
| 165 // Make sure we're done with whatever came before. | 165 // Make sure we're done with whatever came before. |
| 166 GR_GL_CALL(this->gl->gl(), Finish()); | 166 GR_GL_CALL(this->gl->gl(), Finish()); |
| 167 } | 167 } |
| 168 void endTiming() override { | 168 void endTiming() override { |
| 169 if (this->gl) { | 169 if (this->gl) { |
| 170 GR_GL_CALL(this->gl->gl(), Flush()); | 170 GR_GL_CALL(this->gl->gl(), Flush()); |
| 171 this->gl->waitOnSyncOrSwap(); | 171 this->gl->waitOnSyncOrSwap(); |
| (...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1283 | 1283 |
| 1284 return 0; | 1284 return 0; |
| 1285 } | 1285 } |
| 1286 | 1286 |
| 1287 #if !defined SK_BUILD_FOR_IOS | 1287 #if !defined SK_BUILD_FOR_IOS |
| 1288 int main(int argc, char** argv) { | 1288 int main(int argc, char** argv) { |
| 1289 SkCommandLineFlags::Parse(argc, argv); | 1289 SkCommandLineFlags::Parse(argc, argv); |
| 1290 return nanobench_main(); | 1290 return nanobench_main(); |
| 1291 } | 1291 } |
| 1292 #endif | 1292 #endif |
| OLD | NEW |