aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ports/SkDebug_android.cpp
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@google.com>2014-12-10 10:23:04 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-10 10:23:06 -0800
commit6cfce1b7b4ad546b02823a1a0bbbda2c17b688f5 (patch)
treec2c2f6bcc68e1f5c879089fa9f5f8a44a40437e8 /src/ports/SkDebug_android.cpp
parent96472deea70169396b8e1f576e470138f55fdb1f (diff)
Change how SkDebugf is sent to stdout on Android.
Previously, a function was called using dlsym in skia_launcher. Add a static initializer that changes the setting, and include that for the tools we automate for testing. Also only do va_copy if we actually use it. BUG=skia:2454 Review URL: https://codereview.chromium.org/753543003
Diffstat (limited to 'src/ports/SkDebug_android.cpp')
-rw-r--r--src/ports/SkDebug_android.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/ports/SkDebug_android.cpp b/src/ports/SkDebug_android.cpp
index 2795c0444a..4ab9ad24d3 100644
--- a/src/ports/SkDebug_android.cpp
+++ b/src/ports/SkDebug_android.cpp
@@ -1,4 +1,3 @@
-
/*
* Copyright 2006 The Android Open Source Project
*
@@ -6,31 +5,28 @@
* found in the LICENSE file.
*/
-
#include "SkTypes.h"
#include <stdio.h>
#define LOG_TAG "skia"
#include <android/log.h>
-static bool gSkDebugToStdOut = false;
-
-extern "C" void AndroidSkDebugToStdOut(bool debugToStdOut) {
- gSkDebugToStdOut = debugToStdOut;
-}
+// Print debug output to stdout as well. This is useful for command line
+// applications (e.g. skia_launcher). To enable, include android_output as a
+// gyp dependency.
+bool gSkDebugToStdOut = false;
void SkDebugf(const char format[], ...) {
va_list args1, args2;
va_start(args1, format);
- va_copy(args2, args1);
- __android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, format, args1);
- // Print debug output to stdout as well. This is useful for command
- // line applications (e.g. skia_launcher)
if (gSkDebugToStdOut) {
+ va_copy(args2, args1);
vprintf(format, args2);
+ va_end(args2);
}
+ __android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, format, args1);
+
va_end(args1);
- va_end(args2);
}