aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkMallocPixelRef.cpp
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-09-29 13:41:58 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-29 18:20:14 +0000
commite74dafc74d8d87f10d9be7889349990d11c245f9 (patch)
treea4da76b310f4aa8c06355e275681bbf402c4c1a3 /src/core/SkMallocPixelRef.cpp
parentc739b7260a36ed4f9ea803991909a438629ca1d2 (diff)
Just add new safe size apis
Update skia (and then hide the older versions) to come later Inspired by https://skia-review.googlesource.com/c/skia/+/52665 Bug: skia: Change-Id: I15c7395557fb49c4163cb3b323b5428abd2c752d Reviewed-on: https://skia-review.googlesource.com/53520 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src/core/SkMallocPixelRef.cpp')
-rw-r--r--src/core/SkMallocPixelRef.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/core/SkMallocPixelRef.cpp b/src/core/SkMallocPixelRef.cpp
index 6928f38ee2..50ee91c676 100644
--- a/src/core/SkMallocPixelRef.cpp
+++ b/src/core/SkMallocPixelRef.cpp
@@ -35,9 +35,9 @@ sk_sp<SkPixelRef> SkMallocPixelRef::MakeDirect(const SkImageInfo& info,
}
- sk_sp<SkPixelRef> SkMallocPixelRef::MakeUsing(void*(*alloc)(size_t),
- const SkImageInfo& info,
- size_t requestedRowBytes) {
+sk_sp<SkPixelRef> SkMallocPixelRef::MakeUsing(void*(*alloc)(size_t),
+ const SkImageInfo& info,
+ size_t requestedRowBytes) {
if (!is_valid(info)) {
return nullptr;
}
@@ -65,13 +65,14 @@ sk_sp<SkPixelRef> SkMallocPixelRef::MakeDirect(const SkImageInfo& info,
size_t size = sk_64_asS32(bigSize);
SkASSERT(size >= info.getSafeSize(rowBytes));
+ SkASSERT(info.getSafeSize(rowBytes) == info.computeByteSize(rowBytes));
void* addr = alloc(size);
if (nullptr == addr) {
return nullptr;
}
- return sk_sp<SkPixelRef>(new SkMallocPixelRef(info, addr, rowBytes,
- sk_free_releaseproc, nullptr));
+ return sk_sp<SkPixelRef>(new SkMallocPixelRef(info, addr, rowBytes,
+ sk_free_releaseproc, nullptr));
}
sk_sp<SkPixelRef> SkMallocPixelRef::MakeAllocate(const SkImageInfo& info,