OLD | NEW |
1 | |
2 /* | 1 /* |
3 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
4 * | 3 * |
5 * 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 |
6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
7 */ | 6 */ |
8 | 7 |
9 | |
10 #include "SkTypes.h" | 8 #include "SkTypes.h" |
11 #include <stdio.h> | 9 #include <stdio.h> |
12 | 10 |
13 #define LOG_TAG "skia" | 11 #define LOG_TAG "skia" |
14 #include <android/log.h> | 12 #include <android/log.h> |
15 | 13 |
16 static bool gSkDebugToStdOut = false; | 14 // Print debug output to stdout as well. This is useful for command line |
17 | 15 // applications (e.g. skia_launcher). To enable, include android_output as a |
18 extern "C" void AndroidSkDebugToStdOut(bool debugToStdOut) { | 16 // gyp dependency. |
19 gSkDebugToStdOut = debugToStdOut; | 17 bool gSkDebugToStdOut = false; |
20 } | |
21 | 18 |
22 void SkDebugf(const char format[], ...) { | 19 void SkDebugf(const char format[], ...) { |
23 va_list args1, args2; | 20 va_list args1, args2; |
24 va_start(args1, format); | 21 va_start(args1, format); |
25 va_copy(args2, args1); | 22 |
| 23 if (gSkDebugToStdOut) { |
| 24 va_copy(args2, args1); |
| 25 vprintf(format, args2); |
| 26 va_end(args2); |
| 27 } |
| 28 |
26 __android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, format, args1); | 29 __android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, format, args1); |
27 | 30 |
28 // Print debug output to stdout as well. This is useful for command | |
29 // line applications (e.g. skia_launcher) | |
30 if (gSkDebugToStdOut) { | |
31 vprintf(format, args2); | |
32 } | |
33 | |
34 va_end(args1); | 31 va_end(args1); |
35 va_end(args2); | |
36 } | 32 } |
OLD | NEW |