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

Unified Diff: tests/SurfaceTest.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 | « tests/MallocPixelRefTest.cpp ('k') | tools/lua/lua_app.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/SurfaceTest.cpp
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index a175f6495125b7f6647ffc491636b18360642395..dcf9a859dd9639a6ef837e415c3cabd330403b5d 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -74,8 +74,7 @@ static void test_image(skiatest::Reporter* reporter) {
SkImageInfo info = SkImageInfo::MakeN32Premul(1, 1);
size_t rowBytes = info.minRowBytes();
size_t size = info.getSafeSize(rowBytes);
- void* addr = sk_malloc_throw(size);
- SkData* data = SkData::NewFromMalloc(addr, size);
+ SkData* data = SkData::NewUninitialized(size);
REPORTER_ASSERT(reporter, 1 == data->getRefCnt());
SkImage* image = SkImage::NewRasterData(info, data, rowBytes);
@@ -92,9 +91,9 @@ static SkImage* createImage(ImageType imageType, GrContext* context,
const size_t rowBytes = info.minRowBytes();
const size_t size = rowBytes * info.height();
- void* addr = sk_malloc_throw(size);
+ SkAutoTUnref<SkData> data(SkData::NewUninitialized(size));
+ void* addr = data->writable_data();
sk_memset32((SkPMColor*)addr, pmcolor, SkToInt(size >> 2));
- SkAutoTUnref<SkData> data(SkData::NewFromMalloc(addr, size));
switch (imageType) {
case kRasterCopy_ImageType:
« no previous file with comments | « tests/MallocPixelRefTest.cpp ('k') | tools/lua/lua_app.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698