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 <ctype.h> | 8 #include <ctype.h> |
9 | 9 |
10 #include "nanobench.h" | 10 #include "nanobench.h" |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 SkDebugf("Could not create codec for %s. Skipping bench.\n", path.c
_str()); | 506 SkDebugf("Could not create codec for %s. Skipping bench.\n", path.c
_str()); |
507 return false; | 507 return false; |
508 } | 508 } |
509 | 509 |
510 // These will be initialized by SkCodec if the color type is kIndex8 and | 510 // These will be initialized by SkCodec if the color type is kIndex8 and |
511 // unused otherwise. | 511 // unused otherwise. |
512 SkPMColor colors[256]; | 512 SkPMColor colors[256]; |
513 int colorCount; | 513 int colorCount; |
514 const SkImageInfo info = codec->getInfo().makeColorType(colorType); | 514 const SkImageInfo info = codec->getInfo().makeColorType(colorType); |
515 SkAutoTDeleteArray<uint8_t> row(SkNEW_ARRAY(uint8_t, info.minRowBytes())
); | 515 SkAutoTDeleteArray<uint8_t> row(SkNEW_ARRAY(uint8_t, info.minRowBytes())
); |
516 SkAutoTDelete<SkScanlineDecoder> scanlineDecoder(codec->getScanlineDecod
er(info, NULL, | 516 SkAutoTDelete<SkScanlineDecoder> scanlineDecoder(SkScanlineDecoder::NewF
romData(encoded)); |
517 colors, &colorCount)); | 517 if (NULL == scanlineDecoder || scanlineDecoder->start(info, NULL, |
518 if (NULL == scanlineDecoder) { | 518 colors, &colorCount) != SkCodec::kSuccess) |
| 519 { |
519 SkDebugf("Could not create scanline decoder for %s with color type %
s. " | 520 SkDebugf("Could not create scanline decoder for %s with color type %
s. " |
520 "Skipping bench.\n", path.c_str(), get_color_name(colorType)
); | 521 "Skipping bench.\n", path.c_str(), get_color_name(colorType)
); |
521 return false; | 522 return false; |
522 } | 523 } |
523 *width = info.width(); | 524 *width = info.width(); |
524 *height = info.height(); | 525 *height = info.height(); |
525 } else { | 526 } else { |
526 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream)); | 527 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream)); |
527 if (NULL == decoder) { | 528 if (NULL == decoder) { |
528 SkDebugf("Could not create decoder for %s. Skipping bench.\n", path
.c_str()); | 529 SkDebugf("Could not create decoder for %s. Skipping bench.\n", path
.c_str()); |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 | 1156 |
1156 return 0; | 1157 return 0; |
1157 } | 1158 } |
1158 | 1159 |
1159 #if !defined SK_BUILD_FOR_IOS | 1160 #if !defined SK_BUILD_FOR_IOS |
1160 int main(int argc, char** argv) { | 1161 int main(int argc, char** argv) { |
1161 SkCommandLineFlags::Parse(argc, argv); | 1162 SkCommandLineFlags::Parse(argc, argv); |
1162 return nanobench_main(); | 1163 return nanobench_main(); |
1163 } | 1164 } |
1164 #endif | 1165 #endif |
OLD | NEW |