| 1 | |
| 2 | /* |
| 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. |
| 7 | */ |
| 8 | |
| 9 | #ifndef GrConfig_DEFINED |
| 10 | #define GrConfig_DEFINED |
| 11 | |
| 12 | #include "include/core/SkTypes.h" |
| 13 | |
| 14 | /** |
| 15 | * Gr defines are set to 0 or 1, rather than being undefined or defined |
| 16 | */ |
| 17 | |
| 18 | #if !defined(GR_CACHE_STATS) |
| 19 | #if defined(SK_DEBUG) || defined(SK_DUMP_STATS) |
| 20 | #define GR_CACHE_STATS 1 |
| 21 | #else |
| 22 | #define GR_CACHE_STATS 0 |
| 23 | #endif |
| 24 | #endif |
| 25 | |
| 26 | #if !defined(GR_GPU_STATS) |
| 27 | #if defined(SK_DEBUG) || defined(SK_DUMP_STATS) || defined(GR_TEST_UTILS) |
| 28 | #define GR_GPU_STATS 1 |
| 29 | #else |
| 30 | #define GR_GPU_STATS 0 |
| 31 | #endif |
| 32 | #endif |
| 33 | |
| 34 | #endif |
| 35 | |
| 36 | /** |
| 37 | * GR_STRING makes a string of X where X is expanded before conversion to a string |
| 38 | * if X itself contains macros. |
| 39 | */ |
| 40 | #define GR_STRING(X) GR_STRING_IMPL(X) |
| 41 | #define GR_STRING_IMPL(X) #X |
| 42 | |
| 43 | /** |
| 44 | * GR_CONCAT concatenates X and Y where each is expanded before |
| 45 | * contanenation if either contains macros. |
| 46 | */ |
| 47 | #define GR_CONCAT(X,Y) GR_CONCAT_IMPL(X,Y) |
| 48 | #define GR_CONCAT_IMPL(X,Y) X##Y |
| 49 | |
| 50 | /** |
| 51 | * Creates a string of the form "<filename>(<linenumber>) : " |
| 52 | */ |
| 53 | #define GR_FILE_AND_LINE_STR __FILE__ "(" GR_STRING(__LINE__) ") : " |
| 54 | |