Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(613)

Unified Diff: tests/MallocPixelRefTest.cpp

Issue 565803005: use SkData::NewUninitialized (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: readInData -> NewFromStream Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/images/SkDecodingImageGenerator.cpp ('k') | tests/SurfaceTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/MallocPixelRefTest.cpp
diff --git a/tests/MallocPixelRefTest.cpp b/tests/MallocPixelRefTest.cpp
index c20c8836b2dc93a3ff4c2a3080e22e91466c971f..e267d6f72c425c40402bf7a798b0190e5fb5669f 100644
--- a/tests/MallocPixelRefTest.cpp
+++ b/tests/MallocPixelRefTest.cpp
@@ -32,22 +32,18 @@ DEF_TEST(MallocPixelRef, reporter) {
{
size_t rowBytes = info.minRowBytes() - 1;
size_t size = info.getSafeSize(rowBytes);
- void* addr = sk_malloc_throw(size);
- SkAutoDataUnref data(SkData::NewFromMalloc(addr, size));
+ SkAutoDataUnref data(SkData::NewUninitialized(size));
SkAutoTUnref<SkMallocPixelRef> pr(
- SkMallocPixelRef::NewWithData(info, rowBytes,
- NULL, data.get()));
+ SkMallocPixelRef::NewWithData(info, rowBytes, NULL, data));
// rowbytes too small.
REPORTER_ASSERT(reporter, NULL == pr.get());
}
{
size_t rowBytes = info.minRowBytes() + 2;
size_t size = info.getSafeSize(rowBytes) - 1;
- void* addr = sk_malloc_throw(size);
- SkAutoDataUnref data(SkData::NewFromMalloc(addr, size));
+ SkAutoDataUnref data(SkData::NewUninitialized(size));
SkAutoTUnref<SkMallocPixelRef> pr(
- SkMallocPixelRef::NewWithData(info, rowBytes, NULL,
- data.get()));
+ SkMallocPixelRef::NewWithData(info, rowBytes, NULL, data));
// data too small.
REPORTER_ASSERT(reporter, NULL == pr.get());
}
@@ -77,7 +73,6 @@ DEF_TEST(MallocPixelRef, reporter) {
{
int x = 0;
SkAutoMalloc memory(size);
- REPORTER_ASSERT(reporter, memory.get() != NULL);
SkAutoTUnref<SkMallocPixelRef> pr(
SkMallocPixelRef::NewWithProc(info, rowBytes, NULL,
memory.get(), set_to_one_proc,
@@ -98,9 +93,7 @@ DEF_TEST(MallocPixelRef, reporter) {
REPORTER_ASSERT(reporter, addr == pr->pixels());
}
{
- void* addr = sk_malloc_throw(size);
- SkAutoDataUnref data(SkData::NewFromMalloc(addr, size));
- REPORTER_ASSERT(reporter, data.get() != NULL);
+ SkAutoDataUnref data(SkData::NewUninitialized(size));
SkData* dataPtr = data.get();
REPORTER_ASSERT(reporter, dataPtr->unique());
SkAutoTUnref<SkMallocPixelRef> pr(
« no previous file with comments | « src/images/SkDecodingImageGenerator.cpp ('k') | tests/SurfaceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698