| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <tchar.h> | 9 #include <tchar.h> |
| 10 | 10 |
| 11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
| 12 #include "Timer.h" | 12 #include "Timer.h" |
| 13 #include "Window_win.h" | 13 #include "Window_win.h" |
| 14 #include "../Application.h" | 14 #include "../Application.h" |
| 15 | 15 |
| 16 using sk_app::Application; |
| 17 |
| 16 static char* tchar_to_utf8(const TCHAR* str) { | 18 static char* tchar_to_utf8(const TCHAR* str) { |
| 17 #ifdef _UNICODE | 19 #ifdef _UNICODE |
| 18 int size = WideCharToMultiByte(CP_UTF8, 0, str, wcslen(str), NULL, 0, NULL,
NULL); | 20 int size = WideCharToMultiByte(CP_UTF8, 0, str, wcslen(str), NULL, 0, NULL,
NULL); |
| 19 char* str8 = (char*)sk_malloc_throw(size + 1); | 21 char* str8 = (char*)sk_malloc_throw(size + 1); |
| 20 WideCharToMultiByte(CP_UTF8, 0, str, wcslen(str), str8, size, NULL, NULL); | 22 WideCharToMultiByte(CP_UTF8, 0, str, wcslen(str), str8, size, NULL, NULL); |
| 21 str8[size] = '\0'; | 23 str8[size] = '\0'; |
| 22 return str8; | 24 return str8; |
| 23 #else | 25 #else |
| 24 return _strdup(str); | 26 return _strdup(str); |
| 25 #endif | 27 #endif |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 previousTime = currentTime; | 78 previousTime = currentTime; |
| 77 currentTime = now_ms(); | 79 currentTime = now_ms(); |
| 78 app->onIdle(currentTime - previousTime); | 80 app->onIdle(currentTime - previousTime); |
| 79 } | 81 } |
| 80 } | 82 } |
| 81 | 83 |
| 82 delete app; | 84 delete app; |
| 83 | 85 |
| 84 return (int)msg.wParam; | 86 return (int)msg.wParam; |
| 85 } | 87 } |
| OLD | NEW |