| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "BenchLogger.h" | 8 #include "BenchLogger.h" |
| 9 #include "Timer.h" | 9 #include "Timer.h" |
| 10 #include "CopyTilesRenderer.h" | 10 #include "CopyTilesRenderer.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 } | 190 } |
| 191 SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream, pr
oc)); | 191 SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream, pr
oc)); |
| 192 | 192 |
| 193 if (NULL == picture.get()) { | 193 if (NULL == picture.get()) { |
| 194 SkString err; | 194 SkString err; |
| 195 err.printf("Could not read an SkPicture from %s\n", inputPath.c_str()); | 195 err.printf("Could not read an SkPicture from %s\n", inputPath.c_str()); |
| 196 gLogger.logError(err); | 196 gLogger.logError(err); |
| 197 return false; | 197 return false; |
| 198 } | 198 } |
| 199 | 199 |
| 200 if (FLAGS_preprocess) { |
| 201 // Because the GPU preprocessing step relies on the in-memory picture |
| 202 // statistics we need to rerecord the picture here |
| 203 SkPictureRecorder recorder; |
| 204 picture->draw(recorder.beginRecording(picture->width(), picture->height(
), NULL, 0)); |
| 205 picture.reset(recorder.endRecording()); |
| 206 } |
| 207 |
| 200 SkString filename = SkOSPath::Basename(inputPath.c_str()); | 208 SkString filename = SkOSPath::Basename(inputPath.c_str()); |
| 201 | 209 |
| 202 gWriter.bench(filename.c_str(), picture->width(), picture->height()); | 210 gWriter.bench(filename.c_str(), picture->width(), picture->height()); |
| 203 | 211 |
| 204 benchmark.run(picture); | 212 benchmark.run(picture); |
| 205 | 213 |
| 206 #if SK_LAZY_CACHE_STATS | 214 #if SK_LAZY_CACHE_STATS |
| 207 if (FLAGS_trackDeferredCaching) { | 215 if (FLAGS_trackDeferredCaching) { |
| 208 int cacheHits = pool->getCacheHits(); | 216 int cacheHits = pool->getCacheHits(); |
| 209 int cacheMisses = pool->getCacheMisses(); | 217 int cacheMisses = pool->getCacheMisses(); |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 #endif | 474 #endif |
| 467 gWriter.end(); | 475 gWriter.end(); |
| 468 return 0; | 476 return 0; |
| 469 } | 477 } |
| 470 | 478 |
| 471 #if !defined SK_BUILD_FOR_IOS | 479 #if !defined SK_BUILD_FOR_IOS |
| 472 int main(int argc, char * const argv[]) { | 480 int main(int argc, char * const argv[]) { |
| 473 return tool_main(argc, (char**) argv); | 481 return tool_main(argc, (char**) argv); |
| 474 } | 482 } |
| 475 #endif | 483 #endif |
| OLD | NEW |