| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 | 10 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 } | 118 } |
| 119 static inline size_t GrSizeAlignDown(size_t x, uint32_t alignment) { | 119 static inline size_t GrSizeAlignDown(size_t x, uint32_t alignment) { |
| 120 return (x / alignment) * alignment; | 120 return (x / alignment) * alignment; |
| 121 } | 121 } |
| 122 | 122 |
| 123 /** | 123 /** |
| 124 * Count elements in an array | 124 * Count elements in an array |
| 125 */ | 125 */ |
| 126 #define GR_ARRAY_COUNT(array) SK_ARRAY_COUNT(array) | 126 #define GR_ARRAY_COUNT(array) SK_ARRAY_COUNT(array) |
| 127 | 127 |
| 128 //!< allocate a block of memory, will never return NULL | |
| 129 extern void* GrMalloc(size_t bytes); | |
| 130 | |
| 131 //!< free block allocated by GrMalloc. ptr may be NULL | |
| 132 extern void GrFree(void* ptr); | |
| 133 | |
| 134 static inline void Gr_bzero(void* dst, size_t size) { | |
| 135 memset(dst, 0, size); | |
| 136 } | |
| 137 | |
| 138 /////////////////////////////////////////////////////////////////////////////// | 128 /////////////////////////////////////////////////////////////////////////////// |
| 139 | 129 |
| 140 /** | 130 /** |
| 141 * Return true if n is a power of 2 | 131 * Return true if n is a power of 2 |
| 142 */ | 132 */ |
| 143 static inline bool GrIsPow2(unsigned n) { | 133 static inline bool GrIsPow2(unsigned n) { |
| 144 return n && 0 == (n & (n - 1)); | 134 return n && 0 == (n & (n - 1)); |
| 145 } | 135 } |
| 146 | 136 |
| 147 /** | 137 /** |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 }; | 612 }; |
| 623 | 613 |
| 624 /** | 614 /** |
| 625 * This value translates to reseting all the context state for any backend. | 615 * This value translates to reseting all the context state for any backend. |
| 626 */ | 616 */ |
| 627 static const uint32_t kAll_GrBackendState = 0xffffffff; | 617 static const uint32_t kAll_GrBackendState = 0xffffffff; |
| 628 | 618 |
| 629 /////////////////////////////////////////////////////////////////////////////// | 619 /////////////////////////////////////////////////////////////////////////////// |
| 630 | 620 |
| 631 #endif | 621 #endif |
| OLD | NEW |