aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2015-08-26 13:07:48 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-08-26 13:07:49 -0700
commit385fe4d4b62d7d1dd76116dd570df3290a2f487b (patch)
tree53d982ff238828331e86acd44071a44162a8688c /tests
parent5015176adf046ef906a2313b6e6b64b72cc84898 (diff)
Style Change: SkNEW->new; SkDELETE->delete
Diffstat (limited to 'tests')
-rw-r--r--tests/BlurTest.cpp2
-rw-r--r--tests/CachedDataTest.cpp4
-rw-r--r--tests/CachedDecodingPixelRefTest.cpp5
-rw-r--r--tests/CanvasTest.cpp4
-rw-r--r--tests/DataRefTest.cpp2
-rw-r--r--tests/DrawBitmapRectTest.cpp2
-rw-r--r--tests/DrawFilterTest.cpp3
-rw-r--r--tests/FrontBufferedStreamTest.cpp16
-rw-r--r--tests/GLProgramsTest.cpp2
-rw-r--r--tests/ImageCacheTest.cpp12
-rw-r--r--tests/ImageDecodingTest.cpp3
-rw-r--r--tests/ImageFilterTest.cpp2
-rw-r--r--tests/ImageTest.cpp2
-rw-r--r--tests/JpegTest.cpp2
-rw-r--r--tests/KtxTest.cpp5
-rw-r--r--tests/LayerRasterizerTest.cpp6
-rw-r--r--tests/LazyPtrTest.cpp6
-rw-r--r--tests/PDFInvalidBitmapTest.cpp2
-rw-r--r--tests/PDFPrimitivesTest.cpp2
-rw-r--r--tests/PathOpsOpCircleThreadedTest.cpp4
-rw-r--r--tests/PathOpsOpCubicThreadedTest.cpp4
-rw-r--r--[-rwxr-xr-x]tests/PathOpsOpLoopThreadedTest.cpp4
-rw-r--r--tests/PathOpsOpRectThreadedTest.cpp4
-rw-r--r--tests/PathOpsQuadLineIntersectionThreadedTest.cpp4
-rw-r--r--[-rwxr-xr-x]tests/PathOpsSimplifyDegenerateThreadedTest.cpp5
-rw-r--r--tests/PathOpsSimplifyQuadThreadedTest.cpp4
-rw-r--r--[-rwxr-xr-x]tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp4
-rw-r--r--tests/PathOpsSimplifyRectThreadedTest.cpp4
-rw-r--r--[-rwxr-xr-x]tests/PathOpsSimplifyTrianglesThreadedTest.cpp4
-rw-r--r--[-rwxr-xr-x]tests/PathOpsSkpClipTest.cpp36
-rw-r--r--tests/PathOpsThreadedCommon.cpp2
-rw-r--r--tests/PathOpsTightBoundsTest.cpp8
-rw-r--r--tests/PathTest.cpp12
-rw-r--r--tests/PixelRefTest.cpp4
-rw-r--r--tests/QuickRejectTest.cpp4
-rw-r--r--tests/RecordTest.cpp2
-rw-r--r--tests/ResourceCacheTest.cpp64
-rw-r--r--tests/SkResourceCacheTest.cpp8
-rw-r--r--tests/SkpSkGrTest.cpp8
-rw-r--r--tests/SurfaceTest.cpp2
-rw-r--r--tests/SwizzlerTest.cpp2
-rw-r--r--tests/TArrayTest.cpp8
-rw-r--r--tests/TextBlobCacheTest.cpp2
-rw-r--r--tests/skia_test.cpp7
44 files changed, 140 insertions, 152 deletions
diff --git a/tests/BlurTest.cpp b/tests/BlurTest.cpp
index 645340a09f..cde700ef7f 100644
--- a/tests/BlurTest.cpp
+++ b/tests/BlurTest.cpp
@@ -293,7 +293,7 @@ static bool gpu_blur_path(GrContextFactory* factory, const SkPath& path,
desc.fSampleCnt = 0;
SkAutoTUnref<GrTexture> texture(grContext->createTexture(desc, false, NULL, 0));
- SkAutoTUnref<SkGpuDevice> device(SkNEW_ARGS(SkGpuDevice, (grContext, texture.get())));
+ SkAutoTUnref<SkGpuDevice> device(new SkGpuDevice (grContext, texture.get()));
SkCanvas canvas(device.get());
blur_path(&canvas, path, gaussianSigma);
diff --git a/tests/CachedDataTest.cpp b/tests/CachedDataTest.cpp
index f65a46b770..e3ceeaf152 100644
--- a/tests/CachedDataTest.cpp
+++ b/tests/CachedDataTest.cpp
@@ -31,9 +31,9 @@ static SkCachedData* make_data(size_t size, SkDiscardableMemoryPool* pool) {
SkDiscardableMemory* dm = pool->create(size);
// the pool "can" return null, but it shouldn't in these controlled conditions
SK_ALWAYSBREAK(dm);
- return SkNEW_ARGS(SkCachedData, (size, dm));
+ return new SkCachedData(size, dm);
} else {
- return SkNEW_ARGS(SkCachedData, (sk_malloc_throw(size), size));
+ return new SkCachedData(sk_malloc_throw(size), size);
}
}
diff --git a/tests/CachedDecodingPixelRefTest.cpp b/tests/CachedDecodingPixelRefTest.cpp
index c69cd969f5..721c0908f8 100644
--- a/tests/CachedDecodingPixelRefTest.cpp
+++ b/tests/CachedDecodingPixelRefTest.cpp
@@ -239,8 +239,7 @@ static void check_pixelref(TestImageGenerator::TestType type,
PixelRefType pixelRefType,
SkDiscardableMemory::Factory* factory) {
SkASSERT((pixelRefType >= 0) && (pixelRefType <= kLast_PixelRefType));
- SkAutoTDelete<SkImageGenerator> gen(SkNEW_ARGS(TestImageGenerator,
- (type, reporter)));
+ SkAutoTDelete<SkImageGenerator> gen(new TestImageGenerator(type, reporter));
REPORTER_ASSERT(reporter, gen.get() != NULL);
SkBitmap lazy;
bool success;
@@ -317,7 +316,7 @@ DEF_TEST(Image_NewFromGenerator, r) {
};
for (size_t i = 0; i < SK_ARRAY_COUNT(testTypes); ++i) {
TestImageGenerator::TestType test = testTypes[i];
- SkImageGenerator* gen = SkNEW_ARGS(TestImageGenerator, (test, r));
+ SkImageGenerator* gen = new TestImageGenerator(test, r);
SkAutoTUnref<SkImage> image(SkImage::NewFromGenerator(gen));
if (NULL == image.get()) {
ERRORF(r, "SkImage::NewFromGenerator unexpecedly failed ["
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp
index c80e6bef95..f7976356e0 100644
--- a/tests/CanvasTest.cpp
+++ b/tests/CanvasTest.cpp
@@ -654,7 +654,7 @@ static void test_newraster(skiatest::Reporter* reporter) {
}
addr = (const SkPMColor*)((const char*)addr + rowBytes);
}
- SkDELETE(canvas);
+ delete canvas;
// now try a deliberately bad info
info = info.makeWH(-1, info.height());
@@ -672,7 +672,7 @@ static void test_newraster(skiatest::Reporter* reporter) {
info = SkImageInfo::MakeN32Premul(0, 0);
canvas = SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes);
REPORTER_ASSERT(reporter, canvas);
- SkDELETE(canvas);
+ delete canvas;
}
DEF_TEST(Canvas, reporter) {
diff --git a/tests/DataRefTest.cpp b/tests/DataRefTest.cpp
index 8f06a1892e..58600ef3ee 100644
--- a/tests/DataRefTest.cpp
+++ b/tests/DataRefTest.cpp
@@ -310,6 +310,6 @@ DEF_TEST(RWBuffer, reporter) {
check_alphabet_buffer(reporter, readers[i]);
check_alphabet_stream(reporter, streams[i]);
readers[i]->unref();
- SkDELETE(streams[i]);
+ delete streams[i];
}
}
diff --git a/tests/DrawBitmapRectTest.cpp b/tests/DrawBitmapRectTest.cpp
index 52c7433b0d..0b0c87c88e 100644
--- a/tests/DrawBitmapRectTest.cpp
+++ b/tests/DrawBitmapRectTest.cpp
@@ -34,7 +34,7 @@ static void test_faulty_pixelref(skiatest::Reporter* reporter) {
SkAutoTUnref<SkDiscardableMemoryPool> pool(
SkDiscardableMemoryPool::Create(10 * 1000, NULL));
SkBitmap bm;
- bool success = SkInstallDiscardablePixelRef(SkNEW(FailureImageGenerator), NULL, &bm, pool);
+ bool success = SkInstallDiscardablePixelRef(new FailureImageGenerator, NULL, &bm, pool);
REPORTER_ASSERT(reporter, success);
// now our bitmap has a pixelref, but we know it will fail to lock
diff --git a/tests/DrawFilterTest.cpp b/tests/DrawFilterTest.cpp
index 13ae5c6bd0..de4672dd67 100644
--- a/tests/DrawFilterTest.cpp
+++ b/tests/DrawFilterTest.cpp
@@ -28,8 +28,7 @@ static void test_saverestore(skiatest::Reporter* reporter) {
SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(10, 10));
SkCanvas* canvas = surface->getCanvas();
-
- SkAutoTUnref<TestFilter> df(SkNEW(TestFilter));
+ SkAutoTUnref<TestFilter> df(new TestFilter);
REPORTER_ASSERT(reporter, NULL == canvas->getDrawFilter());
diff --git a/tests/FrontBufferedStreamTest.cpp b/tests/FrontBufferedStreamTest.cpp
index f3ef47db59..0b161b96d8 100644
--- a/tests/FrontBufferedStreamTest.cpp
+++ b/tests/FrontBufferedStreamTest.cpp
@@ -54,7 +54,7 @@ static void test_incremental_buffering(skiatest::Reporter* reporter, size_t buff
// NOTE: For this and other tests in this file, we cheat and continue to refer to the
// wrapped stream, but that's okay because we know the wrapping stream has not been
// deleted yet (and we only call const methods in it).
- SkMemoryStream* memStream = SkNEW_ARGS(SkMemoryStream, (gAbcs, strlen(gAbcs), false));
+ SkMemoryStream* memStream = new SkMemoryStream(gAbcs, strlen(gAbcs), false);
SkAutoTDelete<SkStream> bufferedStream(SkFrontBufferedStream::Create(memStream, bufferSize));
test_hasLength(reporter, *bufferedStream.get(), *memStream);
@@ -82,7 +82,7 @@ static void test_incremental_buffering(skiatest::Reporter* reporter, size_t buff
}
static void test_perfectly_sized_buffer(skiatest::Reporter* reporter, size_t bufferSize) {
- SkMemoryStream* memStream = SkNEW_ARGS(SkMemoryStream, (gAbcs, strlen(gAbcs), false));
+ SkMemoryStream* memStream = new SkMemoryStream(gAbcs, strlen(gAbcs), false);
SkAutoTDelete<SkStream> bufferedStream(SkFrontBufferedStream::Create(memStream, bufferSize));
test_hasLength(reporter, *bufferedStream.get(), *memStream);
@@ -101,7 +101,7 @@ static void test_perfectly_sized_buffer(skiatest::Reporter* reporter, size_t buf
}
static void test_skipping(skiatest::Reporter* reporter, size_t bufferSize) {
- SkMemoryStream* memStream = SkNEW_ARGS(SkMemoryStream, (gAbcs, strlen(gAbcs), false));
+ SkMemoryStream* memStream = new SkMemoryStream(gAbcs, strlen(gAbcs), false);
SkAutoTDelete<SkStream> bufferedStream(SkFrontBufferedStream::Create(memStream, bufferSize));
test_hasLength(reporter, *bufferedStream.get(), *memStream);
@@ -152,7 +152,8 @@ private:
// does not invalidate the buffer.
static void test_read_beyond_buffer(skiatest::Reporter* reporter, size_t bufferSize) {
// Use a stream that behaves like Android's stream.
- AndroidLikeMemoryStream* memStream = SkNEW_ARGS(AndroidLikeMemoryStream, ((void*)gAbcs, bufferSize, false));
+ AndroidLikeMemoryStream* memStream =
+ new AndroidLikeMemoryStream((void*)gAbcs, bufferSize, false);
// Create a buffer that matches the length of the stream.
SkAutoTDelete<SkStream> bufferedStream(SkFrontBufferedStream::Create(memStream, bufferSize));
@@ -200,7 +201,8 @@ private:
static void test_length_combos(skiatest::Reporter* reporter, size_t bufferSize) {
for (int hasLen = 0; hasLen <= 1; hasLen++) {
for (int hasPos = 0; hasPos <= 1; hasPos++) {
- LengthOptionalStream* stream = SkNEW_ARGS(LengthOptionalStream, (SkToBool(hasLen), SkToBool(hasPos)));
+ LengthOptionalStream* stream =
+ new LengthOptionalStream(SkToBool(hasLen), SkToBool(hasPos));
SkAutoTDelete<SkStream> buffered(SkFrontBufferedStream::Create(stream, bufferSize));
test_hasLength(reporter, *buffered.get(), *stream);
}
@@ -209,7 +211,7 @@ static void test_length_combos(skiatest::Reporter* reporter, size_t bufferSize)
// Test using a stream with an initial offset.
static void test_initial_offset(skiatest::Reporter* reporter, size_t bufferSize) {
- SkMemoryStream* memStream = SkNEW_ARGS(SkMemoryStream, (gAbcs, strlen(gAbcs), false));
+ SkMemoryStream* memStream = new SkMemoryStream(gAbcs, strlen(gAbcs), false);
// Skip a few characters into the memStream, so that bufferedStream represents an offset into
// the stream it wraps.
@@ -286,7 +288,7 @@ private:
};
DEF_TEST(ShortFrontBufferedStream, reporter) {
- FailingStream* failingStream = SkNEW(FailingStream);
+ FailingStream* failingStream = new FailingStream;
SkAutoTDelete<SkStreamRewindable> stream(SkFrontBufferedStream::Create(failingStream, 64));
SkBitmap bm;
// The return value of DecodeStream is not important. We are just using DecodeStream because
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index 16745e5669..4b3bcdffbe 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -69,7 +69,7 @@ public:
const char* name() const override { return "Big Ole Key"; }
GrGLFragmentProcessor* onCreateGLInstance() const override {
- return SkNEW_ARGS(GLBigKeyProcessor, (*this));
+ return new GLBigKeyProcessor(*this);
}
private:
diff --git a/tests/ImageCacheTest.cpp b/tests/ImageCacheTest.cpp
index e2efe971d0..98fb4efb7d 100644
--- a/tests/ImageCacheTest.cpp
+++ b/tests/ImageCacheTest.cpp
@@ -50,7 +50,7 @@ static void test_cache(skiatest::Reporter* reporter, SkResourceCache& cache, boo
REPORTER_ASSERT(reporter, !cache.find(key, TestingRec::Visitor, &value));
REPORTER_ASSERT(reporter, -1 == value);
- cache.add(SkNEW_ARGS(TestingRec, (key, i)));
+ cache.add(new TestingRec(key, i));
REPORTER_ASSERT(reporter, cache.find(key, TestingRec::Visitor, &value));
REPORTER_ASSERT(reporter, i == value);
@@ -60,7 +60,7 @@ static void test_cache(skiatest::Reporter* reporter, SkResourceCache& cache, boo
// stress test, should trigger purges
for (int i = 0; i < COUNT * 100; ++i) {
TestingKey key(i);
- cache.add(SkNEW_ARGS(TestingRec, (key, i)));
+ cache.add(new TestingRec(key, i));
}
}
@@ -75,8 +75,8 @@ static void test_cache(skiatest::Reporter* reporter, SkResourceCache& cache, boo
static void test_cache_purge_shared_id(skiatest::Reporter* reporter, SkResourceCache& cache) {
for (int i = 0; i < COUNT; ++i) {
- TestingKey key(i, i & 1); // every other key will have a 1 for its sharedID
- cache.add(SkNEW_ARGS(TestingRec, (key, i)));
+ TestingKey key(i, i & 1); // every other key will have a 1 for its sharedID
+ cache.add(new TestingRec(key, i));
}
// Ensure that everyone is present
@@ -143,8 +143,8 @@ DEF_TEST(ImageCache_doubleAdd, r) {
TestingKey key(1);
- cache.add(SkNEW_ARGS(TestingRec, (key, 2)));
- cache.add(SkNEW_ARGS(TestingRec, (key, 3)));
+ cache.add(new TestingRec(key, 2));
+ cache.add(new TestingRec(key, 3));
// Lookup can return either value.
intptr_t value = -1;
diff --git a/tests/ImageDecodingTest.cpp b/tests/ImageDecodingTest.cpp
index 1348ded448..971c3e791f 100644
--- a/tests/ImageDecodingTest.cpp
+++ b/tests/ImageDecodingTest.cpp
@@ -742,8 +742,7 @@ DEF_TEST(ImageDecoding_JpegOverwrite, r) {
pixels[pixelCount] = sentinal; // This value should not be changed.
SkAutoTUnref<SingleAllocator> allocator(
- SkNEW_ARGS(SingleAllocator,
- ((void*)pixels.get(), sizeof(uint16_t) * pixelCount)));
+ new SingleAllocator((void*)pixels.get(), sizeof(uint16_t) * pixelCount));
decoder->setAllocator(allocator);
decoder->setSampleSize(2);
SkBitmap bitmap;
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index c15d719a64..f2aa0e94e9 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -80,7 +80,7 @@ SkFlattenable* MatrixTestImageFilter::CreateProc(SkReadBuffer& buffer) {
skiatest::Reporter* reporter = (skiatest::Reporter*)buffer.readFunctionPtr();
SkMatrix matrix;
buffer.readMatrix(&matrix);
- return SkNEW_ARGS(MatrixTestImageFilter, (reporter, matrix));
+ return new MatrixTestImageFilter(reporter, matrix);
}
#ifndef SK_IGNORE_TO_STRING
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index 1c173da81a..de945f978b 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -109,7 +109,7 @@ DEF_TEST(Image_NewRasterCopy, reporter) {
const SkPMColor green = SkPackARGB32(0xFF, 0, 0xFF, 0);
const SkPMColor blue = SkPackARGB32(0xFF, 0, 0, 0xFF);
SkPMColor colors[] = { red, green, blue, 0 };
- SkAutoTUnref<SkColorTable> ctable(SkNEW_ARGS(SkColorTable, (colors, SK_ARRAY_COUNT(colors))));
+ SkAutoTUnref<SkColorTable> ctable(new SkColorTable(colors, SK_ARRAY_COUNT(colors)));
// The colortable made a copy, so we can trash the original colors
memset(colors, 0xFF, sizeof(colors));
diff --git a/tests/JpegTest.cpp b/tests/JpegTest.cpp
index 8828926ef9..1153a3682b 100644
--- a/tests/JpegTest.cpp
+++ b/tests/JpegTest.cpp
@@ -456,7 +456,7 @@ DEF_TEST(Jpeg, reporter) {
DEF_TEST(Jpeg_YUV, reporter) {
size_t len = sizeof(goodJpegImage);
- SkMemoryStream* stream = SkNEW_ARGS(SkMemoryStream, (goodJpegImage, len));
+ SkMemoryStream* stream = new SkMemoryStream(goodJpegImage, len);
SkBitmap bitmap;
SkDecodingImageGenerator::Options opts;
diff --git a/tests/KtxTest.cpp b/tests/KtxTest.cpp
index 53caabdd91..eb36d643a8 100644
--- a/tests/KtxTest.cpp
+++ b/tests/KtxTest.cpp
@@ -55,7 +55,7 @@ DEF_TEST(KtxReadWrite, reporter) {
SkAutoDataUnref encodedData(SkImageEncoder::EncodeData(bm8888, SkImageEncoder::kKTX_Type, 0));
REPORTER_ASSERT(reporter, encodedData);
- SkAutoTDelete<SkMemoryStream> stream(SkNEW_ARGS(SkMemoryStream, (encodedData)));
+ SkAutoTDelete<SkMemoryStream> stream(new SkMemoryStream(encodedData));
REPORTER_ASSERT(reporter, stream);
SkBitmap decodedBitmap;
@@ -107,8 +107,7 @@ DEF_TEST(KtxReadUnpremul, reporter) {
0xFF, 0xFF, 0xFF, 0x80, // Pixel 3
0xFF, 0xFF, 0xFF, 0x80};// Pixel 4
- SkAutoTDelete<SkMemoryStream> stream(
- SkNEW_ARGS(SkMemoryStream, (kHalfWhiteKTX, sizeof(kHalfWhiteKTX))));
+ SkAutoTDelete<SkMemoryStream> stream(new SkMemoryStream(kHalfWhiteKTX, sizeof(kHalfWhiteKTX)));
REPORTER_ASSERT(reporter, stream);
SkBitmap decodedBitmap;
diff --git a/tests/LayerRasterizerTest.cpp b/tests/LayerRasterizerTest.cpp
index b4edc14adc..82060b01b0 100644
--- a/tests/LayerRasterizerTest.cpp
+++ b/tests/LayerRasterizerTest.cpp
@@ -43,15 +43,13 @@ private:
int DummyRasterizer::gCount;
-SkFlattenable* DummyRasterizer::CreateProc(SkReadBuffer&) {
- return SkNEW(DummyRasterizer);
-}
+SkFlattenable* DummyRasterizer::CreateProc(SkReadBuffer&) { return new DummyRasterizer; }
// Check to make sure that the SkPaint in the layer has its destructor called.
DEF_TEST(LayerRasterizer_destructor, reporter) {
{
SkPaint paint;
- paint.setRasterizer(SkNEW(DummyRasterizer))->unref();
+ paint.setRasterizer(new DummyRasterizer)->unref();
REPORTER_ASSERT(reporter, DummyRasterizer::GetCount() == 1);
SkLayerRasterizer::Builder builder;
diff --git a/tests/LazyPtrTest.cpp b/tests/LazyPtrTest.cpp
index 89443f9a80..c6ffd72e25 100644
--- a/tests/LazyPtrTest.cpp
+++ b/tests/LazyPtrTest.cpp
@@ -14,7 +14,7 @@ namespace {
struct CreateIntFromFloat {
CreateIntFromFloat(float val) : fVal(val) {}
- int* operator()() const { return SkNEW_ARGS(int, ((int)fVal)); }
+ int* operator()() const { return new int((int)fVal); }
float fVal;
};
@@ -24,7 +24,7 @@ void custom_destroy(int* ptr) { *ptr = 99; }
} // namespace
DEF_TEST(LazyPtr, r) {
- // Basic usage: calls SkNEW(int).
+ // Basic usage: calls new int.
SkLazyPtr<int> lazy;
int* ptr = lazy.get();
REPORTER_ASSERT(r, ptr);
@@ -48,7 +48,7 @@ DEF_TEST(LazyPtr, r) {
REPORTER_ASSERT(r, ptr);
REPORTER_ASSERT(r, 99 == *ptr);
// Since custom_destroy didn't actually delete ptr, we do now.
- SkDELETE(ptr);
+ delete ptr;
}
DEF_TEST(LazyPtr_Threaded, r) {
diff --git a/tests/PDFInvalidBitmapTest.cpp b/tests/PDFInvalidBitmapTest.cpp
index 8a9b1fa132..57e51f07c4 100644
--- a/tests/PDFInvalidBitmapTest.cpp
+++ b/tests/PDFInvalidBitmapTest.cpp
@@ -32,7 +32,7 @@ private:
SkBitmap make_invalid_bitmap(const SkImageInfo& imageInfo) {
SkBitmap bitmap;
bitmap.setInfo(imageInfo);
- bitmap.setPixelRef(SkNEW_ARGS(InvalidPixelRef, (imageInfo)))->unref();
+ bitmap.setPixelRef(new InvalidPixelRef(imageInfo))->unref();
return bitmap;
}
diff --git a/tests/PDFPrimitivesTest.cpp b/tests/PDFPrimitivesTest.cpp
index 1d35c08cbb..8af806cbe7 100644
--- a/tests/PDFPrimitivesTest.cpp
+++ b/tests/PDFPrimitivesTest.cpp
@@ -384,7 +384,7 @@ private:
SkFlattenable* DummyImageFilter::CreateProc(SkReadBuffer& buffer) {
SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 0);
bool visited = buffer.readBool();
- return SkNEW_ARGS(DummyImageFilter, (visited));
+ return new DummyImageFilter(visited);
}
#ifndef SK_IGNORE_TO_STRING
diff --git a/tests/PathOpsOpCircleThreadedTest.cpp b/tests/PathOpsOpCircleThreadedTest.cpp
index 0bb75cc021..30b1603589 100644
--- a/tests/PathOpsOpCircleThreadedTest.cpp
+++ b/tests/PathOpsOpCircleThreadedTest.cpp
@@ -70,8 +70,8 @@ DEF_TEST(PathOpsOpCircleThreaded, reporter) {
for (int b = a + 1; b < 7; ++b) {
for (int c = 0 ; c < 6; ++c) {
for (int d = 0; d < 2; ++d) {
- *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
- (&testOpCirclesMain, a, b, c, d, &testRunner));
+ *testRunner.fRunnables.append() = new PathOpsThreadedRunnable(
+ &testOpCirclesMain, a, b, c, d, &testRunner);
}
}
if (!reporter->allowExtendedTest()) goto finish;
diff --git a/tests/PathOpsOpCubicThreadedTest.cpp b/tests/PathOpsOpCubicThreadedTest.cpp
index 12eb71b906..991d4e764c 100644
--- a/tests/PathOpsOpCubicThreadedTest.cpp
+++ b/tests/PathOpsOpCubicThreadedTest.cpp
@@ -87,8 +87,8 @@ DEF_TEST(PathOpsOpCubicsThreaded, reporter) {
for (int b = a + 1; b < 7; ++b) {
for (int c = 0 ; c < 6; ++c) {
for (int d = c + 1; d < 7; ++d) {
- *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
- (&testOpCubicsMain, a, b, c, d, &testRunner));
+ *testRunner.fRunnables.append() =
+ new PathOpsThreadedRunnable(&testOpCubicsMain, a, b, c, d, &testRunner);
}
}
if (!reporter->allowExtendedTest()) goto finish;
diff --git a/tests/PathOpsOpLoopThreadedTest.cpp b/tests/PathOpsOpLoopThreadedTest.cpp
index 3f6d081e5d..7b4b7ce7cf 100755..100644
--- a/tests/PathOpsOpLoopThreadedTest.cpp
+++ b/tests/PathOpsOpLoopThreadedTest.cpp
@@ -99,8 +99,8 @@ DEF_TEST(PathOpsOpLoopsThreaded, reporter) {
for (int b = a + 1; b < 7; ++b) {
for (int c = 0 ; c < 6; ++c) {
for (int d = c + 1; d < 7; ++d) {
- *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
- (&testOpLoopsMain, a, b, c, d, &testRunner));
+ *testRunner.fRunnables.append() =
+ new PathOpsThreadedRunnable(&testOpLoopsMain, a, b, c, d, &testRunner);
}
}
if (!reporter->allowExtendedTest()) goto finish;
diff --git a/tests/PathOpsOpRectThreadedTest.cpp b/tests/PathOpsOpRectThreadedTest.cpp
index 9195e4a616..4d672e4857 100644
--- a/tests/PathOpsOpRectThreadedTest.cpp
+++ b/tests/PathOpsOpRectThreadedTest.cpp
@@ -88,8 +88,8 @@ DEF_TEST(PathOpsRectsThreaded, reporter) {
for (int b = a + 1; b < 7; ++b) {
for (int c = 0 ; c < 6; ++c) {
for (int d = c + 1; d < 7; ++d) {
- *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
- (&testPathOpsRectsMain, a, b, c, d, &testRunner));
+ *testRunner.fRunnables.append() = new PathOpsThreadedRunnable(
+ &testPathOpsRectsMain, a, b, c, d, &testRunner);
}
}
if (!reporter->allowExtendedTest()) goto finish;
diff --git a/tests/PathOpsQuadLineIntersectionThreadedTest.cpp b/tests/PathOpsQuadLineIntersectionThreadedTest.cpp
index a4f87dfea1..9ecc1f052f 100644
--- a/tests/PathOpsQuadLineIntersectionThreadedTest.cpp
+++ b/tests/PathOpsQuadLineIntersectionThreadedTest.cpp
@@ -116,8 +116,8 @@ DEF_TEST(PathOpsQuadLineIntersectionThreaded, reporter) {
for (int a = 0; a < 16; ++a) {
for (int b = 0 ; b < 16; ++b) {
for (int c = 0 ; c < 16; ++c) {
- *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
- (&testQuadLineIntersectMain, a, b, c, 0, &testRunner));
+ *testRunner.fRunnables.append() = new PathOpsThreadedRunnable(
+ &testQuadLineIntersectMain, a, b, c, 0, &testRunner);
}
if (!reporter->allowExtendedTest()) goto finish;
}
diff --git a/tests/PathOpsSimplifyDegenerateThreadedTest.cpp b/tests/PathOpsSimplifyDegenerateThreadedTest.cpp
index 8e8c58bf44..99a54d8fb6 100755..100644
--- a/tests/PathOpsSimplifyDegenerateThreadedTest.cpp
+++ b/tests/PathOpsSimplifyDegenerateThreadedTest.cpp
@@ -80,9 +80,8 @@ DEF_TEST(PathOpsSimplifyDegeneratesThreaded, reporter) {
int cx = c & 0x03;
int cy = c >> 2;
bool abcIsATriangle = (bx - ax) * (cy - ay) != (by - ay) * (cx - ax);
- *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
- (&testSimplifyDegeneratesMain, a, b, c, abcIsATriangle,
- &testRunner));
+ *testRunner.fRunnables.append() = new PathOpsThreadedRunnable(
+ &testSimplifyDegeneratesMain, a, b, c, abcIsATriangle, &testRunner);
}
if (!reporter->allowExtendedTest()) goto finish;
}
diff --git a/tests/PathOpsSimplifyQuadThreadedTest.cpp b/tests/PathOpsSimplifyQuadThreadedTest.cpp
index e3c0bc29d8..8ab84d7d8f 100644
--- a/tests/PathOpsSimplifyQuadThreadedTest.cpp
+++ b/tests/PathOpsSimplifyQuadThreadedTest.cpp
@@ -86,8 +86,8 @@ DEF_TEST(PathOpsSimplifyQuadsThreaded, reporter) {
for (int b = a ; b < 16; ++b) {
for (int c = b ; c < 16; ++c) {
for (int d = c; d < 16; ++d) {
- *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
- (&testSimplifyQuadsMain, a, b, c, d, &testRunner));
+ *testRunner.fRunnables.append() = new PathOpsThreadedRunnable(
+ &testSimplifyQuadsMain, a, b, c, d, &testRunner);
}
if (!reporter->allowExtendedTest()) goto finish;
}
diff --git a/tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp b/tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp
index f8e9a6e3dc..f2c1dfc990 100755..100644
--- a/tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp
+++ b/tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp
@@ -82,8 +82,8 @@ DEF_TEST(PathOpsSimplifyQuadralateralsThreaded, reporter) {
for (int b = a ; b < 16; ++b) {
for (int c = b ; c < 16; ++c) {
for (int d = c; d < 16; ++d) {
- *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
- (&testSimplifyQuadralateralsMain, a, b, c, d, &testRunner));
+ *testRunner.fRunnables.append() = new PathOpsThreadedRunnable(
+ &testSimplifyQuadralateralsMain, a, b, c, d, &testRunner);
}
if (!reporter->allowExtendedTest()) goto finish;
}
diff --git a/tests/PathOpsSimplifyRectThreadedTest.cpp b/tests/PathOpsSimplifyRectThreadedTest.cpp
index 52a78ece84..8c4e03c460 100644
--- a/tests/PathOpsSimplifyRectThreadedTest.cpp
+++ b/tests/PathOpsSimplifyRectThreadedTest.cpp
@@ -193,8 +193,8 @@ DEF_TEST(PathOpsSimplifyRectsThreaded, reporter) {
for (int b = a ; b < 8; ++b) {
for (int c = b ; c < 8; ++c) {
for (int d = c; d < 8; ++d) {
- *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
- (&testSimplify4x4RectsMain, a, b, c, d, &testRunner));
+ *testRunner.fRunnables.append() = new PathOpsThreadedRunnable(
+ &testSimplify4x4RectsMain, a, b, c, d, &testRunner);
}
if (!reporter->allowExtendedTest()) goto finish;
}
diff --git a/tests/PathOpsSimplifyTrianglesThreadedTest.cpp b/tests/PathOpsSimplifyTrianglesThreadedTest.cpp
index ee0ca2bcaa..8d8feee143 100755..100644
--- a/tests/PathOpsSimplifyTrianglesThreadedTest.cpp
+++ b/tests/PathOpsSimplifyTrianglesThreadedTest.cpp
@@ -90,8 +90,8 @@ DEF_TEST(PathOpsSimplifyTrianglesThreaded, reporter) {
if ((bx - ax) * (cy - ay) == (by - ay) * (cx - ax)) {
continue;
}
- *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
- (&testSimplifyTrianglesMain, a, b, c, 0, &testRunner));
+ *testRunner.fRunnables.append() = new PathOpsThreadedRunnable(
+ &testSimplifyTrianglesMain, a, b, c, 0, &testRunner);
}
if (!reporter->allowExtendedTest()) goto finish;
}
diff --git a/tests/PathOpsSkpClipTest.cpp b/tests/PathOpsSkpClipTest.cpp
index 95421fca30..de4f48c586 100755..100644
--- a/tests/PathOpsSkpClipTest.cpp
+++ b/tests/PathOpsSkpClipTest.cpp
@@ -300,7 +300,7 @@ public:
TestRunner::~TestRunner() {
for (int index = 0; index < fRunnables.count(); index++) {
- SkDELETE(fRunnables[index]);
+ delete fRunnables[index];
}
}
@@ -799,8 +799,8 @@ static void encodeFound(TestState& state) {
if (!filename.endsWith(".skp")) {
filename.append(".skp");
}
- *testRunner.fRunnables.append() = SkNEW_ARGS(TestRunnableEncode,
- (&testSkpClipEncode, result.fDirNo, filename.c_str(), &testRunner));
+ *testRunner.fRunnables.append() = new TestRunnableEncode(&testSkpClipEncode, result.fDirNo,
+ filename.c_str(), &testRunner);
}
testRunner.render();
}
@@ -823,18 +823,17 @@ private:
typedef SkTRegistry<Test*(*)(void*)> TestRegistry;
-#define DEF_TEST(name) \
- static void test_##name(); \
- class name##Class : public Test { \
- public: \
- static Test* Factory(void*) { return SkNEW(name##Class); } \
- protected: \
- void onGetName(SkString* name) override { \
- name->set(#name); \
- } \
- void onRun() override { test_##name(); } \
- }; \
- static TestRegistry gReg_##name##Class(name##Class::Factory); \
+#define DEF_TEST(name) \
+ static void test_##name(); \
+ class name##Class : public Test { \
+ public: \
+ static Test* Factory(void*) { return new name##Class; } \
+ \
+ protected: \
+ void onGetName(SkString* name) override { name->set(#name); } \
+ void onRun() override { test_##name(); } \
+ }; \
+ static TestRegistry gReg_##name##Class(name##Class::Factory); \
static void test_##name()
DEF_TEST(PathOpsSkpClip) {
@@ -868,8 +867,7 @@ DEF_TEST(PathOpsSkpClipThreaded) {
int dirNo;
gDirs.reset();
while ((dirNo = gDirs.next()) > 0) {
- *testRunner.fRunnables.append() = SkNEW_ARGS(TestRunnableDir,
- (&testSkpClipMain, dirNo, &testRunner));
+ *testRunner.fRunnables.append() = new TestRunnableDir(&testSkpClipMain, dirNo, &testRunner);
}
testRunner.render();
TestState state;
@@ -934,8 +932,8 @@ DEF_TEST(PathOpsSkpClipUberThreaded) {
int count = sorted.get()[dirNo - firstDirNo].count();
if (SkTSearch<SortByName, Less>(sorted.get()[dirNo - firstDirNo].begin(),
count, &name, sizeof(&name)) < 0) {
- *testRunner.fRunnables.append() = SkNEW_ARGS(TestRunnableFile,
- (&testSkpClip, dirNo, filename.c_str(), &testRunner));
+ *testRunner.fRunnables.append() = new TestRunnableFile(
+ &testSkpClip, dirNo, filename.c_str(), &testRunner);
}
}
checkEarlyExit:
diff --git a/tests/PathOpsThreadedCommon.cpp b/tests/PathOpsThreadedCommon.cpp
index 10501d139c..342b560049 100644
--- a/tests/PathOpsThreadedCommon.cpp
+++ b/tests/PathOpsThreadedCommon.cpp
@@ -11,7 +11,7 @@
PathOpsThreadedTestRunner::~PathOpsThreadedTestRunner() {
for (int index = 0; index < fRunnables.count(); index++) {
- SkDELETE(fRunnables[index]);
+ delete fRunnables[index];
}
}
diff --git a/tests/PathOpsTightBoundsTest.cpp b/tests/PathOpsTightBoundsTest.cpp
index d50c26a547..953756170b 100644
--- a/tests/PathOpsTightBoundsTest.cpp
+++ b/tests/PathOpsTightBoundsTest.cpp
@@ -39,8 +39,8 @@ DEF_TEST(PathOpsTightBoundsLines, reporter) {
int outerCount = reporter->allowExtendedTest() ? 100 : 1;
for (int index = 0; index < outerCount; ++index) {
for (int idx2 = 0; idx2 < 10; ++idx2) {
- *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
- (&testTightBoundsLines, 0, 0, 0, 0, &testRunner));
+ *testRunner.fRunnables.append() =
+ new PathOpsThreadedRunnable(&testTightBoundsLines, 0, 0, 0, 0, &testRunner);
}
}
testRunner.render();
@@ -114,8 +114,8 @@ DEF_TEST(PathOpsTightBoundsQuads, reporter) {
int outerCount = reporter->allowExtendedTest() ? 100 : 1;
for (int index = 0; index < outerCount; ++index) {
for (int idx2 = 0; idx2 < 10; ++idx2) {
- *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
- (&testTightBoundsQuads, 0, 0, 0, 0, &testRunner));
+ *testRunner.fRunnables.append() =
+ new PathOpsThreadedRunnable(&testTightBoundsQuads, 0, 0, 0, 0, &testRunner);
}
}
testRunner.render();
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index b0bd66726d..68eb67722f 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -3577,7 +3577,7 @@ public:
static void TestPathRef(skiatest::Reporter* reporter) {
static const int kRepeatCnt = 10;
- SkAutoTUnref<SkPathRef> pathRef(SkNEW(SkPathRef));
+ SkAutoTUnref<SkPathRef> pathRef(new SkPathRef);
SkPathRef::Editor ed(&pathRef);
@@ -3758,19 +3758,19 @@ public:
// Check that listener is notified on moveTo().
- SkPathPriv::AddGenIDChangeListener(p, SkNEW(ChangeListener(&changed)));
+ SkPathPriv::AddGenIDChangeListener(p, new ChangeListener(&changed));
REPORTER_ASSERT(reporter, !changed);
p.moveTo(10, 0);
REPORTER_ASSERT(reporter, changed);
// Check that listener is notified on lineTo().
- SkPathPriv::AddGenIDChangeListener(p, SkNEW(ChangeListener(&changed)));
+ SkPathPriv::AddGenIDChangeListener(p, new ChangeListener(&changed));
REPORTER_ASSERT(reporter, !changed);
p.lineTo(20, 0);
REPORTER_ASSERT(reporter, changed);
// Check that listener is notified on reset().
- SkPathPriv::AddGenIDChangeListener(p, SkNEW(ChangeListener(&changed)));
+ SkPathPriv::AddGenIDChangeListener(p, new ChangeListener(&changed));
REPORTER_ASSERT(reporter, !changed);
p.reset();
REPORTER_ASSERT(reporter, changed);
@@ -3778,7 +3778,7 @@ public:
p.moveTo(0, 0);
// Check that listener is notified on rewind().
- SkPathPriv::AddGenIDChangeListener(p, SkNEW(ChangeListener(&changed)));
+ SkPathPriv::AddGenIDChangeListener(p, new ChangeListener(&changed));
REPORTER_ASSERT(reporter, !changed);
p.rewind();
REPORTER_ASSERT(reporter, changed);
@@ -3787,7 +3787,7 @@ public:
{
SkPath q;
q.moveTo(10, 10);
- SkPathPriv::AddGenIDChangeListener(q, SkNEW(ChangeListener(&changed)));
+ SkPathPriv::AddGenIDChangeListener(q, new ChangeListener(&changed));
REPORTER_ASSERT(reporter, !changed);
}
// q went out of scope.
diff --git a/tests/PixelRefTest.cpp b/tests/PixelRefTest.cpp
index 8a6e8e3997..775354c83d 100644
--- a/tests/PixelRefTest.cpp
+++ b/tests/PixelRefTest.cpp
@@ -73,7 +73,7 @@ DEF_TEST(PixelRef_GenIDChange, r) {
// Register a listener.
int count = 0;
- pixelRef->addGenIDChangeListener(SkNEW_ARGS(TestListener, (&count)));
+ pixelRef->addGenIDChangeListener(new TestListener(&count));
REPORTER_ASSERT(r, 0 == count);
// No one has looked at our pixelRef's generation ID, so invalidating it doesn't make sense.
@@ -90,7 +90,7 @@ DEF_TEST(PixelRef_GenIDChange, r) {
// Force the generation ID to be recalculated, then add a listener.
REPORTER_ASSERT(r, 0 != pixelRef->getGenerationID());
- pixelRef->addGenIDChangeListener(SkNEW_ARGS(TestListener, (&count)));
+ pixelRef->addGenIDChangeListener(new TestListener(&count));
pixelRef->notifyPixelsChanged();
REPORTER_ASSERT(r, 1 == count);
diff --git a/tests/QuickRejectTest.cpp b/tests/QuickRejectTest.cpp
index e5dea247fb..c17aae9e6e 100644
--- a/tests/QuickRejectTest.cpp
+++ b/tests/QuickRejectTest.cpp
@@ -17,7 +17,7 @@ class TestLooper : public SkDrawLooper {
public:
SkDrawLooper::Context* createContext(SkCanvas*, void* storage) const override {
- return SkNEW_PLACEMENT(storage, TestDrawLooperContext);
+ return new (storage) TestDrawLooperContext;
}
size_t contextSize() const override { return sizeof(TestDrawLooperContext); }
@@ -49,7 +49,7 @@ private:
};
};
-SkFlattenable* TestLooper::CreateProc(SkReadBuffer&) { return SkNEW(TestLooper); }
+SkFlattenable* TestLooper::CreateProc(SkReadBuffer&) { return new TestLooper; }
static void test_drawBitmap(skiatest::Reporter* reporter) {
SkBitmap src;
diff --git a/tests/RecordTest.cpp b/tests/RecordTest.cpp
index b510da7673..cf8c6028bc 100644
--- a/tests/RecordTest.cpp
+++ b/tests/RecordTest.cpp
@@ -51,7 +51,7 @@ struct Stretch {
}
};
-#define APPEND(record, type, ...) SkNEW_PLACEMENT_ARGS(record.append<type>(), type, (__VA_ARGS__))
+#define APPEND(record, type, ...) new (record.append<type>()) type(__VA_ARGS__)
// Basic tests for the low-level SkRecord code.
DEF_TEST(Record, r) {
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index d5ee8454af..dff96f9213 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -261,7 +261,7 @@ public:
}
static TestResource* CreateScratch(GrGpu* gpu, SimulatedProperty property, bool cached = true) {
- return SkNEW_ARGS(TestResource, (gpu, property, cached, kScratchConstructor));
+ return new TestResource(gpu, property, cached, kScratchConstructor);
}
~TestResource() {
@@ -342,10 +342,10 @@ static void test_no_key(skiatest::Reporter* reporter) {
GrResourceCache* cache = mock.cache();
// Create a bunch of resources with no keys
- TestResource* a = SkNEW_ARGS(TestResource, (context->getGpu()));
- TestResource* b = SkNEW_ARGS(TestResource, (context->getGpu()));
- TestResource* c = SkNEW_ARGS(TestResource, (context->getGpu()));
- TestResource* d = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* a = new TestResource(context->getGpu());
+ TestResource* b = new TestResource(context->getGpu());
+ TestResource* c = new TestResource(context->getGpu());
+ TestResource* d = new TestResource(context->getGpu());
a->setSize(11);
b->setSize(12);
c->setSize(13);
@@ -404,14 +404,13 @@ static void test_budgeting(skiatest::Reporter* reporter) {
TestResource* scratch =
TestResource::CreateScratch(context->getGpu(), TestResource::kB_SimulatedProperty);
scratch->setSize(10);
- TestResource* unique = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* unique = new TestResource(context->getGpu());
unique->setSize(11);
unique->resourcePriv().setUniqueKey(uniqueKey);
- TestResource* wrapped = SkNEW_ARGS(TestResource,
- (context->getGpu(), GrGpuResource::kBorrowed_LifeCycle));
+ TestResource* wrapped = new TestResource(context->getGpu(), GrGpuResource::kBorrowed_LifeCycle);
wrapped->setSize(12);
- TestResource* unbudgeted = SkNEW_ARGS(TestResource,
- (context->getGpu(), GrGpuResource::kUncached_LifeCycle));
+ TestResource* unbudgeted =
+ new TestResource(context->getGpu(), GrGpuResource::kUncached_LifeCycle);
unbudgeted->setSize(13);
// Make sure we can't add a unique key to the wrapped resource
@@ -446,7 +445,7 @@ static void test_budgeting(skiatest::Reporter* reporter) {
unbudgeted->gpuMemorySize() == cache->getResourceBytes());
// Now try freeing the budgeted resources first
- wrapped = SkNEW_ARGS(TestResource, (context->getGpu(), GrGpuResource::kBorrowed_LifeCycle));
+ wrapped = new TestResource(context->getGpu(), GrGpuResource::kBorrowed_LifeCycle);
scratch->setSize(12);
unique->unref();
cache->purgeAllUnlocked();
@@ -499,7 +498,7 @@ static void test_unbudgeted(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, 1 == cache->getBudgetedResourceCount());
REPORTER_ASSERT(reporter, 10 == cache->getBudgetedResourceBytes());
- unique = SkNEW_ARGS(TestResource, (context->getGpu()));
+ unique = new TestResource(context->getGpu());
unique->setSize(11);
unique->resourcePriv().setUniqueKey(uniqueKey);
unique->unref();
@@ -509,8 +508,7 @@ static void test_unbudgeted(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, 21 == cache->getBudgetedResourceBytes());
size_t large = 2 * cache->getResourceBytes();
- unbudgeted = SkNEW_ARGS(TestResource,
- (context->getGpu(), large, GrGpuResource::kUncached_LifeCycle));
+ unbudgeted = new TestResource(context->getGpu(), large, GrGpuResource::kUncached_LifeCycle);
REPORTER_ASSERT(reporter, 3 == cache->getResourceCount());
REPORTER_ASSERT(reporter, 21 + large == cache->getResourceBytes());
REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount());
@@ -522,8 +520,7 @@ static void test_unbudgeted(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount());
REPORTER_ASSERT(reporter, 21 == cache->getBudgetedResourceBytes());
- wrapped = SkNEW_ARGS(TestResource,
- (context->getGpu(), large, GrGpuResource::kBorrowed_LifeCycle));
+ wrapped = new TestResource(context->getGpu(), large, GrGpuResource::kBorrowed_LifeCycle);
REPORTER_ASSERT(reporter, 3 == cache->getResourceCount());
REPORTER_ASSERT(reporter, 21 + large == cache->getResourceBytes());
REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount());
@@ -775,7 +772,7 @@ static void test_duplicate_unique_key(skiatest::Reporter* reporter) {
make_unique_key<0>(&key, 0);
// Create two resources that we will attempt to register with the same unique key.
- TestResource* a = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* a = new TestResource(context->getGpu());
a->setSize(11);
// Set key on resource a.
@@ -792,7 +789,7 @@ static void test_duplicate_unique_key(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive());
// Create resource b and set the same key. It should replace a's unique key cache entry.
- TestResource* b = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* b = new TestResource(context->getGpu());
b->setSize(12);
b->resourcePriv().setUniqueKey(key);
REPORTER_ASSERT(reporter, b == cache->findAndRefUniqueResource(key));
@@ -812,7 +809,7 @@ static void test_duplicate_unique_key(skiatest::Reporter* reporter) {
// Now replace b with c, but make sure c can start with one unique key and change it to b's key.
// Also make b be unreffed when replacement occurs.
b->unref();
- TestResource* c = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* c = new TestResource(context->getGpu());
GrUniqueKey differentKey;
make_unique_key<0>(&differentKey, 1);
c->setSize(13);
@@ -849,7 +846,7 @@ static void test_duplicate_unique_key(skiatest::Reporter* reporter) {
{
GrUniqueKey key2;
make_unique_key<0>(&key2, 0);
- SkAutoTUnref<TestResource> d(SkNEW_ARGS(TestResource, (context->getGpu())));
+ SkAutoTUnref<TestResource> d(new TestResource(context->getGpu()));
int foo = 4132;
SkAutoTUnref<SkData> data(SkData::NewWithCopy(&foo, sizeof(foo)));
key2.setCustomData(data.get());
@@ -873,8 +870,8 @@ static void test_purge_invalidated(skiatest::Reporter* reporter) {
make_unique_key<0>(&key3, 3);
// Add three resources to the cache. Only c is usable as scratch.
- TestResource* a = SkNEW_ARGS(TestResource, (context->getGpu()));
- TestResource* b = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* a = new TestResource(context->getGpu());
+ TestResource* b = new TestResource(context->getGpu());
TestResource* c = TestResource::CreateScratch(context->getGpu(),
TestResource::kA_SimulatedProperty);
a->resourcePriv().setUniqueKey(key1);
@@ -939,9 +936,8 @@ static void test_cache_chained_purge(skiatest::Reporter* reporter) {
make_unique_key<0>(&key1, 1);
make_unique_key<0>(&key2, 2);
-
- TestResource* a = SkNEW_ARGS(TestResource, (context->getGpu()));
- TestResource* b = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* a = new TestResource(context->getGpu());
+ TestResource* b = new TestResource(context->getGpu());
a->resourcePriv().setUniqueKey(key1);
b->resourcePriv().setUniqueKey(key2);
@@ -978,11 +974,11 @@ static void test_resource_size_changed(skiatest::Reporter* reporter) {
GrContext* context = mock.context();
GrResourceCache* cache = mock.cache();
- TestResource* a = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* a = new TestResource(context->getGpu());
a->resourcePriv().setUniqueKey(key1);
a->unref();
- TestResource* b = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* b = new TestResource(context->getGpu());
b->resourcePriv().setUniqueKey(key2);
b->unref();
@@ -1007,12 +1003,12 @@ static void test_resource_size_changed(skiatest::Reporter* reporter) {
GrContext* context = mock.context();
GrResourceCache* cache = mock.cache();
- TestResource* a = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* a = new TestResource(context->getGpu());
a->setSize(100);
a->resourcePriv().setUniqueKey(key1);
a->unref();
- TestResource* b = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* b = new TestResource(context->getGpu());
b->setSize(100);
b->resourcePriv().setUniqueKey(key2);
b->unref();
@@ -1061,7 +1057,7 @@ static void test_timestamp_wrap(skiatest::Reporter* reporter) {
GrUniqueKey key;
make_unique_key<0>(&key, j);
- TestResource* r = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* r = new TestResource(context->getGpu());
r->resourcePriv().setUniqueKey(key);
if (random.nextU() % kLockedFreq) {
// Make this is purgeable.
@@ -1110,7 +1106,7 @@ static void test_flush(skiatest::Reporter* reporter) {
{
// Insert a resource and send a flush notification kFlushCount times.
for (int i = 0; i < kFlushCount; ++i) {
- TestResource* r = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* r = new TestResource(context->getGpu());
GrUniqueKey k;
make_unique_key<1>(&k, i);
r->resourcePriv().setUniqueKey(k);
@@ -1141,7 +1137,7 @@ static void test_flush(skiatest::Reporter* reporter) {
{
GrGpuResource* refedResources[kFlushCount >> 1];
for (int i = 0; i < kFlushCount; ++i) {
- TestResource* r = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* r = new TestResource(context->getGpu());
GrUniqueKey k;
make_unique_key<1>(&k, i);
r->resourcePriv().setUniqueKey(k);
@@ -1196,12 +1192,12 @@ static void test_large_resource_count(skiatest::Reporter* reporter) {
TestResource* resource;
- resource = SkNEW_ARGS(TestResource, (context->getGpu()));
+ resource = new TestResource(context->getGpu());
resource->resourcePriv().setUniqueKey(key1);
resource->setSize(1);
resource->unref();
- resource = SkNEW_ARGS(TestResource, (context->getGpu()));
+ resource = new TestResource(context->getGpu());
resource->resourcePriv().setUniqueKey(key2);
resource->setSize(1);
resource->unref();
diff --git a/tests/SkResourceCacheTest.cpp b/tests/SkResourceCacheTest.cpp
index bb12d667ee..58ab781725 100644
--- a/tests/SkResourceCacheTest.cpp
+++ b/tests/SkResourceCacheTest.cpp
@@ -97,10 +97,10 @@ DEF_TEST(BitmapCache_add_rect, reporter) {
SkAutoTDelete<SkResourceCache> cache;
if (factory) {
- cache.reset(SkNEW_ARGS(SkResourceCache, (factory)));
+ cache.reset(new SkResourceCache(factory));
} else {
const size_t byteLimit = 100 * 1024;
- cache.reset(SkNEW_ARGS(SkResourceCache, (byteLimit)));
+ cache.reset(new SkResourceCache(byteLimit));
}
SkBitmap cachedBitmap;
make_bitmap(&cachedBitmap, SkImageInfo::MakeN32Premul(5, 5), allocator);
@@ -243,10 +243,10 @@ DEF_TEST(BitmapCache_discarded_bitmap, reporter) {
SkAutoTDelete<SkResourceCache> cache;
if (factory) {
- cache.reset(SkNEW_ARGS(SkResourceCache, (factory)));
+ cache.reset(new SkResourceCache(factory));
} else {
const size_t byteLimit = 100 * 1024;
- cache.reset(SkNEW_ARGS(SkResourceCache, (byteLimit)));
+ cache.reset(new SkResourceCache(byteLimit));
}
SkBitmap cachedBitmap;
make_bitmap(&cachedBitmap, SkImageInfo::MakeN32Premul(5, 5), allocator);
diff --git a/tests/SkpSkGrTest.cpp b/tests/SkpSkGrTest.cpp
index 212b0f6abd..23cd30c0c1 100644
--- a/tests/SkpSkGrTest.cpp
+++ b/tests/SkpSkGrTest.cpp
@@ -164,7 +164,7 @@ public:
SkpSkGrThreadedTestRunner::~SkpSkGrThreadedTestRunner() {
for (int index = 0; index < fRunnables.count(); index++) {
- SkDELETE(fRunnables[index]);
+ delete fRunnables[index];
}
}
@@ -477,7 +477,7 @@ void TestResult::testOne() {
}
}
finish:
- SkDELETE(pic);
+ delete pic;
}
static SkString makeStatusString(int dirNo) {
@@ -705,8 +705,8 @@ DEF_TEST(SkpSkGrThreaded, reporter) {
goto skipOver;
}
}
- *testRunner.fRunnables.append() = SkNEW_ARGS(SkpSkGrThreadedRunnable,
- (&testSkGrMain, dirIndex, filename.c_str(), &testRunner));
+ *testRunner.fRunnables.append() = new SkpSkGrThreadedRunnable(
+ &testSkGrMain, dirIndex, filename.c_str(), &testRunner);
skipOver:
;
}
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index fac283d5b1..771fc9ea72 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -86,7 +86,7 @@ static void test_empty_image(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, NULL == SkImage::NewRasterCopy(info, NULL, 0));
REPORTER_ASSERT(reporter, NULL == SkImage::NewRasterData(info, NULL, 0));
REPORTER_ASSERT(reporter, NULL == SkImage::NewFromRaster(info, NULL, 0, NULL, NULL));
- REPORTER_ASSERT(reporter, NULL == SkImage::NewFromGenerator(SkNEW(EmptyGenerator)));
+ REPORTER_ASSERT(reporter, NULL == SkImage::NewFromGenerator(new EmptyGenerator));
}
static void test_empty_surface(skiatest::Reporter* reporter, GrContext* ctx) {
diff --git a/tests/SwizzlerTest.cpp b/tests/SwizzlerTest.cpp
index 7ed1c390fb..c2ae07c4c8 100644
--- a/tests/SwizzlerTest.cpp
+++ b/tests/SwizzlerTest.cpp
@@ -29,7 +29,7 @@ static void check_fill(skiatest::Reporter* r,
const size_t totalBytes = imageInfo.getSafeSize(rowBytes) + offset;
// Create fake image data where every byte has a value of 0
- SkAutoTDeleteArray<uint8_t> storage(SkNEW_ARRAY(uint8_t, totalBytes));
+ SkAutoTDeleteArray<uint8_t> storage(new uint8_t[totalBytes]);
memset(storage.get(), 0, totalBytes);
// Adjust the pointer in order to test on different memory alignments
uint8_t* imageData = storage.get() + offset;
diff --git a/tests/TArrayTest.cpp b/tests/TArrayTest.cpp
index 8c1e8e4532..6a9b5f5a81 100644
--- a/tests/TArrayTest.cpp
+++ b/tests/TArrayTest.cpp
@@ -61,12 +61,12 @@ static void TestTSet_basic(skiatest::Reporter* reporter) {
namespace {
SkTArray<int>* make() {
typedef SkTArray<int> IntArray;
- return SkNEW(IntArray);
+ return new IntArray;
}
template <int N> SkTArray<int>* make_s() {
typedef SkSTArray<N, int> IntArray;
- return SkNEW(IntArray);
+ return new IntArray;
}
}
@@ -97,14 +97,14 @@ static void test_swap(skiatest::Reporter* reporter) {
for (int i = 0; i < kSizes[dataSizeB]; ++i) {
REPORTER_ASSERT(reporter, curr++ == (*a)[i]);
}
- SkDELETE(b);
+ delete b;
a->swap(a);
curr = kSizes[dataSizeA];
for (int i = 0; i < kSizes[dataSizeB]; ++i) {
REPORTER_ASSERT(reporter, curr++ == (*a)[i]);
}
- SkDELETE(a);
+ delete a;
}
}
}
diff --git a/tests/TextBlobCacheTest.cpp b/tests/TextBlobCacheTest.cpp
index 6f67382a0f..cf2a2390b9 100644
--- a/tests/TextBlobCacheTest.cpp
+++ b/tests/TextBlobCacheTest.cpp
@@ -107,7 +107,7 @@ static void text_blob_cache_inner(skiatest::Reporter* reporter, GrContextFactory
if (normal) {
paint.setTypeface(orig);
} else {
- SkAutoTUnref<SkTypeface> typeface(SkNEW_ARGS(SkRandomTypeface, (orig, paint, true)));
+ SkAutoTUnref<SkTypeface> typeface(new SkRandomTypeface(orig, paint, true));
paint.setTypeface(typeface);
}
diff --git a/tests/skia_test.cpp b/tests/skia_test.cpp
index 150bf3beea..fbd35d081b 100644
--- a/tests/skia_test.cpp
+++ b/tests/skia_test.cpp
@@ -104,7 +104,7 @@ public:
}
fStatus->endTest(fTest.name, !reporter.fError, elapsed,
reporter.fTestCount);
- SkDELETE(this);
+ delete this;
}
private:
@@ -189,7 +189,7 @@ int test_main() {
} else if (test.needsGpu) {
gpuTests.push_back(&test);
} else {
- cpuTests.add(SkNEW_ARGS(SkTestRunnable, (test, &status)));
+ cpuTests.add(new SkTestRunnable(test, &status));
}
}
@@ -203,8 +203,7 @@ int test_main() {
// Run GPU tests on this thread.
for (int i = 0; i < gpuTests.count(); i++) {
- SkNEW_ARGS(SkTestRunnable, (*gpuTests[i], &status, grContextFactoryPtr))
- ->run();
+ (new SkTestRunnable(*gpuTests[i], &status, grContextFactoryPtr))->run();
}
// Block until threaded tests finish.