OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkForceLinking.h" | |
10 #include "SkGraphics.h" | 9 #include "SkGraphics.h" |
11 #include "SkImageDecoder.h" | 10 #include "SkImageDecoder.h" |
12 | 11 |
13 __SK_FORCE_IMAGE_DECODER_LINKING; | |
14 | |
15 /** | 12 /** |
16 Simple program to test Skia's ability to decode images without | 13 Simple program to test Skia's ability to decode images without |
17 errors or debug messages. */ | 14 errors or debug messages. */ |
18 int tool_main(int argc, char** argv); | 15 int tool_main(int argc, char** argv); |
19 int tool_main(int argc, char** argv) { | 16 int tool_main(int argc, char** argv) { |
20 if (argc < 2) { | 17 if (argc < 2) { |
21 SkDebugf("Usage:\n %s imagefile\n\n", argv[0]); | 18 SkDebugf("Usage:\n %s imagefile\n\n", argv[0]); |
22 return 3; | 19 return 3; |
23 } | 20 } |
24 SkAutoGraphics ag; // Enable use of SkRTConfig | 21 SkAutoGraphics ag; // Enable use of SkRTConfig |
25 SkBitmap bitmap; | 22 SkBitmap bitmap; |
26 if (!(SkImageDecoder::DecodeFile(argv[1], &bitmap))) { | 23 if (!(SkImageDecoder::DecodeFile(argv[1], &bitmap))) { |
27 return 2; | 24 return 2; |
28 } | 25 } |
29 if (bitmap.empty()) { | 26 if (bitmap.empty()) { |
30 return 1; | 27 return 1; |
31 } | 28 } |
32 return 0; | 29 return 0; |
33 } | 30 } |
34 | 31 |
35 #if !defined SK_BUILD_FOR_IOS | 32 #if !defined SK_BUILD_FOR_IOS |
36 int main(int argc, char * const argv[]) { | 33 int main(int argc, char * const argv[]) { |
37 return tool_main(argc, (char**) argv); | 34 return tool_main(argc, (char**) argv); |
38 } | 35 } |
39 #endif | 36 #endif |
OLD | NEW |