| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 GrTypes_DEFINED | 8 #ifndef GrTypes_DEFINED |
| 9 #define GrTypes_DEFINED | 9 #define GrTypes_DEFINED |
| 10 | 10 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 static inline uint32_t GrUIAlignDown(uint32_t x, uint32_t alignment) { | 101 static inline uint32_t GrUIAlignDown(uint32_t x, uint32_t alignment) { |
| 102 return (x / alignment) * alignment; | 102 return (x / alignment) * alignment; |
| 103 } | 103 } |
| 104 static inline size_t GrSizeAlignDown(size_t x, uint32_t alignment) { | 104 static inline size_t GrSizeAlignDown(size_t x, uint32_t alignment) { |
| 105 return (x / alignment) * alignment; | 105 return (x / alignment) * alignment; |
| 106 } | 106 } |
| 107 | 107 |
| 108 /////////////////////////////////////////////////////////////////////////////// | 108 /////////////////////////////////////////////////////////////////////////////// |
| 109 | 109 |
| 110 /** | 110 /** |
| 111 * Return the next power of 2 >= n. | |
| 112 */ | |
| 113 static inline uint32_t GrNextPow2(uint32_t n) { | |
| 114 return n ? (1 << (32 - SkCLZ(n - 1))) : 1; | |
| 115 } | |
| 116 | |
| 117 static inline int GrNextPow2(int n) { | |
| 118 SkASSERT(n >= 0); // this impl only works for non-neg. | |
| 119 return n ? (1 << (32 - SkCLZ(n - 1))) : 1; | |
| 120 } | |
| 121 | |
| 122 /////////////////////////////////////////////////////////////////////////////// | |
| 123 | |
| 124 /** | |
| 125 * Possible 3D APIs that may be used by Ganesh. | 111 * Possible 3D APIs that may be used by Ganesh. |
| 126 */ | 112 */ |
| 127 enum GrBackend { | 113 enum GrBackend { |
| 128 kOpenGL_GrBackend, | 114 kOpenGL_GrBackend, |
| 129 kVulkan_GrBackend, | 115 kVulkan_GrBackend, |
| 130 | 116 |
| 131 kLast_GrBackend = kVulkan_GrBackend | 117 kLast_GrBackend = kVulkan_GrBackend |
| 132 }; | 118 }; |
| 133 const int kBackendCount = kLast_GrBackend + 1; | 119 const int kBackendCount = kLast_GrBackend + 1; |
| 134 | 120 |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 return 4 * width * height; | 624 return 4 * width * height; |
| 639 } | 625 } |
| 640 } | 626 } |
| 641 | 627 |
| 642 /** | 628 /** |
| 643 * This value translates to reseting all the context state for any backend. | 629 * This value translates to reseting all the context state for any backend. |
| 644 */ | 630 */ |
| 645 static const uint32_t kAll_GrBackendState = 0xffffffff; | 631 static const uint32_t kAll_GrBackendState = 0xffffffff; |
| 646 | 632 |
| 647 #endif | 633 #endif |
| OLD | NEW |