SkDebug_win.cpp 739 B

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