From 64d294dbef7c2f90f05a393f6b9b7997e0aaa9b9 Mon Sep 17 00:00:00 2001 From: "djsollen@google.com" Date: Tue, 23 Oct 2012 17:37:30 +0000 Subject: [PATCH] Enable Android executables (like skia_launcher) to redirect SkDebugf output to stdout as well as the system logs. Review URL: https://codereview.appspot.com/6733065 git-svn-id: http://skia.googlecode.com/svn/trunk@6059 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/ports/SkDebug_android.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/ports/SkDebug_android.cpp b/src/ports/SkDebug_android.cpp index 8e7d1d48a3..b9b5665a3c 100644 --- a/src/ports/SkDebug_android.cpp +++ b/src/ports/SkDebug_android.cpp @@ -14,9 +14,22 @@ static const size_t kBufferSize = 256; #define LOG_TAG "skia" #include +static bool gSkDebugToStdOut = false; + +extern "C" void AndroidSkDebugToStdOut(bool debugToStdOut) { + gSkDebugToStdOut = debugToStdOut; +} + void SkDebugf(const char format[], ...) { va_list args; va_start(args, format); __android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, format, args); + + // Print debug output to stdout as well. This is useful for command + // line applications (e.g. skia_launcher) + if (gSkDebugToStdOut) { + vprintf(format, args); + } + va_end(args); }