| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) { | 200 if (FLAGS_preprocess) { |
| 201 // Because the GPU preprocessing step relies on the in-memory picture | 201 // Because the GPU preprocessing step relies on the in-memory picture |
| 202 // statistics we need to rerecord the picture here | 202 // statistics we need to rerecord the picture here |
| 203 SkPictureRecorder recorder; | 203 SkPictureRecorder recorder; |
| 204 picture->draw(recorder.beginRecording(picture->width(), picture->height(
), NULL, 0)); | 204 picture->draw(recorder.beginRecording(picture->cullRect().width(), |
| 205 picture->cullRect().height(), |
| 206 NULL, 0)); |
| 205 picture.reset(recorder.endRecording()); | 207 picture.reset(recorder.endRecording()); |
| 206 } | 208 } |
| 207 | 209 |
| 208 SkString filename = SkOSPath::Basename(inputPath.c_str()); | 210 SkString filename = SkOSPath::Basename(inputPath.c_str()); |
| 209 | 211 |
| 210 gWriter.bench(filename.c_str(), picture->width(), picture->height()); | 212 gWriter.bench(filename.c_str(), |
| 213 SkScalarCeilToInt(picture->cullRect().width()), |
| 214 SkScalarCeilToInt(picture->cullRect().height())); |
| 211 | 215 |
| 212 benchmark.run(picture); | 216 benchmark.run(picture); |
| 213 | 217 |
| 214 #if SK_LAZY_CACHE_STATS | 218 #if SK_LAZY_CACHE_STATS |
| 215 if (FLAGS_trackDeferredCaching) { | 219 if (FLAGS_trackDeferredCaching) { |
| 216 int cacheHits = pool->getCacheHits(); | 220 int cacheHits = pool->getCacheHits(); |
| 217 int cacheMisses = pool->getCacheMisses(); | 221 int cacheMisses = pool->getCacheMisses(); |
| 218 pool->resetCacheHitsAndMisses(); | 222 pool->resetCacheHitsAndMisses(); |
| 219 SkString hitString; | 223 SkString hitString; |
| 220 hitString.printf("Cache hit rate: %f\n", (double) cacheHits / (cacheHits
+ cacheMisses)); | 224 hitString.printf("Cache hit rate: %f\n", (double) cacheHits / (cacheHits
+ cacheMisses)); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 #endif | 478 #endif |
| 475 gWriter.end(); | 479 gWriter.end(); |
| 476 return 0; | 480 return 0; |
| 477 } | 481 } |
| 478 | 482 |
| 479 #if !defined SK_BUILD_FOR_IOS | 483 #if !defined SK_BUILD_FOR_IOS |
| 480 int main(int argc, char * const argv[]) { | 484 int main(int argc, char * const argv[]) { |
| 481 return tool_main(argc, (char**) argv); | 485 return tool_main(argc, (char**) argv); |
| 482 } | 486 } |
| 483 #endif | 487 #endif |
| OLD | NEW |