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 18 matching lines...) Expand all Loading... |
29 #include "SkBBoxHierarchy.h" | 29 #include "SkBBoxHierarchy.h" |
30 #include "SkCanvas.h" | 30 #include "SkCanvas.h" |
31 #include "SkCodec.h" | 31 #include "SkCodec.h" |
32 #include "SkCommonFlags.h" | 32 #include "SkCommonFlags.h" |
33 #include "SkData.h" | 33 #include "SkData.h" |
34 #include "SkForceLinking.h" | 34 #include "SkForceLinking.h" |
35 #include "SkGraphics.h" | 35 #include "SkGraphics.h" |
36 #include "SkOSFile.h" | 36 #include "SkOSFile.h" |
37 #include "SkPictureRecorder.h" | 37 #include "SkPictureRecorder.h" |
38 #include "SkPictureUtils.h" | 38 #include "SkPictureUtils.h" |
| 39 #include "SkScanlineDecoder.h" |
39 #include "SkString.h" | 40 #include "SkString.h" |
40 #include "SkSurface.h" | 41 #include "SkSurface.h" |
41 #include "SkTaskGroup.h" | 42 #include "SkTaskGroup.h" |
42 | 43 |
43 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 44 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
44 #include "nanobenchAndroid.h" | 45 #include "nanobenchAndroid.h" |
45 #endif | 46 #endif |
46 | 47 |
47 #if SK_SUPPORT_GPU | 48 #if SK_SUPPORT_GPU |
48 #include "gl/GrGLDefines.h" | 49 #include "gl/GrGLDefines.h" |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 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()); |
506 return false; | 507 return false; |
507 } | 508 } |
508 | 509 |
509 // 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 |
510 // unused otherwise. | 511 // unused otherwise. |
511 SkPMColor colors[256]; | 512 SkPMColor colors[256]; |
512 int colorCount; | 513 int colorCount; |
513 const SkImageInfo info = codec->getInfo().makeColorType(colorType); | 514 const SkImageInfo info = codec->getInfo().makeColorType(colorType); |
514 SkAutoTDeleteArray<uint8_t> row(SkNEW_ARRAY(uint8_t, info.minRowBytes())
); | 515 SkAutoTDeleteArray<uint8_t> row(SkNEW_ARRAY(uint8_t, info.minRowBytes())
); |
515 SkScanlineDecoder* scanlineDecoder = codec->getScanlineDecoder(info, NUL
L, | 516 SkAutoTDelete<SkScanlineDecoder> scanlineDecoder(codec->getScanlineDecod
er(info, NULL, |
516 colors, &colorCount); | 517 colors, &colorCount)); |
517 if (NULL == scanlineDecoder) { | 518 if (NULL == scanlineDecoder) { |
518 SkDebugf("Could not create scanline decoder for %s with color type %
s. " | 519 SkDebugf("Could not create scanline decoder for %s with color type %
s. " |
519 "Skipping bench.\n", path.c_str(), get_color_name(colorType)
); | 520 "Skipping bench.\n", path.c_str(), get_color_name(colorType)
); |
520 return false; | 521 return false; |
521 } | 522 } |
522 *width = info.width(); | 523 *width = info.width(); |
523 *height = info.height(); | 524 *height = info.height(); |
524 } else { | 525 } else { |
525 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream)); | 526 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream)); |
526 if (NULL == decoder) { | 527 if (NULL == decoder) { |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 | 1155 |
1155 return 0; | 1156 return 0; |
1156 } | 1157 } |
1157 | 1158 |
1158 #if !defined SK_BUILD_FOR_IOS | 1159 #if !defined SK_BUILD_FOR_IOS |
1159 int main(int argc, char** argv) { | 1160 int main(int argc, char** argv) { |
1160 SkCommandLineFlags::Parse(argc, argv); | 1161 SkCommandLineFlags::Parse(argc, argv); |
1161 return nanobench_main(); | 1162 return nanobench_main(); |
1162 } | 1163 } |
1163 #endif | 1164 #endif |
OLD | NEW |