epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
reed@google.com | baf7a07 | 2011-05-02 19:11:37 +0000 | [diff] [blame] | 2 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 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. |
reed@google.com | baf7a07 | 2011-05-02 19:11:37 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 10 | |
reed@google.com | baf7a07 | 2011-05-02 19:11:37 +0000 | [diff] [blame] | 11 | #include "SkTypes.h" |
| 12 | |
| 13 | static const size_t kBufferSize = 2048; |
| 14 | |
| 15 | #include <stdarg.h> |
| 16 | #include <stdio.h> |
bungeman@google.com | 0d9e3da | 2013-12-03 15:23:37 +0000 | [diff] [blame] | 17 | #include <windows.h> |
reed@google.com | baf7a07 | 2011-05-02 19:11:37 +0000 | [diff] [blame] | 18 | |
| 19 | void SkDebugf(const char format[], ...) { |
| 20 | char buffer[kBufferSize + 1]; |
| 21 | va_list args; |
bsalomon@google.com | 8890af3 | 2013-03-07 18:44:34 +0000 | [diff] [blame] | 22 | |
| 23 | va_start(args, format); |
| 24 | vprintf(format, args); |
| 25 | va_end(args); |
commit-bot@chromium.org | aadb4d9 | 2013-10-09 15:09:42 +0000 | [diff] [blame] | 26 | // When we crash on Windows we often are missing a lot of prints. Since we don't really care |
| 27 | // about SkDebugf performance we flush after every print. |
| 28 | fflush(stdout); |
bsalomon@google.com | 8890af3 | 2013-03-07 18:44:34 +0000 | [diff] [blame] | 29 | |
reed@google.com | baf7a07 | 2011-05-02 19:11:37 +0000 | [diff] [blame] | 30 | va_start(args, format); |
| 31 | vsnprintf(buffer, kBufferSize, format, args); |
| 32 | va_end(args); |
| 33 | |
reed@google.com | 59d2f63 | 2011-05-02 19:36:59 +0000 | [diff] [blame] | 34 | OutputDebugStringA(buffer); |
reed@google.com | baf7a07 | 2011-05-02 19:11:37 +0000 | [diff] [blame] | 35 | } |