| 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 "SkCommandLineFlags.h" | 8 #include "SkCommandLineFlags.h" |
| 9 #include "SkForceLinking.h" | 9 #include "SkForceLinking.h" |
| 10 #include "SkGraphics.h" | 10 #include "SkGraphics.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 info.fOffset.setZero(); | 54 info.fOffset.setZero(); |
| 55 return SkNEW_ARGS(SkTileGridFactory, (info)); | 55 return SkNEW_ARGS(SkTileGridFactory, (info)); |
| 56 } | 56 } |
| 57 SkDebugf("Invalid bbh type %s, must be one of rtree, tilegrid.\n", FLAGS_bbh
[0]); | 57 SkDebugf("Invalid bbh type %s, must be one of rtree, tilegrid.\n", FLAGS_bbh
[0]); |
| 58 return NULL; | 58 return NULL; |
| 59 } | 59 } |
| 60 | 60 |
| 61 static void rerecord(const SkPicture& src, SkBBHFactory* bbhFactory) { | 61 static void rerecord(const SkPicture& src, SkBBHFactory* bbhFactory) { |
| 62 SkPictureRecorder recorder; | 62 SkPictureRecorder recorder; |
| 63 if (FLAGS_skr) { | 63 if (FLAGS_skr) { |
| 64 src.draw(recorder.EXPERIMENTAL_beginRecording(src.width(), src.height(),
bbhFactory)); | 64 src.draw(recorder.EXPERIMENTAL_beginRecording(src.cullRect().width(), |
| 65 src.cullRect().height(), |
| 66 bbhFactory)); |
| 65 } else { | 67 } else { |
| 66 src.draw(recorder. DEPRECATED_beginRecording(src.width(), src.height(),
bbhFactory)); | 68 src.draw(recorder. DEPRECATED_beginRecording(src.cullRect().width(), |
| 69 src.cullRect().height(), |
| 70 bbhFactory)); |
| 67 } | 71 } |
| 68 SkAutoTUnref<SkPicture> pic(recorder.endRecording()); | 72 SkAutoTUnref<SkPicture> pic(recorder.endRecording()); |
| 69 } | 73 } |
| 70 | 74 |
| 71 static void bench_record(const SkPicture& src, | 75 static void bench_record(const SkPicture& src, |
| 72 const double timerOverhead, | 76 const double timerOverhead, |
| 73 const char* name, | 77 const char* name, |
| 74 SkBBHFactory* bbhFactory) { | 78 SkBBHFactory* bbhFactory) { |
| 75 // Rerecord once to warm up any caches. Otherwise the first sample can be v
ery noisy. | 79 // Rerecord once to warm up any caches. Otherwise the first sample can be v
ery noisy. |
| 76 rerecord(src, bbhFactory); | 80 rerecord(src, bbhFactory); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 bench_record(*src, overheadEstimate, filename.c_str(), bbhFactory.get())
; | 168 bench_record(*src, overheadEstimate, filename.c_str(), bbhFactory.get())
; |
| 165 } | 169 } |
| 166 return failed ? 1 : 0; | 170 return failed ? 1 : 0; |
| 167 } | 171 } |
| 168 | 172 |
| 169 #if !defined SK_BUILD_FOR_IOS | 173 #if !defined SK_BUILD_FOR_IOS |
| 170 int main(int argc, char * const argv[]) { | 174 int main(int argc, char * const argv[]) { |
| 171 return tool_main(argc, (char**) argv); | 175 return tool_main(argc, (char**) argv); |
| 172 } | 176 } |
| 173 #endif | 177 #endif |
| OLD | NEW |