| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "SkDebuggerGUI.h" | 9 #include "SkDebuggerGUI.h" |
| 10 #include "SkForceLinking.h" |
| 11 #include "SkGraphics.h" |
| 10 #include <QApplication> | 12 #include <QApplication> |
| 11 | 13 |
| 14 __SK_FORCE_IMAGE_DECODER_LINKING; |
| 15 |
| 16 |
| 12 static void usage(const char * argv0) { | 17 static void usage(const char * argv0) { |
| 13 SkDebugf("%s <input> \n", argv0); | 18 SkDebugf("%s <input> \n", argv0); |
| 14 SkDebugf(" [--help|-h]: show this help message\n"); | 19 SkDebugf(" [--help|-h]: show this help message\n"); |
| 15 SkDebugf("\n\n"); | 20 SkDebugf("\n\n"); |
| 16 SkDebugf(" input: Either a directory or a single .skp file.\n"); | 21 SkDebugf(" input: Either a directory or a single .skp file.\n"); |
| 17 } | 22 } |
| 18 | 23 |
| 19 int main(int argc, char *argv[]) { | 24 int main(int argc, char *argv[]) { |
| 20 #ifndef SK_BUILD_FOR_WIN32 | 25 #ifndef SK_BUILD_FOR_WIN32 |
| 21 // Set numeric formatting to default. Otherwise shaders will have numbers wi
th wrong comma. | 26 // Set numeric formatting to default. Otherwise shaders will have numbers wi
th wrong comma. |
| 22 // QApplication documentation recommends setlocale("LC_NUMERIC", "C") after
QApplication | 27 // QApplication documentation recommends setlocale("LC_NUMERIC", "C") after
QApplication |
| 23 // constuction. However, the components Qt calls (X11 libs, ..) will overri
de that. | 28 // constuction. However, the components Qt calls (X11 libs, ..) will overri
de that. |
| 24 setenv("LC_NUMERIC", "C", 1); | 29 setenv("LC_NUMERIC", "C", 1); |
| 25 #endif | 30 #endif |
| 31 SkGraphics::Init(); |
| 26 QApplication a(argc, argv); | 32 QApplication a(argc, argv); |
| 27 QStringList argList = a.arguments(); | 33 QStringList argList = a.arguments(); |
| 28 | 34 |
| 29 if (argList.count() <= 0) { | 35 if (argList.count() <= 0) { |
| 30 return -1; // should at least have command name | 36 return -1; // should at least have command name |
| 31 } | 37 } |
| 32 | 38 |
| 33 SkString input; | 39 SkString input; |
| 34 | 40 |
| 35 QStringList::const_iterator iter = argList.begin(); | 41 QStringList::const_iterator iter = argList.begin(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 53 | 59 |
| 54 if (!input.isEmpty()) { | 60 if (!input.isEmpty()) { |
| 55 if (SkStrEndsWith(input.c_str(), ".skp")) { | 61 if (SkStrEndsWith(input.c_str(), ".skp")) { |
| 56 w.openFile(input.c_str()); | 62 w.openFile(input.c_str()); |
| 57 } else { | 63 } else { |
| 58 w.setupDirectoryWidget(input.c_str()); | 64 w.setupDirectoryWidget(input.c_str()); |
| 59 } | 65 } |
| 60 } | 66 } |
| 61 | 67 |
| 62 w.show(); | 68 w.show(); |
| 63 return a.exec(); | 69 int result = a.exec(); |
| 70 SkGraphics::Term(); |
| 71 return result; |
| 64 } | 72 } |
| OLD | NEW |