OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #ifndef SkHRESULT_DEFINED | 8 #ifndef SkHRESULT_DEFINED |
9 #define SkHRESULT_DEFINED | 9 #define SkHRESULT_DEFINED |
10 | 10 |
11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
12 #ifdef SK_BUILD_FOR_WIN | 12 #ifdef SK_BUILD_FOR_WIN |
13 | 13 |
14 void SkTraceHR(const char* file, unsigned long line, | 14 void SkTraceHR(const char* file, unsigned long line, |
15 HRESULT hr, const char* msg); | 15 HRESULT hr, const char* msg); |
16 | 16 |
17 #ifdef SK_DEBUG | 17 #ifdef SK_DEBUG |
18 #define SK_TRACEHR(_hr, _msg) SkTraceHR(__FILE__, __LINE__, _hr, _msg) | 18 #define SK_TRACEHR(_hr, _msg) SkTraceHR(__FILE__, __LINE__, _hr, _msg) |
19 #else | 19 #else |
20 #define SK_TRACEHR(_hr, _msg) _hr | 20 #define SK_TRACEHR(_hr, _msg) sk_ignore_unused_variable(_hr) |
21 #endif | 21 #endif |
22 | 22 |
23 #define HR_GENERAL(_ex, _msg, _ret) {\ | 23 #define HR_GENERAL(_ex, _msg, _ret) {\ |
24 HRESULT _hr = _ex;\ | 24 HRESULT _hr = _ex;\ |
25 if (FAILED(_hr)) {\ | 25 if (FAILED(_hr)) {\ |
26 SK_TRACEHR(_hr, _msg);\ | 26 SK_TRACEHR(_hr, _msg);\ |
27 return _ret;\ | 27 return _ret;\ |
28 }\ | 28 }\ |
29 } | 29 } |
30 | 30 |
(...skipping 20 matching lines...) Expand all Loading... |
51 #define HRNM(ex, msg) HR_GENERAL(ex, msg, NULL) | 51 #define HRNM(ex, msg) HR_GENERAL(ex, msg, NULL) |
52 | 52 |
53 #define HRV(ex) HR_GENERAL(ex, NULL, ) | 53 #define HRV(ex) HR_GENERAL(ex, NULL, ) |
54 #define HRVM(ex, msg) HR_GENERAL(ex, msg, ) | 54 #define HRVM(ex, msg) HR_GENERAL(ex, msg, ) |
55 | 55 |
56 #define HRZ(ex) HR_GENERAL(ex, NULL, 0) | 56 #define HRZ(ex) HR_GENERAL(ex, NULL, 0) |
57 #define HRZM(ex, msg) HR_GENERAL(ex, msg, 0) | 57 #define HRZM(ex, msg) HR_GENERAL(ex, msg, 0) |
58 //@} | 58 //@} |
59 #endif // SK_BUILD_FOR_WIN | 59 #endif // SK_BUILD_FOR_WIN |
60 #endif // SkHRESULT_DEFINED | 60 #endif // SkHRESULT_DEFINED |
OLD | NEW |