aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ports/SkDebug_win.cpp
blob: 6e0576652f54754a2430b6349850a49317d1ac68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

/*
 * Copyright 2010 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */



#include "SkTypes.h"
#if defined(SK_BUILD_FOR_WIN32)

static const size_t kBufferSize = 2048;

#include <stdarg.h>
#include <stdio.h>
#include <windows.h>

void SkDebugf(const char format[], ...) {
    char    buffer[kBufferSize + 1];
    va_list args;

    va_start(args, format);
    vfprintf(stderr, format, args);
    va_end(args);
    fflush(stderr);  // stderr seems to be buffered on Windows.

    va_start(args, format);
    vsnprintf(buffer, kBufferSize, format, args);
    va_end(args);

    OutputDebugStringA(buffer);
}
#endif//defined(SK_BUILD_FOR_WIN32)