aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-07-18 10:53:11 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-18 15:50:43 +0000
commit086a427b0cee3862f25c492fc5082ff24105dc53 (patch)
tree79d4311c12309e5bc34950a0131771d3cb8f6171 /tests
parent918ad9d5f19efdbd57486b8f931f7af197896010 (diff)
guard references to SkColorTable
Bug: skia:6828 Change-Id: I0c8c78e70b118f51cb59dc45675e4ddcd4776108 Reviewed-on: https://skia-review.googlesource.com/24260 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/BitmapCopyTest.cpp12
-rw-r--r--tests/BitmapTest.cpp3
-rw-r--r--tests/MallocPixelRefTest.cpp21
-rw-r--r--tests/PixelRefTest.cpp8
-rw-r--r--tests/WritePixelsTest.cpp2
5 files changed, 17 insertions, 29 deletions
diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp
index d5da4be0da..09e44ceb16 100644
--- a/tests/BitmapCopyTest.cpp
+++ b/tests/BitmapCopyTest.cpp
@@ -13,11 +13,7 @@
static void init_src(const SkBitmap& bitmap) {
if (bitmap.getPixels()) {
- if (bitmap.getColorTable()) {
- sk_bzero(bitmap.getPixels(), bitmap.getSize());
- } else {
- bitmap.eraseColor(SK_ColorWHITE);
- }
+ bitmap.eraseColor(SK_ColorWHITE);
}
}
@@ -114,12 +110,6 @@ DEF_TEST(BitmapCopy_extractSubset, reporter) {
REPORTER_ASSERT(reporter, copy.width() == W);
REPORTER_ASSERT(reporter, copy.height() == 2);
-
- if (gPairs[i].fColorType == gPairs[j].fColorType) {
- // they should both have, or both not-have, a colortable
- bool hasCT = subset.getColorTable() != nullptr;
- REPORTER_ASSERT(reporter, (copy.getColorTable() != nullptr) == hasCT);
- }
}
}
diff --git a/tests/BitmapTest.cpp b/tests/BitmapTest.cpp
index e0a7f78d8b..ddc770f99d 100644
--- a/tests/BitmapTest.cpp
+++ b/tests/BitmapTest.cpp
@@ -33,7 +33,6 @@ static void test_peekpixels(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, pmap.info() == bm.info());
REPORTER_ASSERT(reporter, pmap.addr() == bm.getPixels());
REPORTER_ASSERT(reporter, pmap.rowBytes() == bm.rowBytes());
- REPORTER_ASSERT(reporter, pmap.ctable() == bm.getColorTable());
}
// https://code.google.com/p/chromium/issues/detail?id=446164
@@ -45,7 +44,7 @@ static void test_bigalloc(skiatest::Reporter* reporter) {
SkBitmap bm;
REPORTER_ASSERT(reporter, !bm.tryAllocPixels(info));
- sk_sp<SkPixelRef> pr = SkMallocPixelRef::MakeAllocate(info, info.minRowBytes(), nullptr);
+ sk_sp<SkPixelRef> pr = SkMallocPixelRef::MakeAllocate(info, info.minRowBytes());
REPORTER_ASSERT(reporter, !pr);
}
diff --git a/tests/MallocPixelRefTest.cpp b/tests/MallocPixelRefTest.cpp
index 096e3e69ee..957c8b3948 100644
--- a/tests/MallocPixelRefTest.cpp
+++ b/tests/MallocPixelRefTest.cpp
@@ -26,7 +26,7 @@ DEF_TEST(MallocPixelRef, reporter) {
SkImageInfo info = SkImageInfo::MakeN32Premul(10, 13);
{
sk_sp<SkPixelRef> pr(
- SkMallocPixelRef::MakeAllocate(info, info.minRowBytes() - 1, nullptr));
+ SkMallocPixelRef::MakeAllocate(info, info.minRowBytes() - 1));
// rowbytes too small.
REPORTER_ASSERT(reporter, nullptr == pr.get());
}
@@ -35,7 +35,7 @@ DEF_TEST(MallocPixelRef, reporter) {
size_t size = info.getSafeSize(rowBytes);
sk_sp<SkData> data(SkData::MakeUninitialized(size));
sk_sp<SkPixelRef> pr(
- SkMallocPixelRef::MakeWithData(info, rowBytes, nullptr, data));
+ SkMallocPixelRef::MakeWithData(info, rowBytes, data));
// rowbytes too small.
REPORTER_ASSERT(reporter, nullptr == pr.get());
}
@@ -44,7 +44,7 @@ DEF_TEST(MallocPixelRef, reporter) {
size_t size = info.getSafeSize(rowBytes) - 1;
sk_sp<SkData> data(SkData::MakeUninitialized(size));
sk_sp<SkPixelRef> pr(
- SkMallocPixelRef::MakeWithData(info, rowBytes, nullptr, data));
+ SkMallocPixelRef::MakeWithData(info, rowBytes, data));
// data too small.
REPORTER_ASSERT(reporter, nullptr == pr.get());
}
@@ -53,21 +53,20 @@ DEF_TEST(MallocPixelRef, reporter) {
{
SkAutoMalloc memory(size);
sk_sp<SkPixelRef> pr(
- SkMallocPixelRef::MakeDirect(info, memory.get(), rowBytes, nullptr));
+ SkMallocPixelRef::MakeDirect(info, memory.get(), rowBytes));
REPORTER_ASSERT(reporter, pr.get() != nullptr);
REPORTER_ASSERT(reporter, memory.get() == pr->pixels());
}
{
sk_sp<SkPixelRef> pr(
- SkMallocPixelRef::MakeAllocate(info, rowBytes, nullptr));
+ SkMallocPixelRef::MakeAllocate(info, rowBytes));
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));
+ SkMallocPixelRef::MakeWithProc(info, rowBytes, addr, delete_uint8_proc, nullptr));
REPORTER_ASSERT(reporter, pr.get() != nullptr);
REPORTER_ASSERT(reporter, addr == pr->pixels());
}
@@ -75,7 +74,7 @@ DEF_TEST(MallocPixelRef, reporter) {
int x = 0;
SkAutoMalloc memory(size);
sk_sp<SkPixelRef> pr(
- SkMallocPixelRef::MakeWithProc(info, rowBytes, nullptr,
+ SkMallocPixelRef::MakeWithProc(info, rowBytes,
memory.get(), set_to_one_proc,
static_cast<void*>(&x)));
REPORTER_ASSERT(reporter, pr.get() != nullptr);
@@ -89,7 +88,7 @@ DEF_TEST(MallocPixelRef, reporter) {
int x = 0;
SkAutoMalloc memory(size);
sk_sp<SkPixelRef> pr(
- SkMallocPixelRef::MakeWithProc(SkImageInfo::MakeN32Premul(-1, -1), rowBytes, nullptr,
+ SkMallocPixelRef::MakeWithProc(SkImageInfo::MakeN32Premul(-1, -1), rowBytes,
memory.get(), set_to_one_proc,
static_cast<void*>(&x)));
REPORTER_ASSERT(reporter, pr.get() == nullptr);
@@ -100,7 +99,7 @@ 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,
+ SkMallocPixelRef::MakeWithProc(info, rowBytes, addr,
delete_uint8_proc, nullptr));
REPORTER_ASSERT(reporter, addr == pr->pixels());
}
@@ -108,7 +107,7 @@ DEF_TEST(MallocPixelRef, reporter) {
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<SkPixelRef> pr = SkMallocPixelRef::MakeWithData(info, rowBytes, data);
REPORTER_ASSERT(reporter, !(dataPtr->unique()));
data.reset(nullptr);
REPORTER_ASSERT(reporter, dataPtr->unique());
diff --git a/tests/PixelRefTest.cpp b/tests/PixelRefTest.cpp
index 683e249626..c978d81aff 100644
--- a/tests/PixelRefTest.cpp
+++ b/tests/PixelRefTest.cpp
@@ -23,21 +23,21 @@ static void test_dont_leak_install(skiatest::Reporter* reporter) {
info = SkImageInfo::MakeN32Premul(0, 0);
release_counter = 1;
- success = bm.installPixels(info, nullptr, 0, nullptr, decrement_counter_proc, &release_counter);
+ success = bm.installPixels(info, nullptr, 0, decrement_counter_proc, &release_counter);
REPORTER_ASSERT(reporter, true == success);
bm.reset();
REPORTER_ASSERT(reporter, 0 == release_counter);
info = SkImageInfo::MakeN32Premul(10, 10);
release_counter = 1;
- success = bm.installPixels(info, nullptr, 0, nullptr, decrement_counter_proc, &release_counter);
+ success = bm.installPixels(info, nullptr, 0, decrement_counter_proc, &release_counter);
REPORTER_ASSERT(reporter, true == success);
bm.reset();
REPORTER_ASSERT(reporter, 0 == release_counter);
info = SkImageInfo::MakeN32Premul(-10, -10);
release_counter = 1;
- success = bm.installPixels(info, nullptr, 0, nullptr, decrement_counter_proc, &release_counter);
+ success = bm.installPixels(info, nullptr, 0, decrement_counter_proc, &release_counter);
REPORTER_ASSERT(reporter, false == success);
bm.reset();
REPORTER_ASSERT(reporter, 0 == release_counter);
@@ -69,7 +69,7 @@ private:
DEF_TEST(PixelRef_GenIDChange, r) {
SkImageInfo info = SkImageInfo::MakeN32Premul(10, 10);
- sk_sp<SkPixelRef> pixelRef = SkMallocPixelRef::MakeAllocate(info, 0, nullptr);
+ sk_sp<SkPixelRef> pixelRef = SkMallocPixelRef::MakeAllocate(info, 0);
// Register a listener.
int count = 0;
diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp
index e26e134b2d..3aec3e68da 100644
--- a/tests/WritePixelsTest.cpp
+++ b/tests/WritePixelsTest.cpp
@@ -264,7 +264,7 @@ static bool alloc_row_bytes(SkBitmap* bm, const SkImageInfo& info, size_t rowByt
if (!bm->setInfo(info, rowBytes)) {
return false;
}
- sk_sp<SkPixelRef> pr = SkMallocPixelRef::MakeAllocate(info, rowBytes, nullptr);
+ sk_sp<SkPixelRef> pr = SkMallocPixelRef::MakeAllocate(info, rowBytes);
bm->setPixelRef(std::move(pr), 0, 0);
return true;
}