aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2018-04-05 11:43:31 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-04-05 16:15:02 +0000
commitc4ec816a89c0f39f1b2dfb507f7c8cf39b4e1eae (patch)
tree21de62ca9ae476fe9e25198234576762c87f2234
parentfcd3ec5032981e34f4e85c6f5a4ca962f463ced8 (diff)
replace size-alignment assert with round-down
Don't need to assert here, we just won't write into all of the external memory if its length is not a multiple of what we need. Bug: skia: Change-Id: I277653f5dc3b3d7560ab71a10440275f55430833 Reviewed-on: https://skia-review.googlesource.com/118884 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Reed <reed@google.com>
-rw-r--r--src/core/SkWriter32.h4
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;