| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 } | 72 } |
| 73 | 73 |
| 74 static void bench_record(SkPicture* src, const char* name, PictureFactory pictur
eFactory) { | 74 static void bench_record(SkPicture* src, const char* name, PictureFactory pictur
eFactory) { |
| 75 const SkMSec start = SkTime::GetMSecs(); | 75 const SkMSec start = SkTime::GetMSecs(); |
| 76 const int width = src ? src->width() : FLAGS_nullSize; | 76 const int width = src ? src->width() : FLAGS_nullSize; |
| 77 const int height = src ? src->height() : FLAGS_nullSize; | 77 const int height = src ? src->height() : FLAGS_nullSize; |
| 78 | 78 |
| 79 for (int i = 0; i < FLAGS_loops; i++) { | 79 for (int i = 0; i < FLAGS_loops; i++) { |
| 80 if (FLAGS_skr) { | 80 if (FLAGS_skr) { |
| 81 SkRecord record; | 81 SkRecord record; |
| 82 SkRecorder canvas(&record, width, height); | 82 SkRecorder canvas(SkRecorder::kWriteOnly_Mode, &record, width, heigh
t); |
| 83 if (NULL != src) { | 83 if (NULL != src) { |
| 84 src->draw(&canvas); | 84 src->draw(&canvas); |
| 85 } | 85 } |
| 86 } else { | 86 } else { |
| 87 int recordingFlags = FLAGS_flags; | 87 int recordingFlags = FLAGS_flags; |
| 88 SkAutoTUnref<SkPicture> dst(pictureFactory(width, height, &recording
Flags)); | 88 SkAutoTUnref<SkPicture> dst(pictureFactory(width, height, &recording
Flags)); |
| 89 SkCanvas* canvas = dst->beginRecording(width, height, recordingFlags
); | 89 SkCanvas* canvas = dst->beginRecording(width, height, recordingFlags
); |
| 90 if (NULL != src) { | 90 if (NULL != src) { |
| 91 src->draw(canvas); | 91 src->draw(canvas); |
| 92 } | 92 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 bench_record(src, filename.c_str(), pictureFactory); | 137 bench_record(src, filename.c_str(), pictureFactory); |
| 138 } | 138 } |
| 139 return failed ? 1 : 0; | 139 return failed ? 1 : 0; |
| 140 } | 140 } |
| 141 | 141 |
| 142 #if !defined SK_BUILD_FOR_IOS | 142 #if !defined SK_BUILD_FOR_IOS |
| 143 int main(int argc, char * const argv[]) { | 143 int main(int argc, char * const argv[]) { |
| 144 return tool_main(argc, (char**) argv); | 144 return tool_main(argc, (char**) argv); |
| 145 } | 145 } |
| 146 #endif | 146 #endif |
| OLD | NEW |