| 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 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 info = info.makeAlphaType(alphaType); | 773 info = info.makeAlphaType(alphaType); |
| 774 } | 774 } |
| 775 | 775 |
| 776 const size_t rowBytes = info.minRowBytes(); | 776 const size_t rowBytes = info.minRowBytes(); |
| 777 SkAutoMalloc storage(info.getSafeSize(rowBytes)); | 777 SkAutoMalloc storage(info.getSafeSize(rowBytes)); |
| 778 | 778 |
| 779 // Used if fCurrentColorType is kIndex_8_SkColorType | 779 // Used if fCurrentColorType is kIndex_8_SkColorType |
| 780 int colorCount = 256; | 780 int colorCount = 256; |
| 781 SkPMColor colors[256]; | 781 SkPMColor colors[256]; |
| 782 | 782 |
| 783 const SkImageGenerator::Result result = codec->getPixels( | 783 const SkCodec::Result result = codec->getPixels( |
| 784 info, storage.get(), rowBytes, NULL, colors, | 784 info, storage.get(), rowBytes, NULL, colors, |
| 785 &colorCount); | 785 &colorCount); |
| 786 switch (result) { | 786 switch (result) { |
| 787 case SkImageGenerator::kSuccess: | 787 case SkCodec::kSuccess: |
| 788 case SkImageGenerator::kIncompleteInput: | 788 case SkCodec::kIncompleteInput: |
| 789 return new CodecBench(SkOSPath::Basename(path.c_str()), | 789 return new CodecBench(SkOSPath::Basename(path.c_str()), |
| 790 encoded, colorType); | 790 encoded, colorType); |
| 791 case SkImageGenerator::kInvalidConversion: | 791 case SkCodec::kInvalidConversion: |
| 792 // This is okay. Not all conversions are valid. | 792 // This is okay. Not all conversions are valid. |
| 793 break; | 793 break; |
| 794 default: | 794 default: |
| 795 // This represents some sort of failure. | 795 // This represents some sort of failure. |
| 796 SkASSERT(false); | 796 SkASSERT(false); |
| 797 break; | 797 break; |
| 798 } | 798 } |
| 799 } | 799 } |
| 800 fCurrentColorType = 0; | 800 fCurrentColorType = 0; |
| 801 } | 801 } |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 | 1154 |
| 1155 return 0; | 1155 return 0; |
| 1156 } | 1156 } |
| 1157 | 1157 |
| 1158 #if !defined SK_BUILD_FOR_IOS | 1158 #if !defined SK_BUILD_FOR_IOS |
| 1159 int main(int argc, char** argv) { | 1159 int main(int argc, char** argv) { |
| 1160 SkCommandLineFlags::Parse(argc, argv); | 1160 SkCommandLineFlags::Parse(argc, argv); |
| 1161 return nanobench_main(); | 1161 return nanobench_main(); |
| 1162 } | 1162 } |
| 1163 #endif | 1163 #endif |
| OLD | NEW |