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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 if (nullptr == codec) { | 548 if (nullptr == codec) { |
549 SkDebugf("Could not create codec for %s. Skipping bench.\n", path.c
_str()); | 549 SkDebugf("Could not create codec for %s. Skipping bench.\n", path.c
_str()); |
550 return false; | 550 return false; |
551 } | 551 } |
552 | 552 |
553 // These will be initialized by SkCodec if the color type is kIndex8 and | 553 // These will be initialized by SkCodec if the color type is kIndex8 and |
554 // unused otherwise. | 554 // unused otherwise. |
555 SkPMColor colors[256]; | 555 SkPMColor colors[256]; |
556 int colorCount; | 556 int colorCount; |
557 const SkImageInfo info = codec->getInfo().makeColorType(colorType); | 557 const SkImageInfo info = codec->getInfo().makeColorType(colorType); |
558 SkAutoTDeleteArray<uint8_t> row(new uint8_t[info.minRowBytes()]); | |
559 if (codec->startScanlineDecode(info, nullptr, colors, &colorCount) != Sk
Codec::kSuccess) | 558 if (codec->startScanlineDecode(info, nullptr, colors, &colorCount) != Sk
Codec::kSuccess) |
560 { | 559 { |
561 SkDebugf("Could not create scanline decoder for %s with color type %
s. " | 560 SkDebugf("Could not create scanline decoder for %s with color type %
s. " |
562 "Skipping bench.\n", path.c_str(), color_type_to_str(colorTy
pe)); | 561 "Skipping bench.\n", path.c_str(), color_type_to_str(colorTy
pe)); |
563 return false; | 562 return false; |
564 } | 563 } |
565 *width = info.width(); | 564 *width = info.width(); |
566 *height = info.height(); | 565 *height = info.height(); |
567 } else { | 566 } else { |
568 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream)); | 567 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream)); |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 | 1338 |
1340 return 0; | 1339 return 0; |
1341 } | 1340 } |
1342 | 1341 |
1343 #if !defined SK_BUILD_FOR_IOS | 1342 #if !defined SK_BUILD_FOR_IOS |
1344 int main(int argc, char** argv) { | 1343 int main(int argc, char** argv) { |
1345 SkCommandLineFlags::Parse(argc, argv); | 1344 SkCommandLineFlags::Parse(argc, argv); |
1346 return nanobench_main(); | 1345 return nanobench_main(); |
1347 } | 1346 } |
1348 #endif | 1347 #endif |
OLD | NEW |