1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/ports/SkDebug_android.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,36 @@ 1.4 + 1.5 +/* 1.6 + * Copyright 2006 The Android Open Source Project 1.7 + * 1.8 + * Use of this source code is governed by a BSD-style license that can be 1.9 + * found in the LICENSE file. 1.10 + */ 1.11 + 1.12 + 1.13 +#include "SkTypes.h" 1.14 +#include <stdio.h> 1.15 + 1.16 +static const size_t kBufferSize = 256; 1.17 + 1.18 +#define LOG_TAG "skia" 1.19 +#include <android/log.h> 1.20 + 1.21 +static bool gSkDebugToStdOut = false; 1.22 + 1.23 +extern "C" void AndroidSkDebugToStdOut(bool debugToStdOut) { 1.24 + gSkDebugToStdOut = debugToStdOut; 1.25 +} 1.26 + 1.27 +void SkDebugf(const char format[], ...) { 1.28 + va_list args; 1.29 + va_start(args, format); 1.30 + __android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, format, args); 1.31 + 1.32 + // Print debug output to stdout as well. This is useful for command 1.33 + // line applications (e.g. skia_launcher) 1.34 + if (gSkDebugToStdOut) { 1.35 + vprintf(format, args); 1.36 + } 1.37 + 1.38 + va_end(args); 1.39 +}