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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 } | 188 } |
189 | 189 |
190 SkPicture::InstallPixelRefProc proc; | 190 SkPicture::InstallPixelRefProc proc; |
191 if (FLAGS_deferImageDecoding) { | 191 if (FLAGS_deferImageDecoding) { |
192 proc = &sk_tools::LazyDecodeBitmap; | 192 proc = &sk_tools::LazyDecodeBitmap; |
193 } else { | 193 } else { |
194 proc = &SkImageDecoder::DecodeMemory; | 194 proc = &SkImageDecoder::DecodeMemory; |
195 } | 195 } |
196 SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream, pr
oc)); | 196 SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream, pr
oc)); |
197 | 197 |
198 if (NULL == picture.get()) { | 198 if (nullptr == picture.get()) { |
199 SkString err; | 199 SkString err; |
200 err.printf("Could not read an SkPicture from %s\n", inputPath.c_str()); | 200 err.printf("Could not read an SkPicture from %s\n", inputPath.c_str()); |
201 gLogger.logError(err); | 201 gLogger.logError(err); |
202 return false; | 202 return false; |
203 } | 203 } |
204 | 204 |
205 SkString filename = SkOSPath::Basename(inputPath.c_str()); | 205 SkString filename = SkOSPath::Basename(inputPath.c_str()); |
206 | 206 |
207 gWriter.bench(filename.c_str(), | 207 gWriter.bench(filename.c_str(), |
208 SkScalarCeilToInt(picture->cullRect().width()), | 208 SkScalarCeilToInt(picture->cullRect().width()), |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 } | 330 } |
331 | 331 |
332 SkString errorString; | 332 SkString errorString; |
333 SkAutoTUnref<sk_tools::PictureRenderer> renderer(parseRenderer(errorString, | 333 SkAutoTUnref<sk_tools::PictureRenderer> renderer(parseRenderer(errorString, |
334 kBench_Pictur
eTool)); | 334 kBench_Pictur
eTool)); |
335 | 335 |
336 if (errorString.size() > 0) { | 336 if (errorString.size() > 0) { |
337 gLogger.logError(errorString); | 337 gLogger.logError(errorString); |
338 } | 338 } |
339 | 339 |
340 if (NULL == renderer.get()) { | 340 if (nullptr == renderer.get()) { |
341 exit(-1); | 341 exit(-1); |
342 } | 342 } |
343 | 343 |
344 if (FLAGS_timeIndividualTiles) { | 344 if (FLAGS_timeIndividualTiles) { |
345 sk_tools::TiledPictureRenderer* tiledRenderer = renderer->getTiledRender
er(); | 345 sk_tools::TiledPictureRenderer* tiledRenderer = renderer->getTiledRender
er(); |
346 if (NULL == tiledRenderer) { | 346 if (nullptr == tiledRenderer) { |
347 gLogger.logError("--timeIndividualTiles requires tiled rendering.\n"
); | 347 gLogger.logError("--timeIndividualTiles requires tiled rendering.\n"
); |
348 exit(-1); | 348 exit(-1); |
349 } | 349 } |
350 if (!tiledRenderer->supportsTimingIndividualTiles()) { | 350 if (!tiledRenderer->supportsTimingIndividualTiles()) { |
351 gLogger.logError("This renderer does not support --timeIndividualTil
es.\n"); | 351 gLogger.logError("This renderer does not support --timeIndividualTil
es.\n"); |
352 exit(-1); | 352 exit(-1); |
353 } | 353 } |
354 benchmark->setTimeIndividualTiles(true); | 354 benchmark->setTimeIndividualTiles(true); |
355 } | 355 } |
356 | 356 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 | 472 |
473 gWriter.end(); | 473 gWriter.end(); |
474 return 0; | 474 return 0; |
475 } | 475 } |
476 | 476 |
477 #if !defined SK_BUILD_FOR_IOS | 477 #if !defined SK_BUILD_FOR_IOS |
478 int main(int argc, char * const argv[]) { | 478 int main(int argc, char * const argv[]) { |
479 return tool_main(argc, (char**) argv); | 479 return tool_main(argc, (char**) argv); |
480 } | 480 } |
481 #endif | 481 #endif |
OLD | NEW |