blob: 106cf782f252a7549e8948b92823c48cef2f12ef [file] [log] [blame]
halcanary@google.comfed30372013-10-04 12:46:45 +00001/*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "SkBitmap.h"
9#include "SkForceLinking.h"
10#include "SkGraphics.h"
11#include "SkImageDecoder.h"
12
13__SK_FORCE_IMAGE_DECODER_LINKING;
14
15/**
16 Simple program to test Skia's ability to decode images without
17 errors or debug messages. */
halcanary@google.comd8854ad2013-10-04 13:37:24 +000018int tool_main(int argc, char** argv);
19int tool_main(int argc, char** argv) {
halcanary@google.comfed30372013-10-04 12:46:45 +000020 if (argc < 2) {
21 SkDebugf("Usage:\n %s imagefile\n\n", argv[0]);
22 return 3;
23 }
halcanary@google.com04b57f82013-10-14 20:08:48 +000024 SkAutoGraphics ag; // Enable use of SkRTConfig
halcanary@google.comfed30372013-10-04 12:46:45 +000025 SkBitmap bitmap;
26 if (!(SkImageDecoder::DecodeFile(argv[1], &bitmap))) {
27 return 2;
28 }
29 if (bitmap.empty()) {
30 return 1;
31 }
32 return 0;
33}
34
halcanary@google.comd8854ad2013-10-04 13:37:24 +000035#if !defined SK_BUILD_FOR_IOS
36int main(int argc, char * const argv[]) {
37 return tool_main(argc, (char**) argv);
38}
39#endif