diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkInstCnt.h | 4 | ||||
-rw-r--r-- | include/gpu/GrTypes.h | 12 |
2 files changed, 13 insertions, 3 deletions
diff --git a/include/core/SkInstCnt.h b/include/core/SkInstCnt.h index f3519a14dd..e5c44db11c 100644 --- a/include/core/SkInstCnt.h +++ b/include/core/SkInstCnt.h @@ -53,6 +53,10 @@ static SkTArray<PFCheckInstCnt> gChildren; \ } fInstanceCountHelper; \ \ + static int32_t GetInstanceCount() { \ + return SkInstanceCountHelper::gInstanceCount; \ + } \ + \ static void CheckInstanceCount() { \ if (0 != SkInstanceCountHelper::gInstanceCount) { \ SkDebugf("Leaked %s objects: %d\n", #className, \ diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h index a5d85498fc..95527c1756 100644 --- a/include/gpu/GrTypes.h +++ b/include/gpu/GrTypes.h @@ -79,27 +79,33 @@ static inline int32_t GrIDivRoundUp(int x, int y) { static inline uint32_t GrUIDivRoundUp(uint32_t x, uint32_t y) { return (x + (y-1)) / y; } -static inline size_t GrSizeDivRoundUp(size_t x, uint32_t y) { +static inline size_t GrSizeDivRoundUp(size_t x, size_t y) { return (x + (y-1)) / y; } +// compile time, evaluates Y multiple times +#define GR_CT_DIV_ROUND_UP(X, Y) (((X) + ((Y)-1)) / (Y)) + /** * align up */ static inline uint32_t GrUIAlignUp(uint32_t x, uint32_t alignment) { return GrUIDivRoundUp(x, alignment) * alignment; } -static inline uint32_t GrSizeAlignUp(size_t x, uint32_t alignment) { +static inline size_t GrSizeAlignUp(size_t x, size_t alignment) { return GrSizeDivRoundUp(x, alignment) * alignment; } +// compile time, evaluates A multiple times +#define GR_CT_ALIGN_UP(X, A) (GR_CT_DIV_ROUND_UP((X),(A)) * (A)) + /** * amount of pad needed to align up */ static inline uint32_t GrUIAlignUpPad(uint32_t x, uint32_t alignment) { return (alignment - x % alignment) % alignment; } -static inline size_t GrSizeAlignUpPad(size_t x, uint32_t alignment) { +static inline size_t GrSizeAlignUpPad(size_t x, size_t alignment) { return (alignment - x % alignment) % alignment; } |