diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkWriter32.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/core/SkWriter32.h b/src/core/SkWriter32.h index 1e004a8b1d..2143c6b129 100644 --- a/src/core/SkWriter32.h +++ b/src/core/SkWriter32.h @@ -47,8 +47,10 @@ public: size_t size() const { return this->bytesWritten(); } void reset(void* external = nullptr, size_t externalBytes = 0) { + // we cast this pointer to int* and float* at times, so assert that it is aligned. SkASSERT(SkIsAlign4((uintptr_t)external)); - SkASSERT(SkIsAlign4(externalBytes)); + // we always write multiples of 4-bytes, so truncate down the size to match that + externalBytes &= ~3; fData = (uint8_t*)external; fCapacity = externalBytes; |