Use SkSafeMath for text blob storage calculations
Change-Id: I028895dee81d99b1fa2a9acfa3db3f4bcb0f8f64
Reviewed-on: https://skia-review.googlesource.com/73823
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
diff --git a/src/core/SkSafeMath.h b/src/core/SkSafeMath.h
index f781c2c..1005d06 100644
--- a/src/core/SkSafeMath.h
+++ b/src/core/SkSafeMath.h
@@ -43,6 +43,11 @@
return a + b;
}
+ size_t alignUp(size_t x, size_t alignment) {
+ SkASSERT(alignment && !(alignment & (alignment - 1)));
+ return add(x, alignment - 1) & ~(alignment - 1);
+ }
+
private:
uint32_t mul32(uint32_t x, uint32_t y) {
uint64_t bx = x;