epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2006 The Android Open Source Project |
| 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 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 8 | #include "SkTypes.h" |
mtklein | 1ee7651 | 2015-11-02 10:20:27 -0800 | [diff] [blame] | 9 | #if defined(SK_BUILD_FOR_ANDROID) |
| 10 | |
bungeman@google.com | 72e8324 | 2013-10-11 19:47:36 +0000 | [diff] [blame] | 11 | #include <stdio.h> |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 12 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 13 | #define LOG_TAG "skia" |
djsollen@google.com | 318cf92 | 2011-11-08 19:03:43 +0000 | [diff] [blame] | 14 | #include <android/log.h> |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 15 | |
scroggo | 6cfce1b | 2014-12-10 10:23:04 -0800 | [diff] [blame] | 16 | // Print debug output to stdout as well. This is useful for command line |
| 17 | // applications (e.g. skia_launcher). To enable, include android_output as a |
| 18 | // gyp dependency. |
| 19 | bool gSkDebugToStdOut = false; |
djsollen@google.com | 64d294d | 2012-10-23 17:37:30 +0000 | [diff] [blame] | 20 | |
djsollen@google.com | 318cf92 | 2011-11-08 19:03:43 +0000 | [diff] [blame] | 21 | void SkDebugf(const char format[], ...) { |
qiankun.miao | cd27a41 | 2014-07-15 19:51:41 -0700 | [diff] [blame] | 22 | va_list args1, args2; |
| 23 | va_start(args1, format); |
djsollen@google.com | 64d294d | 2012-10-23 17:37:30 +0000 | [diff] [blame] | 24 | |
djsollen@google.com | 64d294d | 2012-10-23 17:37:30 +0000 | [diff] [blame] | 25 | if (gSkDebugToStdOut) { |
scroggo | 6cfce1b | 2014-12-10 10:23:04 -0800 | [diff] [blame] | 26 | va_copy(args2, args1); |
qiankun.miao | cd27a41 | 2014-07-15 19:51:41 -0700 | [diff] [blame] | 27 | vprintf(format, args2); |
scroggo | 6cfce1b | 2014-12-10 10:23:04 -0800 | [diff] [blame] | 28 | va_end(args2); |
djsollen@google.com | 64d294d | 2012-10-23 17:37:30 +0000 | [diff] [blame] | 29 | } |
| 30 | |
scroggo | 6cfce1b | 2014-12-10 10:23:04 -0800 | [diff] [blame] | 31 | __android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, format, args1); |
| 32 | |
qiankun.miao | cd27a41 | 2014-07-15 19:51:41 -0700 | [diff] [blame] | 33 | va_end(args1); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 34 | } |
mtklein | 1ee7651 | 2015-11-02 10:20:27 -0800 | [diff] [blame] | 35 | |
| 36 | #endif//defined(SK_BUILD_FOR_ANDROID) |