aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/MallocPixelRefTest.cpp
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-03-31 16:45:04 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-31 16:45:09 +0000
commit1d1165ca6575e082b892c5460492c411618783ad (patch)
treed0c8be9303b4033e2eac559a104a9c1129430dbd /tests/MallocPixelRefTest.cpp
parent43e5fd3e2095aa47630ff3a8b6da4139968d0492 (diff)
Revert "clean up (partially) colortable api"
This reverts commit 2e491a6a113c5e16a3b7bede5fa6f588deeb928d. Reason for revert: Windows unit tests failing? Original change's description: > clean up (partially) colortable api > > Needs this to land: https://codereview.chromium.org/2789853002/ > > Bug: skia: > Change-Id: I38d916a546b7fa64d000d973e695ddda24a589e7 > Reviewed-on: https://skia-review.googlesource.com/10600 > Commit-Queue: Mike Reed <reed@google.com> > Reviewed-by: Matt Sarett <msarett@google.com> > TBR=msarett@google.com,scroggo@google.com,reed@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I626e7edfcea82576a440dcaa851a04cedee6233f Reviewed-on: https://skia-review.googlesource.com/10966 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'tests/MallocPixelRefTest.cpp')
-rw-r--r--tests/MallocPixelRefTest.cpp51
1 files changed, 26 insertions, 25 deletions
diff --git a/tests/MallocPixelRefTest.cpp b/tests/MallocPixelRefTest.cpp
index 096e3e69ee..b89d121579 100644
--- a/tests/MallocPixelRefTest.cpp
+++ b/tests/MallocPixelRefTest.cpp
@@ -25,8 +25,8 @@ DEF_TEST(MallocPixelRef, reporter) {
REPORTER_ASSERT(reporter, true);
SkImageInfo info = SkImageInfo::MakeN32Premul(10, 13);
{
- sk_sp<SkPixelRef> pr(
- SkMallocPixelRef::MakeAllocate(info, info.minRowBytes() - 1, nullptr));
+ sk_sp<SkMallocPixelRef> pr(
+ SkMallocPixelRef::NewAllocate(info, info.minRowBytes() - 1, nullptr));
// rowbytes too small.
REPORTER_ASSERT(reporter, nullptr == pr.get());
}
@@ -34,8 +34,8 @@ DEF_TEST(MallocPixelRef, reporter) {
size_t rowBytes = info.minRowBytes() - 1;
size_t size = info.getSafeSize(rowBytes);
sk_sp<SkData> data(SkData::MakeUninitialized(size));
- sk_sp<SkPixelRef> pr(
- SkMallocPixelRef::MakeWithData(info, rowBytes, nullptr, data));
+ sk_sp<SkMallocPixelRef> pr(
+ SkMallocPixelRef::NewWithData(info, rowBytes, nullptr, data.get()));
// rowbytes too small.
REPORTER_ASSERT(reporter, nullptr == pr.get());
}
@@ -43,8 +43,8 @@ DEF_TEST(MallocPixelRef, reporter) {
size_t rowBytes = info.minRowBytes() + 2;
size_t size = info.getSafeSize(rowBytes) - 1;
sk_sp<SkData> data(SkData::MakeUninitialized(size));
- sk_sp<SkPixelRef> pr(
- SkMallocPixelRef::MakeWithData(info, rowBytes, nullptr, data));
+ sk_sp<SkMallocPixelRef> pr(
+ SkMallocPixelRef::NewWithData(info, rowBytes, nullptr, data.get()));
// data too small.
REPORTER_ASSERT(reporter, nullptr == pr.get());
}
@@ -52,32 +52,32 @@ DEF_TEST(MallocPixelRef, reporter) {
size_t size = info.getSafeSize(rowBytes) + 9;
{
SkAutoMalloc memory(size);
- sk_sp<SkPixelRef> pr(
- SkMallocPixelRef::MakeDirect(info, memory.get(), rowBytes, nullptr));
+ sk_sp<SkMallocPixelRef> pr(
+ SkMallocPixelRef::NewDirect(info, memory.get(), rowBytes, nullptr));
REPORTER_ASSERT(reporter, pr.get() != nullptr);
REPORTER_ASSERT(reporter, memory.get() == pr->pixels());
}
{
- sk_sp<SkPixelRef> pr(
- SkMallocPixelRef::MakeAllocate(info, rowBytes, nullptr));
+ sk_sp<SkMallocPixelRef> pr(
+ SkMallocPixelRef::NewAllocate(info, rowBytes, nullptr));
REPORTER_ASSERT(reporter, pr.get() != nullptr);
REPORTER_ASSERT(reporter, pr->pixels());
}
{
void* addr = static_cast<void*>(new uint8_t[size]);
- sk_sp<SkPixelRef> pr(
- SkMallocPixelRef::MakeWithProc(info, rowBytes, nullptr, addr,
- delete_uint8_proc, nullptr));
+ sk_sp<SkMallocPixelRef> pr(
+ SkMallocPixelRef::NewWithProc(info, rowBytes, nullptr, addr,
+ delete_uint8_proc, nullptr));
REPORTER_ASSERT(reporter, pr.get() != nullptr);
REPORTER_ASSERT(reporter, addr == pr->pixels());
}
{
int x = 0;
SkAutoMalloc memory(size);
- sk_sp<SkPixelRef> pr(
- SkMallocPixelRef::MakeWithProc(info, rowBytes, nullptr,
- memory.get(), set_to_one_proc,
- static_cast<void*>(&x)));
+ sk_sp<SkMallocPixelRef> pr(
+ SkMallocPixelRef::NewWithProc(info, rowBytes, nullptr,
+ memory.get(), set_to_one_proc,
+ static_cast<void*>(&x)));
REPORTER_ASSERT(reporter, pr.get() != nullptr);
REPORTER_ASSERT(reporter, memory.get() == pr->pixels());
REPORTER_ASSERT(reporter, 0 == x);
@@ -88,10 +88,10 @@ DEF_TEST(MallocPixelRef, reporter) {
{
int x = 0;
SkAutoMalloc memory(size);
- sk_sp<SkPixelRef> pr(
- SkMallocPixelRef::MakeWithProc(SkImageInfo::MakeN32Premul(-1, -1), rowBytes, nullptr,
- memory.get(), set_to_one_proc,
- static_cast<void*>(&x)));
+ sk_sp<SkMallocPixelRef> pr(
+ SkMallocPixelRef::NewWithProc(SkImageInfo::MakeN32Premul(-1, -1), rowBytes, nullptr,
+ memory.get(), set_to_one_proc,
+ static_cast<void*>(&x)));
REPORTER_ASSERT(reporter, pr.get() == nullptr);
// make sure that set_to_one_proc was called.
REPORTER_ASSERT(reporter, 1 == x);
@@ -99,16 +99,17 @@ DEF_TEST(MallocPixelRef, reporter) {
{
void* addr = static_cast<void*>(new uint8_t[size]);
REPORTER_ASSERT(reporter, addr != nullptr);
- sk_sp<SkPixelRef> pr(
- SkMallocPixelRef::MakeWithProc(info, rowBytes, nullptr, addr,
- delete_uint8_proc, nullptr));
+ sk_sp<SkMallocPixelRef> pr(
+ SkMallocPixelRef::NewWithProc(info, rowBytes, nullptr, addr,
+ delete_uint8_proc, nullptr));
REPORTER_ASSERT(reporter, addr == pr->pixels());
}
{
sk_sp<SkData> data(SkData::MakeUninitialized(size));
SkData* dataPtr = data.get();
REPORTER_ASSERT(reporter, dataPtr->unique());
- sk_sp<SkPixelRef> pr = SkMallocPixelRef::MakeWithData(info, rowBytes, nullptr, data);
+ sk_sp<SkMallocPixelRef> pr(
+ SkMallocPixelRef::NewWithData(info, rowBytes, nullptr, data.get()));
REPORTER_ASSERT(reporter, !(dataPtr->unique()));
data.reset(nullptr);
REPORTER_ASSERT(reporter, dataPtr->unique());