SkDebug_win.cpp revision 1ee76510f5dbf632d30975fc3509ef4f609156d2
1
2/*
3 * Copyright 2010 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
9
10
11#include "SkTypes.h"
12#if defined(SK_BUILD_FOR_WIN32)
13
14static const size_t kBufferSize = 2048;
15
16#include <stdarg.h>
17#include <stdio.h>
18#include <windows.h>
19
20void SkDebugf(const char format[], ...) {
21    char    buffer[kBufferSize + 1];
22    va_list args;
23
24    va_start(args, format);
25    vfprintf(stderr, format, args);
26    va_end(args);
27    fflush(stderr);  // stderr seems to be buffered on Windows.
28
29    va_start(args, format);
30    vsnprintf(buffer, kBufferSize, format, args);
31    va_end(args);
32
33    OutputDebugStringA(buffer);
34}
35#endif//defined(SK_BUILD_FOR_WIN32)
36