aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkBBHFactory.cpp2
-rw-r--r--src/core/SkBigPicture.cpp2
-rw-r--r--src/core/SkBitmap.cpp2
-rw-r--r--src/core/SkBitmapCache.cpp10
-rw-r--r--src/core/SkBitmapDevice.cpp2
-rw-r--r--src/core/SkBitmapFilter.cpp12
-rw-r--r--src/core/SkBitmapHeap.cpp10
-rw-r--r--src/core/SkBitmapProcShader.cpp10
-rw-r--r--src/core/SkBitmapScaler.cpp16
-rw-r--r--src/core/SkBlitter.cpp12
-rw-r--r--src/core/SkCachedData.cpp4
-rw-r--r--src/core/SkCanvas.cpp28
-rw-r--r--src/core/SkClipStack.cpp2
-rw-r--r--src/core/SkColorFilter.cpp2
-rw-r--r--src/core/SkComposeShader.cpp4
-rw-r--r--src/core/SkDataTable.cpp21
-rw-r--r--src/core/SkDevice.cpp4
-rw-r--r--src/core/SkDeviceProfile.cpp2
-rw-r--r--src/core/SkDraw.cpp4
-rw-r--r--src/core/SkError.cpp28
-rw-r--r--src/core/SkFilterShader.cpp4
-rw-r--r--src/core/SkFont.cpp2
-rw-r--r--src/core/SkFontDescriptor.cpp3
-rw-r--r--src/core/SkFontMgr.cpp8
-rw-r--r--[-rwxr-xr-x]src/core/SkGlyphCache.cpp22
-rw-r--r--src/core/SkGlyphCache_Globals.h2
-rw-r--r--src/core/SkImageCacherator.cpp10
-rw-r--r--src/core/SkImageFilter.cpp8
-rw-r--r--src/core/SkImageGeneratorPriv.h4
-rw-r--r--src/core/SkLayerInfo.h6
-rw-r--r--src/core/SkLightingShader.cpp24
-rw-r--r--src/core/SkLightingShader.h7
-rw-r--r--src/core/SkLocalMatrixShader.cpp2
-rw-r--r--src/core/SkMallocPixelRef.cpp17
-rw-r--r--src/core/SkMaskCache.cpp4
-rw-r--r--src/core/SkMatrixImageFilter.cpp2
-rw-r--r--src/core/SkMiniRecorder.cpp10
-rw-r--r--src/core/SkMipMap.cpp4
-rw-r--r--src/core/SkMultiPictureDraw.cpp4
-rw-r--r--src/core/SkPaint.cpp4
-rw-r--r--src/core/SkPathRef.cpp18
-rw-r--r--src/core/SkPicture.cpp2
-rw-r--r--src/core/SkPictureData.cpp26
-rw-r--r--src/core/SkPictureFlat.cpp6
-rw-r--r--src/core/SkPictureFlat.h8
-rw-r--r--src/core/SkPictureImageGenerator.cpp2
-rw-r--r--src/core/SkPictureRecorder.cpp31
-rw-r--r--src/core/SkPictureShader.cpp7
-rw-r--r--src/core/SkPixelRef.cpp2
-rw-r--r--src/core/SkRWBuffer.cpp10
-rw-r--r--src/core/SkRecordDraw.cpp8
-rw-r--r--src/core/SkRecorder.cpp16
-rw-r--r--src/core/SkResourceCache.cpp25
-rw-r--r--src/core/SkScalerContext.cpp3
-rw-r--r--src/core/SkSemaphore.cpp4
-rw-r--r--src/core/SkShader.cpp12
-rw-r--r--src/core/SkSmallAllocator.h10
-rw-r--r--src/core/SkStream.cpp25
-rw-r--r--src/core/SkTLList.h16
-rwxr-xr-xsrc/core/SkTLS.cpp4
-rw-r--r--src/core/SkTMultiMap.h10
-rw-r--r--src/core/SkTaskGroup.cpp8
-rw-r--r--src/core/SkTypeface.cpp8
-rw-r--r--src/core/SkXfermode.cpp2
-rw-r--r--src/core/SkYUVPlanesCache.cpp2
65 files changed, 261 insertions, 328 deletions
diff --git a/src/core/SkBBHFactory.cpp b/src/core/SkBBHFactory.cpp
index a4c7f4f81a..e8534cacb3 100644
--- a/src/core/SkBBHFactory.cpp
+++ b/src/core/SkBBHFactory.cpp
@@ -12,5 +12,5 @@
SkBBoxHierarchy* SkRTreeFactory::operator()(const SkRect& bounds) const {
SkScalar aspectRatio = bounds.width() / bounds.height();
- return SkNEW_ARGS(SkRTree, (aspectRatio));
+ return new SkRTree(aspectRatio);
}
diff --git a/src/core/SkBigPicture.cpp b/src/core/SkBigPicture.cpp
index bbe9882c2b..f7d6bd4215 100644
--- a/src/core/SkBigPicture.cpp
+++ b/src/core/SkBigPicture.cpp
@@ -57,7 +57,7 @@ void SkBigPicture::partialPlayback(SkCanvas* canvas,
}
const SkBigPicture::Analysis& SkBigPicture::analysis() const {
- auto create = [&]() { return SkNEW_ARGS(Analysis, (*fRecord)); };
+ auto create = [&]() { return new Analysis(*fRecord); };
return *fAnalysis.get(create);
}
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 97b0db6f20..03d1f4292b 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -1145,7 +1145,7 @@ bool SkBitmap::ReadRawPixels(SkReadBuffer* buffer, SkBitmap* bitmap) {
SkAutoTUnref<SkColorTable> ctable;
if (buffer->readBool()) {
- ctable.reset(SkNEW_ARGS(SkColorTable, (*buffer)));
+ ctable.reset(new SkColorTable(*buffer));
unsigned char maxIndex = ctable->count() ? ctable->count()-1 : 0;
for (uint64_t i = 0; i < ramSize; ++i) {
diff --git a/src/core/SkBitmapCache.cpp b/src/core/SkBitmapCache.cpp
index 08e3fdc71f..66075d4eae 100644
--- a/src/core/SkBitmapCache.cpp
+++ b/src/core/SkBitmapCache.cpp
@@ -115,8 +115,8 @@ void SkBitmapCache::Add(const SkBitmap& src, SkScalar invScaleX, SkScalar invSca
return;
}
SkASSERT(result.isImmutable());
- BitmapRec* rec = SkNEW_ARGS(BitmapRec, (src.getGenerationID(), invScaleX, invScaleY,
- get_bounds_from_bitmap(src), result));
+ BitmapRec* rec = new BitmapRec(src.getGenerationID(), invScaleX, invScaleY,
+ get_bounds_from_bitmap(src), result);
CHECK_LOCAL(localCache, add, Add, rec);
src.pixelRef()->notifyAddedToCache();
}
@@ -139,7 +139,7 @@ bool SkBitmapCache::Add(SkPixelRef* pr, const SkIRect& subset, const SkBitmap& r
|| result.height() != subset.height()) {
return false;
} else {
- BitmapRec* rec = SkNEW_ARGS(BitmapRec, (pr->getGenerationID(), 1, 1, subset, result));
+ BitmapRec* rec = new BitmapRec(pr->getGenerationID(), 1, 1, subset, result);
CHECK_LOCAL(localCache, add, Add, rec);
pr->notifyAddedToCache();
@@ -156,7 +156,7 @@ bool SkBitmapCache::Find(uint32_t genID, SkBitmap* result, SkResourceCache* loca
void SkBitmapCache::Add(uint32_t genID, const SkBitmap& result, SkResourceCache* localCache) {
SkASSERT(result.isImmutable());
- BitmapRec* rec = SkNEW_ARGS(BitmapRec, (genID, 1, 1, SkIRect::MakeEmpty(), result));
+ BitmapRec* rec = new BitmapRec(genID, 1, 1, SkIRect::MakeEmpty(), result);
CHECK_LOCAL(localCache, add, Add, rec);
}
@@ -235,7 +235,7 @@ static SkResourceCache::DiscardableFactory get_fact(SkResourceCache* localCache)
const SkMipMap* SkMipMapCache::AddAndRef(const SkBitmap& src, SkResourceCache* localCache) {
SkMipMap* mipmap = SkMipMap::Build(src, get_fact(localCache));
if (mipmap) {
- MipMapRec* rec = SkNEW_ARGS(MipMapRec, (src, mipmap));
+ MipMapRec* rec = new MipMapRec(src, mipmap);
CHECK_LOCAL(localCache, add, Add, rec);
src.pixelRef()->notifyAddedToCache();
}
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index dfe1756c4c..d4445fae9b 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -103,7 +103,7 @@ SkBitmapDevice* SkBitmapDevice::Create(const SkImageInfo& origInfo,
}
}
- return SkNEW_ARGS(SkBitmapDevice, (bitmap, surfaceProps));
+ return new SkBitmapDevice(bitmap, surfaceProps);
}
SkImageInfo SkBitmapDevice::imageInfo() const {
diff --git a/src/core/SkBitmapFilter.cpp b/src/core/SkBitmapFilter.cpp
index 8c44e9f1fd..4c1e9c68a3 100644
--- a/src/core/SkBitmapFilter.cpp
+++ b/src/core/SkBitmapFilter.cpp
@@ -20,17 +20,17 @@ SK_CONF_DECLARE(const char *, c_bitmapFilter, "bitmap.filter", "mitchell", "Whic
SkBitmapFilter *SkBitmapFilter::Allocate() {
if (!strcmp(c_bitmapFilter, "mitchell")) {
- return SkNEW_ARGS(SkMitchellFilter,(1.f/3.f,1.f/3.f));
+ return new SkMitchellFilter(1.f / 3.f, 1.f / 3.f);
} else if (!strcmp(c_bitmapFilter, "lanczos")) {
- return SkNEW(SkLanczosFilter);
+ return new SkLanczosFilter;
} else if (!strcmp(c_bitmapFilter, "hamming")) {
- return SkNEW(SkHammingFilter);
+ return new SkHammingFilter;
} else if (!strcmp(c_bitmapFilter, "gaussian")) {
- return SkNEW_ARGS(SkGaussianFilter,(2));
+ return new SkGaussianFilter(2);
} else if (!strcmp(c_bitmapFilter, "triangle")) {
- return SkNEW(SkTriangleFilter);
+ return new SkTriangleFilter;
} else if (!strcmp(c_bitmapFilter, "box")) {
- return SkNEW(SkBoxFilter);
+ return new SkBoxFilter;
} else {
SkDEBUGFAIL("Unknown filter type");
}
diff --git a/src/core/SkBitmapHeap.cpp b/src/core/SkBitmapHeap.cpp
index e1d3cae7e7..5b16d21e30 100644
--- a/src/core/SkBitmapHeap.cpp
+++ b/src/core/SkBitmapHeap.cpp
@@ -227,7 +227,7 @@ int SkBitmapHeap::findInLookupTable(const LookupEntry& indexEntry, SkBitmapHeapE
if (index < 0) {
// insert ourselves into the bitmapIndex
index = ~index;
- *fLookupTable.insert(index) = SkNEW_ARGS(LookupEntry, (indexEntry));
+ *fLookupTable.insert(index) = new LookupEntry(indexEntry);
} else if (entry != NULL) {
// populate the entry if needed
*entry = fStorage[fLookupTable[index]->fStorageSlot];
@@ -264,7 +264,7 @@ int SkBitmapHeap::removeEntryFromLookupTable(LookupEntry* entry) {
// a new entry to the lookup table.
SkASSERT(count == fLookupTable.count());
fBytesAllocated -= fStorage[entry->fStorageSlot]->fBytesAllocated;
- SkDELETE(fLookupTable[index]);
+ delete fLookupTable[index];
fLookupTable.remove(index);
return index;
}
@@ -317,7 +317,7 @@ int32_t SkBitmapHeap::insert(const SkBitmap& originalBitmap) {
fUnusedSlots.pop(&slot);
entry = fStorage[slot];
} else {
- entry = SkNEW(SkBitmapHeapEntry);
+ entry = new SkBitmapHeapEntry;
fStorage.append(1, &entry);
entry->fSlot = fStorage.count() - 1;
fBytesAllocated += sizeof(SkBitmapHeapEntry);
@@ -335,14 +335,14 @@ int32_t SkBitmapHeap::insert(const SkBitmap& originalBitmap) {
// if the copy failed then we must abort
if (!copySucceeded) {
// delete the index
- SkDELETE(fLookupTable[searchIndex]);
+ delete fLookupTable[searchIndex];
fLookupTable.remove(searchIndex);
// If entry is the last slot in storage, it is safe to delete it.
if (fStorage.count() - 1 == entry->fSlot) {
// free the slot
fStorage.remove(entry->fSlot);
fBytesAllocated -= sizeof(SkBitmapHeapEntry);
- SkDELETE(entry);
+ delete entry;
} else {
fUnusedSlots.push(entry->fSlot);
}
diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp
index 678a20164c..ef9cfd4dc8 100644
--- a/src/core/SkBitmapProcShader.cpp
+++ b/src/core/SkBitmapProcShader.cpp
@@ -79,7 +79,7 @@ SkShader::Context* SkBitmapProcShader::onCreateContext(const ContextRec& rec, vo
}
void* stateStorage = (char*)storage + sizeof(BitmapProcShaderContext);
- SkBitmapProcState* state = SkNEW_PLACEMENT(stateStorage, SkBitmapProcState);
+ SkBitmapProcState* state = new (stateStorage) SkBitmapProcState;
SkASSERT(state);
state->fTileModeX = fTileModeX;
@@ -90,7 +90,7 @@ SkShader::Context* SkBitmapProcShader::onCreateContext(const ContextRec& rec, vo
return NULL;
}
- return SkNEW_PLACEMENT_ARGS(storage, BitmapProcShaderContext, (*this, rec, state));
+ return new (storage) BitmapProcShaderContext(*this, rec, state);
}
size_t SkBitmapProcShader::contextSize() const {
@@ -302,19 +302,19 @@ SkShader* SkCreateBitmapShader(const SkBitmap& src, SkShader::TileMode tmx,
SkColor color;
if (src.isNull() || bitmap_is_too_big(src)) {
if (NULL == allocator) {
- shader = SkNEW(SkEmptyShader);
+ shader = new SkEmptyShader;
} else {
shader = allocator->createT<SkEmptyShader>();
}
} else if (can_use_color_shader(src, &color)) {
if (NULL == allocator) {
- shader = SkNEW_ARGS(SkColorShader, (color));
+ shader = new SkColorShader(color);
} else {
shader = allocator->createT<SkColorShader>(color);
}
} else {
if (NULL == allocator) {
- shader = SkNEW_ARGS(SkBitmapProcShader, (src, tmx, tmy, localMatrix));
+ shader = new SkBitmapProcShader(src, tmx, tmy, localMatrix);
} else {
shader = allocator->createT<SkBitmapProcShader>(src, tmx, tmy, localMatrix);
}
diff --git a/src/core/SkBitmapScaler.cpp b/src/core/SkBitmapScaler.cpp
index 6e253023fd..be7985732f 100644
--- a/src/core/SkBitmapScaler.cpp
+++ b/src/core/SkBitmapScaler.cpp
@@ -25,9 +25,7 @@ public:
float destWidth, float destHeight,
const SkRect& destSubset,
const SkConvolutionProcs& convolveProcs);
- ~SkResizeFilter() {
- SkDELETE( fBitmapFilter );
- }
+ ~SkResizeFilter() { delete fBitmapFilter; }
// Returns the filled filter values.
const SkConvolutionFilter1D& xFilter() { return fXFilter; }
@@ -70,23 +68,23 @@ SkResizeFilter::SkResizeFilter(SkBitmapScaler::ResizeMethod method,
switch(method) {
case SkBitmapScaler::RESIZE_BOX:
- fBitmapFilter = SkNEW(SkBoxFilter);
+ fBitmapFilter = new SkBoxFilter;
break;
case SkBitmapScaler::RESIZE_TRIANGLE:
- fBitmapFilter = SkNEW(SkTriangleFilter);
+ fBitmapFilter = new SkTriangleFilter;
break;
case SkBitmapScaler::RESIZE_MITCHELL:
- fBitmapFilter = SkNEW_ARGS(SkMitchellFilter, (1.f/3.f, 1.f/3.f));
+ fBitmapFilter = new SkMitchellFilter(1.f / 3.f, 1.f / 3.f);
break;
case SkBitmapScaler::RESIZE_HAMMING:
- fBitmapFilter = SkNEW(SkHammingFilter);
+ fBitmapFilter = new SkHammingFilter;
break;
case SkBitmapScaler::RESIZE_LANCZOS3:
- fBitmapFilter = SkNEW(SkLanczosFilter);
+ fBitmapFilter = new SkLanczosFilter;
break;
default:
// NOTREACHED:
- fBitmapFilter = SkNEW_ARGS(SkMitchellFilter, (1.f/3.f, 1.f/3.f));
+ fBitmapFilter = new SkMitchellFilter(1.f / 3.f, 1.f / 3.f);
break;
}
diff --git a/src/core/SkBlitter.cpp b/src/core/SkBlitter.cpp
index a932ba90b9..62cd73ee24 100644
--- a/src/core/SkBlitter.cpp
+++ b/src/core/SkBlitter.cpp
@@ -597,7 +597,7 @@ public:
return NULL;
}
}
- return SkNEW_PLACEMENT_ARGS(storage, Sk3DShaderContext, (*this, rec, proxyContext));
+ return new (storage) Sk3DShaderContext(*this, rec, proxyContext);
}
class Sk3DShaderContext : public SkShader::Context {
@@ -726,7 +726,7 @@ private:
SkFlattenable* Sk3DShader::CreateProc(SkReadBuffer& buffer) {
SkAutoTUnref<SkShader> shader(buffer.readShader());
- return SkNEW_ARGS(Sk3DShader, (shader));
+ return new Sk3DShader(shader);
}
class Sk3DBlitter : public SkBlitter {
@@ -800,7 +800,7 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
if (origPaint.getMaskFilter() != NULL &&
origPaint.getMaskFilter()->getFormat() == SkMask::k3D_Format) {
- shader3D = SkNEW_ARGS(Sk3DShader, (shader));
+ shader3D = new Sk3DShader(shader);
// we know we haven't initialized lazyPaint yet, so just do it
paint.writable()->setShader(shader3D)->unref();
shader = shader3D;
@@ -837,7 +837,7 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
if (NULL == shader) {
if (mode) {
// xfermodes (and filters) require shaders for our current blitters
- shader = SkNEW_ARGS(SkColorShader, (paint->getColor()));
+ shader = new SkColorShader(paint->getColor());
paint.writable()->setShader(shader)->unref();
paint.writable()->setAlpha(0xFF);
} else if (cf) {
@@ -852,7 +852,7 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
if (cf) {
SkASSERT(shader);
- shader = SkNEW_ARGS(SkFilterShader, (shader, cf));
+ shader = new SkFilterShader(shader, cf);
paint.writable()->setShader(shader)->unref();
// blitters should ignore the presence/absence of a filter, since
// if there is one, the shader will take care of it.
@@ -970,7 +970,7 @@ bool SkShaderBlitter::resetShaderContext(const SkShader::ContextRec& rec) {
if (NULL == ctx) {
// Need a valid context in fShaderContext's storage, so we can later (or our caller) call
// the in-place destructor.
- SkNEW_PLACEMENT_ARGS(fShaderContext, SkZeroShaderContext, (*fShader, rec));
+ new (fShaderContext) SkZeroShaderContext(*fShader, rec);
return false;
}
return true;
diff --git a/src/core/SkCachedData.cpp b/src/core/SkCachedData.cpp
index 16c4eea21a..439c2ffe05 100644
--- a/src/core/SkCachedData.cpp
+++ b/src/core/SkCachedData.cpp
@@ -57,7 +57,7 @@ SkCachedData::~SkCachedData() {
sk_free(fStorage.fMalloc);
break;
case kDiscardableMemory_StorageType:
- SkDELETE(fStorage.fDM);
+ delete fStorage.fDM;
break;
}
dec();
@@ -88,7 +88,7 @@ void SkCachedData::internalRef(bool fromCache) const {
void SkCachedData::internalUnref(bool fromCache) const {
if (AutoMutexWritable(this)->inMutexUnref(fromCache)) {
// can't delete inside doInternalUnref, since it is locking a mutex (which we own)
- SkDELETE(this);
+ delete this;
}
}
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index daf8425f57..03c5173e10 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -203,7 +203,7 @@ struct DeviceCM {
device->onAttachToCanvas(canvas);
}
fDevice = device;
- fPaint = paint ? SkNEW_ARGS(SkPaint, (*paint)) : NULL;
+ fPaint = paint ? new SkPaint(*paint) : NULL;
}
~DeviceCM() {
@@ -211,7 +211,7 @@ struct DeviceCM {
fDevice->onDetachFromCanvas();
fDevice->unref();
}
- SkDELETE(fPaint);
+ delete fPaint;
}
void reset(const SkIRect& bounds) {
@@ -304,7 +304,7 @@ public:
}
~MCRec() {
SkSafeUnref(fFilter);
- SkDELETE(fLayer);
+ delete fLayer;
dec_rec();
}
@@ -604,7 +604,7 @@ SkBaseDevice* SkCanvas::init(SkBaseDevice* device, InitFlags flags) {
fSaveCount = 1;
fMetaData = NULL;
- fClipStack.reset(SkNEW(SkClipStack));
+ fClipStack.reset(new SkClipStack);
fMCRec = (MCRec*)fMCStack.push_back();
new (fMCRec) MCRec(fConservativeRasterClip);
@@ -664,8 +664,8 @@ SkCanvas::SkCanvas(int width, int height, const SkSurfaceProps* props)
{
inc_canvas();
- this->init(SkNEW_ARGS(SkNoPixelsBitmapDevice,
- (SkIRect::MakeWH(width, height), fProps)), kDefault_InitFlags)->unref();
+ this->init(new SkNoPixelsBitmapDevice(SkIRect::MakeWH(width, height), fProps),
+ kDefault_InitFlags)->unref();
}
SkCanvas::SkCanvas(const SkIRect& bounds, InitFlags flags)
@@ -674,7 +674,7 @@ SkCanvas::SkCanvas(const SkIRect& bounds, InitFlags flags)
{
inc_canvas();
- this->init(SkNEW_ARGS(SkNoPixelsBitmapDevice, (bounds, fProps)), flags)->unref();
+ this->init(new SkNoPixelsBitmapDevice(bounds, fProps), flags)->unref();
}
SkCanvas::SkCanvas(SkBaseDevice* device)
@@ -701,7 +701,7 @@ SkCanvas::SkCanvas(const SkBitmap& bitmap, const SkSurfaceProps& props)
{
inc_canvas();
- SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (bitmap, fProps)));
+ SkAutoTUnref<SkBaseDevice> device(new SkBitmapDevice(bitmap, fProps));
this->init(device, kDefault_InitFlags);
}
@@ -711,7 +711,7 @@ SkCanvas::SkCanvas(const SkBitmap& bitmap)
{
inc_canvas();
- SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (bitmap, fProps)));
+ SkAutoTUnref<SkBaseDevice> device(new SkBitmapDevice(bitmap, fProps));
this->init(device, kDefault_InitFlags);
}
@@ -721,7 +721,7 @@ SkCanvas::~SkCanvas() {
this->internalRestore(); // restore the last, since we're going away
- SkDELETE(fMetaData);
+ delete fMetaData;
dec_canvas();
}
@@ -1135,8 +1135,8 @@ void SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint, Sav
}
device->setOrigin(ir.fLeft, ir.fTop);
- DeviceCM* layer = SkNEW_ARGS(DeviceCM, (device, paint, this, fConservativeRasterClip,
- forceSpriteOnRestore));
+ DeviceCM* layer =
+ new DeviceCM(device, paint, this, fConservativeRasterClip, forceSpriteOnRestore);
device->unref();
layer->fNext = fMCRec->fTopLayer;
@@ -1188,7 +1188,7 @@ void SkCanvas::internalRestore() {
layer->fPaint, layer->fDeviceIsBitmapDevice);
// reset this, since internalDrawDevice will have set it to true
fDeviceCMDirty = true;
- SkDELETE(layer);
+ delete layer;
} else {
// we're at the root
SkASSERT(layer == (void*)fDeviceCMStorage);
@@ -2876,7 +2876,7 @@ SkCanvas* SkCanvas::NewRasterDirect(const SkImageInfo& info, void* pixels, size_
if (!bitmap.installPixels(info, pixels, rowBytes)) {
return NULL;
}
- return SkNEW_ARGS(SkCanvas, (bitmap));
+ return new SkCanvas(bitmap);
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/SkClipStack.cpp b/src/core/SkClipStack.cpp
index c359e87f21..9541cc613f 100644
--- a/src/core/SkClipStack.cpp
+++ b/src/core/SkClipStack.cpp
@@ -711,7 +711,7 @@ void SkClipStack::pushElement(const Element& element) {
prior = (Element*) fDeque.back();
}
}
- Element* newElement = SkNEW_PLACEMENT_ARGS(fDeque.push_back(), Element, (element));
+ Element* newElement = new (fDeque.push_back()) Element(element);
newElement->updateBoundAndGenID(prior);
}
diff --git a/src/core/SkColorFilter.cpp b/src/core/SkColorFilter.cpp
index 9cbcc64017..e1670b8e73 100644
--- a/src/core/SkColorFilter.cpp
+++ b/src/core/SkColorFilter.cpp
@@ -132,7 +132,7 @@ SkColorFilter* SkColorFilter::CreateComposeFilter(SkColorFilter* outer, SkColorF
if (count > SK_MAX_COMPOSE_COLORFILTER_COUNT) {
return NULL;
}
- return SkNEW_ARGS(SkComposeColorFilter, (outer, inner, count));
+ return new SkComposeColorFilter(outer, inner, count);
}
SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkColorFilter)
diff --git a/src/core/SkComposeShader.cpp b/src/core/SkComposeShader.cpp
index c16d7ffc57..094dfdbc3d 100644
--- a/src/core/SkComposeShader.cpp
+++ b/src/core/SkComposeShader.cpp
@@ -60,7 +60,7 @@ SkFlattenable* SkComposeShader::CreateProc(SkReadBuffer& buffer) {
if (!shaderA.get() || !shaderB.get()) {
return NULL;
}
- return SkNEW_ARGS(SkComposeShader, (shaderA, shaderB, mode));
+ return new SkComposeShader(shaderA, shaderB, mode);
}
void SkComposeShader::flatten(SkWriteBuffer& buffer) const {
@@ -102,7 +102,7 @@ SkShader::Context* SkComposeShader::onCreateContext(const ContextRec& rec, void*
return NULL;
}
- return SkNEW_PLACEMENT_ARGS(storage, ComposeShaderContext, (*this, rec, contextA, contextB));
+ return new (storage) ComposeShaderContext(*this, rec, contextA, contextB);
}
SkComposeShader::ComposeShaderContext::ComposeShaderContext(
diff --git a/src/core/SkDataTable.cpp b/src/core/SkDataTable.cpp
index e2644a05c9..20bc430853 100644
--- a/src/core/SkDataTable.cpp
+++ b/src/core/SkDataTable.cpp
@@ -79,7 +79,7 @@ const void* SkDataTable::at(int index, size_t* size) const {
SkDataTable* SkDataTable::NewEmpty() {
static SkDataTable* gEmpty;
if (NULL == gEmpty) {
- gEmpty = SkNEW(SkDataTable);
+ gEmpty = new SkDataTable;
}
gEmpty->ref();
return gEmpty;
@@ -108,7 +108,7 @@ SkDataTable* SkDataTable::NewCopyArrays(const void * const * ptrs,
elem += sizes[i];
}
- return SkNEW_ARGS(SkDataTable, (dir, count, malloc_freeproc, buffer));
+ return new SkDataTable(dir, count, malloc_freeproc, buffer);
}
SkDataTable* SkDataTable::NewCopyArray(const void* array, size_t elemSize,
@@ -121,8 +121,7 @@ SkDataTable* SkDataTable::NewCopyArray(const void* array, size_t elemSize,
void* buffer = sk_malloc_throw(bufferSize);
memcpy(buffer, array, bufferSize);
- return SkNEW_ARGS(SkDataTable,
- (buffer, elemSize, count, malloc_freeproc, buffer));
+ return new SkDataTable(buffer, elemSize, count, malloc_freeproc, buffer);
}
SkDataTable* SkDataTable::NewArrayProc(const void* array, size_t elemSize,
@@ -130,14 +129,12 @@ SkDataTable* SkDataTable::NewArrayProc(const void* array, size_t elemSize,
if (count <= 0) {
return SkDataTable::NewEmpty();
}
- return SkNEW_ARGS(SkDataTable, (array, elemSize, count, proc, ctx));
+ return new SkDataTable(array, elemSize, count, proc, ctx);
}
///////////////////////////////////////////////////////////////////////////////
-static void chunkalloc_freeproc(void* context) {
- SkDELETE((SkChunkAlloc*)context);
-}
+static void chunkalloc_freeproc(void* context) { delete (SkChunkAlloc*)context; }
SkDataTableBuilder::SkDataTableBuilder(size_t minChunkSize)
: fHeap(NULL)
@@ -149,14 +146,14 @@ void SkDataTableBuilder::reset(size_t minChunkSize) {
fMinChunkSize = minChunkSize;
fDir.reset();
if (fHeap) {
- SkDELETE(fHeap);
+ delete fHeap;
fHeap = NULL;
}
}
void SkDataTableBuilder::append(const void* src, size_t size) {
if (NULL == fHeap) {
- fHeap = SkNEW_ARGS(SkChunkAlloc, (fMinChunkSize));
+ fHeap = new SkChunkAlloc(fMinChunkSize);
}
void* dst = fHeap->alloc(size, SkChunkAlloc::kThrow_AllocFailType);
@@ -178,9 +175,7 @@ SkDataTable* SkDataTableBuilder::detachDataTable() {
SkChunkAlloc::kThrow_AllocFailType);
memcpy(dir, fDir.begin(), count * sizeof(SkDataTable::Dir));
- SkDataTable* table = SkNEW_ARGS(SkDataTable,
- ((SkDataTable::Dir*)dir, count,
- chunkalloc_freeproc, fHeap));
+ SkDataTable* table = new SkDataTable((SkDataTable::Dir*)dir, count, chunkalloc_freeproc, fHeap);
// we have to detach our fHeap, since we are giving that to the table
fHeap = NULL;
fDir.reset();
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index b2cc0ddbc3..f8275fae93 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -30,9 +30,7 @@ SkBaseDevice::SkBaseDevice(const SkSurfaceProps& surfaceProps)
fMetaData = NULL;
}
-SkBaseDevice::~SkBaseDevice() {
- SkDELETE(fMetaData);
-}
+SkBaseDevice::~SkBaseDevice() { delete fMetaData; }
SkMetaData& SkBaseDevice::getMetaData() {
// metadata users are rare, so we lazily allocate it. If that changes we
diff --git a/src/core/SkDeviceProfile.cpp b/src/core/SkDeviceProfile.cpp
index 188e12b4b0..11d5c853f3 100644
--- a/src/core/SkDeviceProfile.cpp
+++ b/src/core/SkDeviceProfile.cpp
@@ -41,7 +41,7 @@ SkDeviceProfile* SkDeviceProfile::Create(float gammaExp,
float contrast,
LCDConfig config,
FontHintLevel level) {
- return SkNEW_ARGS(SkDeviceProfile, (gammaExp, contrast, config, level));
+ return new SkDeviceProfile(gammaExp, contrast, config, level);
}
SK_DECLARE_STATIC_MUTEX(gMutex);
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 2bd9abb289..6464d4a48c 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -1919,7 +1919,7 @@ public:
protected:
Context* onCreateContext(const ContextRec& rec, void* storage) const override {
- return SkNEW_PLACEMENT_ARGS(storage, TriColorShaderContext, (*this, rec));
+ return new (storage) TriColorShaderContext(*this, rec);
}
private:
@@ -2076,7 +2076,7 @@ void SkDraw::drawVertices(SkCanvas::VertexMode vmode, int count,
xmode = SkXfermode::Create(SkXfermode::kModulate_Mode);
releaseMode = true;
}
- composeShader.reset(SkNEW_ARGS(SkComposeShader, (&triShader, shader, xmode)));
+ composeShader.reset(new SkComposeShader(&triShader, shader, xmode));
p.setShader(composeShader);
if (releaseMode) {
xmode->unref();
diff --git a/src/core/SkError.cpp b/src/core/SkError.cpp
index 9e8ff2ddef..23db8ac1e4 100644
--- a/src/core/SkError.cpp
+++ b/src/core/SkError.cpp
@@ -15,43 +15,31 @@
#include <stdarg.h>
namespace {
- void *CreateThreadError() {
- return SkNEW_ARGS(SkError, (kNoError_SkError));
- }
- void DeleteThreadError(void* v) {
- SkDELETE(reinterpret_cast<SkError*>(v));
- }
+void *CreateThreadError() { return new SkError(kNoError_SkError); }
+void DeleteThreadError(void *v) { delete reinterpret_cast<SkError *>(v); }
#define THREAD_ERROR \
(*reinterpret_cast<SkError*>(SkTLS::Get(CreateThreadError, DeleteThreadError)))
void *CreateThreadErrorCallback() {
- return SkNEW_ARGS(SkErrorCallbackFunction, (SkErrorInternals::DefaultErrorCallback));
+ return new SkErrorCallbackFunction(SkErrorInternals::DefaultErrorCallback);
}
void DeleteThreadErrorCallback(void* v) {
- SkDELETE(reinterpret_cast<SkErrorCallbackFunction *>(v));
+ delete reinterpret_cast<SkErrorCallbackFunction *>(v);
}
#define THREAD_ERROR_CALLBACK \
*(reinterpret_cast<SkErrorCallbackFunction *>(SkTLS::Get(CreateThreadErrorCallback, \
DeleteThreadErrorCallback)))
- void *CreateThreadErrorContext() {
- return SkNEW_ARGS(void **, (NULL));
- }
- void DeleteThreadErrorContext(void* v) {
- SkDELETE(reinterpret_cast<void **>(v));
- }
+ void *CreateThreadErrorContext() { return new void **(NULL); }
+ void DeleteThreadErrorContext(void *v) { delete reinterpret_cast<void **>(v); }
#define THREAD_ERROR_CONTEXT \
(*reinterpret_cast<void **>(SkTLS::Get(CreateThreadErrorContext, DeleteThreadErrorContext)))
#define ERROR_STRING_LENGTH 2048
- void *CreateThreadErrorString() {
- return SkNEW_ARRAY(char, (ERROR_STRING_LENGTH));
- }
- void DeleteThreadErrorString(void* v) {
- SkDELETE_ARRAY(reinterpret_cast<char *>(v));
- }
+ void *CreateThreadErrorString() { return new char[(ERROR_STRING_LENGTH)]; }
+ void DeleteThreadErrorString(void *v) { delete[] reinterpret_cast<char *>(v); }
#define THREAD_ERROR_STRING \
(reinterpret_cast<char *>(SkTLS::Get(CreateThreadErrorString, DeleteThreadErrorString)))
}
diff --git a/src/core/SkFilterShader.cpp b/src/core/SkFilterShader.cpp
index a10a7c9d77..d972489774 100644
--- a/src/core/SkFilterShader.cpp
+++ b/src/core/SkFilterShader.cpp
@@ -32,7 +32,7 @@ SkFlattenable* SkFilterShader::CreateProc(SkReadBuffer& buffer) {
if (!shader.get() || !filter.get()) {
return NULL;
}
- return SkNEW_ARGS(SkFilterShader, (shader, filter));
+ return new SkFilterShader(shader, filter);
}
void SkFilterShader::flatten(SkWriteBuffer& buffer) const {
@@ -62,7 +62,7 @@ SkShader::Context* SkFilterShader::onCreateContext(const ContextRec& rec, void*
if (NULL == shaderContext) {
return NULL;
}
- return SkNEW_PLACEMENT_ARGS(storage, FilterShaderContext, (*this, shaderContext, rec));
+ return new (storage) FilterShaderContext(*this, shaderContext, rec);
}
size_t SkFilterShader::contextSize() const {
diff --git a/src/core/SkFont.cpp b/src/core/SkFont.cpp
index dcc2f0bf67..d6895a480b 100644
--- a/src/core/SkFont.cpp
+++ b/src/core/SkFont.cpp
@@ -40,7 +40,7 @@ SkFont* SkFont::Create(SkTypeface* face, SkScalar size, SkScalar scaleX, SkScala
return NULL;
}
flags &= kAllFlags;
- return SkNEW_ARGS(SkFont, (face, size, scaleX, skewX, mt, flags));
+ return new SkFont(face, size, scaleX, skewX, mt, flags);
}
SkFont* SkFont::Create(SkTypeface* face, SkScalar size, MaskType mt, uint32_t flags) {
diff --git a/src/core/SkFontDescriptor.cpp b/src/core/SkFontDescriptor.cpp
index cb149b98a9..8348d5fdba 100644
--- a/src/core/SkFontDescriptor.cpp
+++ b/src/core/SkFontDescriptor.cpp
@@ -98,8 +98,7 @@ SkFontDescriptor::SkFontDescriptor(SkStream* stream) {
if (length > 0) {
SkAutoTUnref<SkData> data(SkData::NewUninitialized(length));
if (stream->read(data->writable_data(), length) == length) {
- fFontData.reset(new SkFontData(SkNEW_ARGS(SkMemoryStream, (data)), index,
- axis, axisCount));
+ fFontData.reset(new SkFontData(new SkMemoryStream(data), index, axis, axisCount));
}
}
}
diff --git a/src/core/SkFontMgr.cpp b/src/core/SkFontMgr.cpp
index 33da1db376..35ad6c39f7 100644
--- a/src/core/SkFontMgr.cpp
+++ b/src/core/SkFontMgr.cpp
@@ -29,9 +29,7 @@ public:
}
};
-SkFontStyleSet* SkFontStyleSet::CreateEmpty() {
- return SkNEW(SkEmptyFontStyleSet);
-}
+SkFontStyleSet* SkFontStyleSet::CreateEmpty() { return new SkEmptyFontStyleSet; }
///////////////////////////////////////////////////////////////////////////////
@@ -70,7 +68,7 @@ protected:
return NULL;
}
SkTypeface* onCreateFromStream(SkStreamAsset* stream, int) const override {
- SkDELETE(stream);
+ delete stream;
return NULL;
}
SkTypeface* onCreateFromFile(const char[], int) const override {
@@ -163,7 +161,7 @@ SkTypeface* SkFontMgr::legacyCreateTypeface(const char familyName[],
// As a template argument this must have external linkage.
SkFontMgr* sk_fontmgr_create_default() {
SkFontMgr* fm = SkFontMgr::Factory();
- return fm ? fm : SkNEW(SkEmptyFontMgr);
+ return fm ? fm : new SkEmptyFontMgr;
}
SK_DECLARE_STATIC_LAZY_PTR(SkFontMgr, singleton, sk_fontmgr_create_default);
diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp
index e719c00b83..ff52004128 100755..100644
--- a/src/core/SkGlyphCache.cpp
+++ b/src/core/SkGlyphCache.cpp
@@ -17,9 +17,7 @@
namespace {
-SkGlyphCache_Globals* create_globals() {
- return SkNEW(SkGlyphCache_Globals);
-}
+SkGlyphCache_Globals* create_globals() { return new SkGlyphCache_Globals; }
} // namespace
@@ -55,13 +53,9 @@ SkGlyphCache::SkGlyphCache(SkTypeface* typeface, const SkDescriptor* desc, SkSca
}
SkGlyphCache::~SkGlyphCache() {
- fGlyphMap.foreach(
- [](SkGlyph* g) {
- SkDELETE(g->fPath);
- }
- );
+ fGlyphMap.foreach ([](SkGlyph* g) { delete g->fPath; });
SkDescriptor::Free(fDesc);
- SkDELETE(fScalerContext);
+ delete fScalerContext;
this->invokeAndRemoveAuxProcs();
}
@@ -221,7 +215,7 @@ const void* SkGlyphCache::findImage(const SkGlyph& glyph) {
const SkPath* SkGlyphCache::findPath(const SkGlyph& glyph) {
if (glyph.fWidth) {
if (glyph.fPath == NULL) {
- const_cast<SkGlyph&>(glyph).fPath = SkNEW(SkPath);
+ const_cast<SkGlyph&>(glyph).fPath = new SkPath;
fScalerContext->getPath(glyph, glyph.fPath);
fMemoryUsed += sizeof(SkPath) +
glyph.fPath->countPoints() * sizeof(SkPoint);
@@ -279,7 +273,7 @@ void SkGlyphCache::setAuxProc(void (*proc)(void*), void* data) {
rec = rec->fNext;
}
// not found, create a new rec
- rec = SkNEW(AuxProcRec);
+ rec = new AuxProcRec;
rec->fProc = proc;
rec->fData = data;
rec->fNext = fAuxProcList;
@@ -291,7 +285,7 @@ void SkGlyphCache::invokeAndRemoveAuxProcs() {
while (rec) {
rec->fProc(rec->fData);
AuxProcRec* next = rec->fNext;
- SkDELETE(rec);
+ delete rec;
rec = next;
}
}
@@ -387,7 +381,7 @@ SkGlyphCache* SkGlyphCache::VisitCache(SkTypeface* typeface,
ctx = typeface->createScalerContext(desc, false);
SkASSERT(ctx);
}
- cache = SkNEW_ARGS(SkGlyphCache, (typeface, desc, ctx));
+ cache = new SkGlyphCache(typeface, desc, ctx);
}
AutoValidate av(cache);
@@ -502,7 +496,7 @@ size_t SkGlyphCache_Globals::internalPurge(size_t minBytesNeeded) {
countFreed += 1;
this->internalDetachCache(cache);
- SkDELETE(cache);
+ delete cache;
cache = prev;
}
diff --git a/src/core/SkGlyphCache_Globals.h b/src/core/SkGlyphCache_Globals.h
index 8e0ceb55c4..70d80208d4 100644
--- a/src/core/SkGlyphCache_Globals.h
+++ b/src/core/SkGlyphCache_Globals.h
@@ -37,7 +37,7 @@ public:
SkGlyphCache* cache = fHead;
while (cache) {
SkGlyphCache* next = cache->fNext;
- SkDELETE(cache);
+ delete cache;
cache = next;
}
}
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp
index 863cc11b1d..a65e8fccbd 100644
--- a/src/core/SkImageCacherator.cpp
+++ b/src/core/SkImageCacherator.cpp
@@ -45,10 +45,8 @@ SkImageCacherator* SkImageCacherator::NewFromGenerator(SkImageGenerator* gen,
subset = &bounds;
}
- return SkNEW_ARGS(SkImageCacherator, (gen,
- gen->getInfo().makeWH(subset->width(), subset->height()),
- SkIPoint::Make(subset->x(), subset->y()),
- uniqueID));
+ return new SkImageCacherator(gen, gen->getInfo().makeWH(subset->width(), subset->height()),
+ SkIPoint::Make(subset->x(), subset->y()), uniqueID);
}
SkImageCacherator::SkImageCacherator(SkImageGenerator* gen, const SkImageInfo& info,
@@ -59,9 +57,7 @@ SkImageCacherator::SkImageCacherator(SkImageGenerator* gen, const SkImageInfo& i
, fUniqueID(uniqueID)
{}
-SkImageCacherator::~SkImageCacherator() {
- SkDELETE(fGenerator);
-}
+SkImageCacherator::~SkImageCacherator() { delete fGenerator; }
static bool check_output_bitmap(const SkBitmap& bitmap, uint32_t expectedID) {
SkASSERT(bitmap.getGenerationID() == expectedID);
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 5157db2dc9..0a46cb3ce4 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -204,7 +204,7 @@ SkImageFilter::SkImageFilter(int inputCount, SkReadBuffer& buffer)
if (common.unflatten(buffer, inputCount)) {
fCropRect = common.cropRect();
fInputCount = common.inputCount();
- fInputs = SkNEW_ARRAY(SkImageFilter*, fInputCount);
+ fInputs = new SkImageFilter* [fInputCount];
common.detachInputs(fInputs);
for (int i = 0; i < fInputCount; ++i) {
if (NULL == fInputs[i] || fInputs[i]->usesSrcInput()) {
@@ -444,7 +444,7 @@ SkImageFilter* SkImageFilter::CreateMatrixFilter(const SkMatrix& matrix,
void SkImageFilter::WrapTexture(GrTexture* texture, int width, int height, SkBitmap* result) {
SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
result->setInfo(info);
- result->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref();
+ result->setPixelRef(new SkGrPixelRef(info, texture))->unref();
}
bool SkImageFilter::getInputResultGPU(SkImageFilter::Proxy* proxy,
@@ -465,7 +465,7 @@ bool SkImageFilter::getInputResultGPU(SkImageFilter::Proxy* proxy,
return false;
}
SkAutoTUnref<GrTexture> resultTex(GrRefCachedBitmapTexture(context, *result, NULL));
- result->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, resultTex)))->unref();
+ result->setPixelRef(new SkGrPixelRef(info, resultTex))->unref();
}
return true;
} else {
@@ -567,7 +567,7 @@ SkImageFilter::Cache* CreateCache() {
} // namespace
SkImageFilter::Cache* SkImageFilter::Cache::Create(size_t maxBytes) {
- return SkNEW_ARGS(CacheImpl, (maxBytes));
+ return new CacheImpl(maxBytes);
}
SK_DECLARE_STATIC_LAZY_PTR(SkImageFilter::Cache, cache, CreateCache);
diff --git a/src/core/SkImageGeneratorPriv.h b/src/core/SkImageGeneratorPriv.h
index e55f43df8b..5d018bcb79 100644
--- a/src/core/SkImageGeneratorPriv.h
+++ b/src/core/SkImageGeneratorPriv.h
@@ -21,8 +21,8 @@
*
* If this fails or when the SkDiscardablePixelRef that is
* installed into destination is destroyed, it will call
- * SkDELETE() on the generator. Therefore, generator should be
- * allocated with SkNEW() or SkNEW_ARGS().
+ * `delete` on the generator. Therefore, generator should be
+ * allocated with `new`.
*
* @param destination Upon success, this bitmap will be
* configured and have a pixelref installed.
diff --git a/src/core/SkLayerInfo.h b/src/core/SkLayerInfo.h
index 54c4f7b705..5d598ef50a 100644
--- a/src/core/SkLayerInfo.h
+++ b/src/core/SkLayerInfo.h
@@ -19,7 +19,11 @@ public:
class BlockInfo {
public:
BlockInfo() : fPicture(NULL), fPaint(NULL), fKey(NULL), fKeySize(0) {}
- ~BlockInfo() { SkSafeUnref(fPicture); SkDELETE(fPaint); SkDELETE_ARRAY(fKey); }
+ ~BlockInfo() {
+ SkSafeUnref(fPicture);
+ delete fPaint;
+ delete[] fKey;
+ }
// The picture owning the layer. If the owning picture is the top-most
// one (i.e., the picture for which this SkLayerInfo was created) then
diff --git a/src/core/SkLightingShader.cpp b/src/core/SkLightingShader.cpp
index 3b2e062f37..0e20db44de 100644
--- a/src/core/SkLightingShader.cpp
+++ b/src/core/SkLightingShader.cpp
@@ -291,7 +291,7 @@ public:
const SkVector& invNormRotation() const { return fInvNormRotation; }
private:
- GrGLFragmentProcessor* onCreateGLInstance() const override { return SkNEW(LightingGLFP); }
+ GrGLFragmentProcessor* onCreateGLInstance() const override { return new LightingGLFP; }
bool onIsEqual(const GrFragmentProcessor& proc) const override {
const LightingFP& lightingFP = proc.cast<LightingFP>();
@@ -393,10 +393,8 @@ bool SkLightingShaderImpl::asFragmentProcessor(GrContext* context, const SkPaint
return false;
}
-
- *fp = SkNEW_ARGS(LightingFP, (pdm, diffuseTexture, normalTexture,
- diffM, normM, diffParams, normParams, fLights,
- fInvNormRotation));
+ *fp = new LightingFP(pdm, diffuseTexture, normalTexture, diffM, normM, diffParams, normParams,
+ fLights, fInvNormRotation);
*color = GrColorPackA4(paint.getAlpha());
return true;
@@ -615,9 +613,8 @@ SkFlattenable* SkLightingShaderImpl::CreateProc(SkReadBuffer& buf) {
SkAutoTUnref<const SkLightingShader::Lights> lights(builder.finish());
- return SkNEW_ARGS(SkLightingShaderImpl, (diffuse, normal, lights,
- SkVector::Make(1.0f, 0.0f),
- &diffLocalM, &normLocalM));
+ return new SkLightingShaderImpl(diffuse, normal, lights, SkVector::Make(1.0f, 0.0f),
+ &diffLocalM, &normLocalM);
}
void SkLightingShaderImpl::flatten(SkWriteBuffer& buf) const {
@@ -672,7 +669,7 @@ SkShader::Context* SkLightingShaderImpl::onCreateContext(const ContextRec& rec,
}
void* diffuseStateStorage = (char*)storage + sizeof(LightingShaderContext);
- SkBitmapProcState* diffuseState = SkNEW_PLACEMENT(diffuseStateStorage, SkBitmapProcState);
+ SkBitmapProcState* diffuseState = new (diffuseStateStorage) SkBitmapProcState;
SkASSERT(diffuseState);
diffuseState->fTileModeX = SkShader::kClamp_TileMode;
@@ -684,7 +681,7 @@ SkShader::Context* SkLightingShaderImpl::onCreateContext(const ContextRec& rec,
}
void* normalStateStorage = (char*)storage + sizeof(LightingShaderContext) + sizeof(SkBitmapProcState);
- SkBitmapProcState* normalState = SkNEW_PLACEMENT(normalStateStorage, SkBitmapProcState);
+ SkBitmapProcState* normalState = new (normalStateStorage) SkBitmapProcState;
SkASSERT(normalState);
normalState->fTileModeX = SkShader::kClamp_TileMode;
@@ -696,8 +693,7 @@ SkShader::Context* SkLightingShaderImpl::onCreateContext(const ContextRec& rec,
return NULL;
}
- return SkNEW_PLACEMENT_ARGS(storage, LightingShaderContext, (*this, rec,
- diffuseState, normalState));
+ return new (storage) LightingShaderContext(*this, rec, diffuseState, normalState);
}
///////////////////////////////////////////////////////////////////////////////
@@ -725,8 +721,8 @@ SkShader* SkLightingShader::Create(const SkBitmap& diffuse, const SkBitmap& norm
SkASSERT(SkScalarNearlyEqual(invNormRotation.lengthSqd(), SK_Scalar1));
- return SkNEW_ARGS(SkLightingShaderImpl, (diffuse, normal, lights,
- invNormRotation, diffLocalM, normLocalM));
+ return new SkLightingShaderImpl(diffuse, normal, lights, invNormRotation, diffLocalM,
+ normLocalM);
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/SkLightingShader.h b/src/core/SkLightingShader.h
index 499e358238..d28648767d 100644
--- a/src/core/SkLightingShader.h
+++ b/src/core/SkLightingShader.h
@@ -25,11 +25,10 @@ public:
class Builder {
public:
Builder(const SkLight lights[], int numLights)
- : fLights(SkNEW_ARGS(Lights, (lights, numLights))) {
- }
+ : fLights(new Lights(lights, numLights)) {}
+
+ Builder() : fLights(new Lights) {}
- Builder() : fLights(SkNEW(Lights)) { }
-
// TODO: limit the number of lights here or just ignore those
// above some maximum?
void add(const SkLight& light) {
diff --git a/src/core/SkLocalMatrixShader.cpp b/src/core/SkLocalMatrixShader.cpp
index 544ad2fe4c..b9a0960873 100644
--- a/src/core/SkLocalMatrixShader.cpp
+++ b/src/core/SkLocalMatrixShader.cpp
@@ -66,5 +66,5 @@ SkShader* SkShader::CreateLocalMatrixShader(SkShader* proxy, const SkMatrix& loc
proxy = otherProxy.get();
}
- return SkNEW_ARGS(SkLocalMatrixShader, (proxy, *lm));
+ return new SkLocalMatrixShader(proxy, *lm);
}
diff --git a/src/core/SkMallocPixelRef.cpp b/src/core/SkMallocPixelRef.cpp
index 12aa1f63d6..491651080b 100644
--- a/src/core/SkMallocPixelRef.cpp
+++ b/src/core/SkMallocPixelRef.cpp
@@ -44,8 +44,7 @@ SkMallocPixelRef* SkMallocPixelRef::NewDirect(const SkImageInfo& info,
if (!is_valid(info, ctable)) {
return NULL;
}
- return SkNEW_ARGS(SkMallocPixelRef,
- (info, addr, rowBytes, ctable, NULL, NULL));
+ return new SkMallocPixelRef(info, addr, rowBytes, ctable, NULL, NULL);
}
@@ -84,9 +83,7 @@ SkMallocPixelRef* SkMallocPixelRef::NewAllocate(const SkImageInfo& info,
return NULL;
}
- return SkNEW_ARGS(SkMallocPixelRef,
- (info, addr, rowBytes, ctable,
- sk_free_releaseproc, NULL));
+ return new SkMallocPixelRef(info, addr, rowBytes, ctable, sk_free_releaseproc, NULL);
}
SkMallocPixelRef* SkMallocPixelRef::NewWithProc(const SkImageInfo& info,
@@ -98,8 +95,7 @@ SkMallocPixelRef* SkMallocPixelRef::NewWithProc(const SkImageInfo& info,
if (!is_valid(info, ctable)) {
return NULL;
}
- return SkNEW_ARGS(SkMallocPixelRef,
- (info, addr, rowBytes, ctable, proc, context));
+ return new SkMallocPixelRef(info, addr, rowBytes, ctable, proc, context);
}
static void sk_data_releaseproc(void*, void* dataPtr) {
@@ -119,10 +115,9 @@ SkMallocPixelRef* SkMallocPixelRef::NewWithData(const SkImageInfo& info,
return NULL;
}
data->ref();
- SkMallocPixelRef* pr
- = SkNEW_ARGS(SkMallocPixelRef,
- (info, const_cast<void*>(data->data()), rowBytes, ctable,
- sk_data_releaseproc, static_cast<void*>(data)));
+ SkMallocPixelRef* pr =
+ new SkMallocPixelRef(info, const_cast<void*>(data->data()), rowBytes, ctable,
+ sk_data_releaseproc, static_cast<void*>(data));
SkASSERT(pr != NULL);
// We rely on the immutability of the pixels to make the
// const_cast okay.
diff --git a/src/core/SkMaskCache.cpp b/src/core/SkMaskCache.cpp
index 7dc4e4e3b8..cc729c3bbb 100644
--- a/src/core/SkMaskCache.cpp
+++ b/src/core/SkMaskCache.cpp
@@ -91,7 +91,7 @@ void SkMaskCache::Add(SkScalar sigma, SkBlurStyle style, SkBlurQuality quality,
const SkRRect& rrect, const SkMask& mask, SkCachedData* data,
SkResourceCache* localCache) {
RRectBlurKey key(sigma, rrect, style, quality);
- return CHECK_LOCAL(localCache, add, Add, SkNEW_ARGS(RRectBlurRec, (key, mask, data)));
+ return CHECK_LOCAL(localCache, add, Add, new RRectBlurRec(key, mask, data));
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -187,5 +187,5 @@ void SkMaskCache::Add(SkScalar sigma, SkBlurStyle style, SkBlurQuality quality,
const SkRect rects[], int count, const SkMask& mask, SkCachedData* data,
SkResourceCache* localCache) {
RectsBlurKey key(sigma, style, quality, rects, count);
- return CHECK_LOCAL(localCache, add, Add, SkNEW_ARGS(RectsBlurRec, (key, mask, data)));
+ return CHECK_LOCAL(localCache, add, Add, new RectsBlurRec(key, mask, data));
}
diff --git a/src/core/SkMatrixImageFilter.cpp b/src/core/SkMatrixImageFilter.cpp
index a61867e041..b6f6fc8a43 100644
--- a/src/core/SkMatrixImageFilter.cpp
+++ b/src/core/SkMatrixImageFilter.cpp
@@ -26,7 +26,7 @@ SkMatrixImageFilter::SkMatrixImageFilter(const SkMatrix& transform,
SkMatrixImageFilter* SkMatrixImageFilter::Create(const SkMatrix& transform,
SkFilterQuality filterQuality,
SkImageFilter* input) {
- return SkNEW_ARGS(SkMatrixImageFilter, (transform, filterQuality, input));
+ return new SkMatrixImageFilter(transform, filterQuality, input);
}
SkFlattenable* SkMatrixImageFilter::CreateProc(SkReadBuffer& buffer) {
diff --git a/src/core/SkMiniRecorder.cpp b/src/core/SkMiniRecorder.cpp
index df40fa45e7..5161c64722 100644
--- a/src/core/SkMiniRecorder.cpp
+++ b/src/core/SkMiniRecorder.cpp
@@ -62,7 +62,7 @@ SkMiniRecorder::~SkMiniRecorder() {
if (fState != State::kEmpty) {
// We have internal state pending.
// Detaching then deleting a picture is an easy way to clean up.
- SkDELETE(this->detachAsPicture(SkRect::MakeEmpty()));
+ delete this->detachAsPicture(SkRect::MakeEmpty());
}
SkASSERT(fState == State::kEmpty);
}
@@ -102,10 +102,10 @@ bool SkMiniRecorder::drawTextBlob(const SkTextBlob* b, SkScalar x, SkScalar y, c
SkPicture* SkMiniRecorder::detachAsPicture(const SkRect& cull) {
-#define CASE(Type) \
- case State::k##Type: \
- fState = State::kEmpty; \
- return SkNEW_ARGS(SkMiniPicture<Type>, (cull, reinterpret_cast<Type*>(fBuffer.get())))
+#define CASE(Type) \
+ case State::k##Type: \
+ fState = State::kEmpty; \
+ return new SkMiniPicture<Type>(cull, reinterpret_cast<Type*>(fBuffer.get()))
switch (fState) {
case State::kEmpty: return SkRef(gEmptyPicture.get());
diff --git a/src/core/SkMipMap.cpp b/src/core/SkMipMap.cpp
index 032a60d0f1..8a62f88ab2 100644
--- a/src/core/SkMipMap.cpp
+++ b/src/core/SkMipMap.cpp
@@ -250,9 +250,9 @@ SkMipMap* SkMipMap::Build(const SkBitmap& src, SkDiscardableFactoryProc fact) {
if (NULL == dm) {
return NULL;
}
- mipmap = SkNEW_ARGS(SkMipMap, (storageSize, dm));
+ mipmap = new SkMipMap(storageSize, dm);
} else {
- mipmap = SkNEW_ARGS(SkMipMap, (sk_malloc_throw(storageSize), storageSize));
+ mipmap = new SkMipMap(sk_malloc_throw(storageSize), storageSize);
}
// init
diff --git a/src/core/SkMultiPictureDraw.cpp b/src/core/SkMultiPictureDraw.cpp
index 286d3b6489..8cbb9ca60f 100644
--- a/src/core/SkMultiPictureDraw.cpp
+++ b/src/core/SkMultiPictureDraw.cpp
@@ -35,7 +35,7 @@ void SkMultiPictureDraw::DrawData::init(SkCanvas* canvas, const SkPicture* pictu
fMatrix.setIdentity();
}
if (paint) {
- fPaint = SkNEW_ARGS(SkPaint, (*paint));
+ fPaint = new SkPaint(*paint);
} else {
fPaint = NULL;
}
@@ -45,7 +45,7 @@ void SkMultiPictureDraw::DrawData::Reset(SkTDArray<DrawData>& data) {
for (int i = 0; i < data.count(); ++i) {
data[i].fPicture->unref();
data[i].fCanvas->unref();
- SkDELETE(data[i].fPaint);
+ delete data[i].fPaint;
}
data.rewind();
}
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 4400994000..7fd0b9d227 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -1511,13 +1511,13 @@ static const SkMaskGamma& cachedMaskGamma(SkScalar contrast, SkScalar paintGamma
gMaskGammaCacheMutex.assertHeld();
if (0 == contrast && SK_Scalar1 == paintGamma && SK_Scalar1 == deviceGamma) {
if (NULL == gLinearMaskGamma) {
- gLinearMaskGamma = SkNEW(SkMaskGamma);
+ gLinearMaskGamma = new SkMaskGamma;
}
return *gLinearMaskGamma;
}
if (gContrast != contrast || gPaintGamma != paintGamma || gDeviceGamma != deviceGamma) {
SkSafeUnref(gMaskGamma);
- gMaskGamma = SkNEW_ARGS(SkMaskGamma, (contrast, paintGamma, deviceGamma));
+ gMaskGamma = new SkMaskGamma(contrast, paintGamma, deviceGamma);
gContrast = contrast;
gPaintGamma = paintGamma;
gDeviceGamma = deviceGamma;
diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp
index 38b4e71cba..e3317a6e75 100644
--- a/src/core/SkPathRef.cpp
+++ b/src/core/SkPathRef.cpp
@@ -18,7 +18,7 @@ SkPathRef::Editor::Editor(SkAutoTUnref<SkPathRef>* pathRef,
if ((*pathRef)->unique()) {
(*pathRef)->incReserve(incReserveVerbs, incReservePoints);
} else {
- SkPathRef* copy = SkNEW(SkPathRef);
+ SkPathRef* copy = new SkPathRef;
copy->copy(**pathRef, incReserveVerbs, incReservePoints);
pathRef->reset(copy);
}
@@ -46,7 +46,7 @@ SkPathRef::~SkPathRef() {
// As a template argument, this must have external linkage.
SkPathRef* sk_create_empty_pathref() {
- SkPathRef* empty = SkNEW(SkPathRef);
+ SkPathRef* empty = new SkPathRef;
empty->computeBounds(); // Avoids races later to be the first to do this.
return empty;
}
@@ -71,7 +71,7 @@ void SkPathRef::CreateTransformedCopy(SkAutoTUnref<SkPathRef>* dst,
}
if (!(*dst)->unique()) {
- dst->reset(SkNEW(SkPathRef));
+ dst->reset(new SkPathRef);
}
if (*dst != &src) {
@@ -123,13 +123,13 @@ void SkPathRef::CreateTransformedCopy(SkAutoTUnref<SkPathRef>* dst,
}
SkPathRef* SkPathRef::CreateFromBuffer(SkRBuffer* buffer) {
- SkPathRef* ref = SkNEW(SkPathRef);
+ SkPathRef* ref = new SkPathRef;
bool isOval;
uint8_t segmentMask;
int32_t packed;
if (!buffer->readS32(&packed)) {
- SkDELETE(ref);
+ delete ref;
return NULL;
}
@@ -142,7 +142,7 @@ SkPathRef* SkPathRef::CreateFromBuffer(SkRBuffer* buffer) {
!buffer->readS32(&verbCount) ||
!buffer->readS32(&pointCount) ||
!buffer->readS32(&conicCount)) {
- SkDELETE(ref);
+ delete ref;
return NULL;
}
@@ -155,7 +155,7 @@ SkPathRef* SkPathRef::CreateFromBuffer(SkRBuffer* buffer) {
!buffer->read(ref->fPoints, pointCount * sizeof(SkPoint)) ||
!buffer->read(ref->fConicWeights.begin(), conicCount * sizeof(SkScalar)) ||
!buffer->read(&ref->fBounds, sizeof(SkRect))) {
- SkDELETE(ref);
+ delete ref;
return NULL;
}
ref->fBoundsIsDirty = false;
@@ -182,7 +182,7 @@ void SkPathRef::Rewind(SkAutoTUnref<SkPathRef>* pathRef) {
} else {
int oldVCnt = (*pathRef)->countVerbs();
int oldPCnt = (*pathRef)->countPoints();
- pathRef->reset(SkNEW(SkPathRef));
+ pathRef->reset(new SkPathRef);
(*pathRef)->resetToSize(0, 0, 0, oldVCnt, oldPCnt);
}
}
@@ -444,7 +444,7 @@ uint32_t SkPathRef::genID() const {
void SkPathRef::addGenIDChangeListener(GenIDChangeListener* listener) {
if (NULL == listener || this == empty.get()) {
- SkDELETE(listener);
+ delete listener;
return;
}
*fGenIDChangeListeners.append() = listener;
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index 26ec76184e..8247336d49 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -169,7 +169,7 @@ SkPictureData* SkPicture::backport() const {
rec.beginRecording();
this->playback(&rec);
rec.endRecording();
- return SkNEW_ARGS(SkPictureData, (rec, info, false/*deep copy ops?*/));
+ return new SkPictureData(rec, info, false /*deep copy ops?*/);
}
void SkPicture::serialize(SkWStream* stream, SkPixelSerializer* pixelSerializer) const {
diff --git a/src/core/SkPictureData.cpp b/src/core/SkPictureData.cpp
index 6ae03a3f2e..e70cd66de8 100644
--- a/src/core/SkPictureData.cpp
+++ b/src/core/SkPictureData.cpp
@@ -52,7 +52,7 @@ SkPictureData::SkPictureData(const SkPictureRecord& record,
const SkTDArray<const SkPicture* >& pictures = record.getPictureRefs();
fPictureCount = pictures.count();
if (fPictureCount > 0) {
- fPictureRefs = SkNEW_ARRAY(const SkPicture*, fPictureCount);
+ fPictureRefs = new const SkPicture* [fPictureCount];
for (int i = 0; i < fPictureCount; i++) {
fPictureRefs[i] = pictures[i];
fPictureRefs[i]->ref();
@@ -63,7 +63,7 @@ SkPictureData::SkPictureData(const SkPictureRecord& record,
const SkTDArray<const SkTextBlob*>& blobs = record.getTextBlobRefs();
fTextBlobCount = blobs.count();
if (fTextBlobCount > 0) {
- fTextBlobRefs = SkNEW_ARRAY(const SkTextBlob*, fTextBlobCount);
+ fTextBlobRefs = new const SkTextBlob* [fTextBlobCount];
for (int i = 0; i < fTextBlobCount; ++i) {
fTextBlobRefs[i] = SkRef(blobs[i]);
}
@@ -72,7 +72,7 @@ SkPictureData::SkPictureData(const SkPictureRecord& record,
const SkTDArray<const SkImage*>& imgs = record.getImageRefs();
fImageCount = imgs.count();
if (fImageCount > 0) {
- fImageRefs = SkNEW_ARRAY(const SkImage*, fImageCount);
+ fImageRefs = new const SkImage* [fImageCount];
for (int i = 0; i < fImageCount; ++i) {
fImageRefs[i] = SkRef(imgs[i]);
}
@@ -96,19 +96,19 @@ SkPictureData::~SkPictureData() {
for (int i = 0; i < fPictureCount; i++) {
fPictureRefs[i]->unref();
}
- SkDELETE_ARRAY(fPictureRefs);
+ delete[] fPictureRefs;
for (int i = 0; i < fTextBlobCount; i++) {
fTextBlobRefs[i]->unref();
}
- SkDELETE_ARRAY(fTextBlobRefs);
+ delete[] fTextBlobRefs;
for (int i = 0; i < fImageCount; i++) {
fImageRefs[i]->unref();
}
- SkDELETE_ARRAY(fImageRefs);
+ delete[] fImageRefs;
- SkDELETE(fFactoryPlayback);
+ delete fFactoryPlayback;
}
bool SkPictureData::containsBitmaps() const {
@@ -364,7 +364,7 @@ bool SkPictureData::parseStreamTag(SkStream* stream,
case SK_PICT_FACTORY_TAG: {
SkASSERT(!haveBuffer);
size = stream->readU32();
- fFactoryPlayback = SkNEW_ARGS(SkFactoryPlayback, (size));
+ fFactoryPlayback = new SkFactoryPlayback(size);
for (size_t i = 0; i < size; i++) {
SkString str;
const size_t len = stream->readPackedUInt();
@@ -391,7 +391,7 @@ bool SkPictureData::parseStreamTag(SkStream* stream,
} break;
case SK_PICT_PICTURE_TAG: {
fPictureCount = 0;
- fPictureRefs = SkNEW_ARRAY(const SkPicture*, size);
+ fPictureRefs = new const SkPicture* [size];
for (uint32_t i = 0; i < size; i++) {
fPictureRefs[i] = SkPicture::CreateFromStream(stream, proc, topLevelTFPlayback);
if (!fPictureRefs[i]) {
@@ -474,7 +474,7 @@ bool new_array_from_buffer(SkReadBuffer& buffer, uint32_t inCount,
return true;
}
*outCount = inCount;
- *array = SkNEW_ARRAY(const T*, *outCount);
+ *array = new const T* [*outCount];
bool success = true;
int i = 0;
for (; i < *outCount; i++) {
@@ -490,7 +490,7 @@ bool new_array_from_buffer(SkReadBuffer& buffer, uint32_t inCount,
(*array)[j]->unref();
}
// Delete the array
- SkDELETE_ARRAY(*array);
+ delete[] * array;
*array = NULL;
*outCount = 0;
return false;
@@ -565,7 +565,7 @@ SkPictureData* SkPictureData::CreateFromStream(SkStream* stream,
const SkPictInfo& info,
SkPicture::InstallPixelRefProc proc,
SkTypefacePlayback* topLevelTFPlayback) {
- SkAutoTDelete<SkPictureData> data(SkNEW_ARGS(SkPictureData, (info)));
+ SkAutoTDelete<SkPictureData> data(new SkPictureData(info));
if (!topLevelTFPlayback) {
topLevelTFPlayback = &data->fTFPlayback;
}
@@ -578,7 +578,7 @@ SkPictureData* SkPictureData::CreateFromStream(SkStream* stream,
SkPictureData* SkPictureData::CreateFromBuffer(SkReadBuffer& buffer,
const SkPictInfo& info) {
- SkAutoTDelete<SkPictureData> data(SkNEW_ARGS(SkPictureData, (info)));
+ SkAutoTDelete<SkPictureData> data(new SkPictureData(info));
buffer.setVersion(info.fVersion);
if (!data->parseBuffer(buffer)) {
diff --git a/src/core/SkPictureFlat.cpp b/src/core/SkPictureFlat.cpp
index 7b2e67f5ef..3556004a96 100644
--- a/src/core/SkPictureFlat.cpp
+++ b/src/core/SkPictureFlat.cpp
@@ -29,11 +29,11 @@ void SkTypefacePlayback::reset(const SkRefCntSet* rec) {
SkASSERT(fArray[i]);
fArray[i]->unref();
}
- SkDELETE_ARRAY(fArray);
+ delete[] fArray;
if (rec!= NULL && rec->count() > 0) {
fCount = rec->count();
- fArray = SkNEW_ARRAY(SkRefCnt*, fCount);
+ fArray = new SkRefCnt* [fCount];
rec->copyToArray(fArray);
for (int i = 0; i < fCount; i++) {
fArray[i]->ref();
@@ -48,7 +48,7 @@ void SkTypefacePlayback::setCount(int count) {
this->reset(NULL);
fCount = count;
- fArray = SkNEW_ARRAY(SkRefCnt*, count);
+ fArray = new SkRefCnt* [count];
sk_bzero(fArray, count * sizeof(SkRefCnt*));
}
diff --git a/src/core/SkPictureFlat.h b/src/core/SkPictureFlat.h
index 64e51b740e..176f48625d 100644
--- a/src/core/SkPictureFlat.h
+++ b/src/core/SkPictureFlat.h
@@ -135,13 +135,9 @@ protected:
class SkFactoryPlayback {
public:
- SkFactoryPlayback(int count) : fCount(count) {
- fArray = SkNEW_ARRAY(SkFlattenable::Factory, count);
- }
+ SkFactoryPlayback(int count) : fCount(count) { fArray = new SkFlattenable::Factory[count]; }
- ~SkFactoryPlayback() {
- SkDELETE_ARRAY(fArray);
- }
+ ~SkFactoryPlayback() { delete[] fArray; }
SkFlattenable::Factory* base() const { return fArray; }
diff --git a/src/core/SkPictureImageGenerator.cpp b/src/core/SkPictureImageGenerator.cpp
index acff84c1b4..13d3cc85c5 100644
--- a/src/core/SkPictureImageGenerator.cpp
+++ b/src/core/SkPictureImageGenerator.cpp
@@ -41,7 +41,7 @@ SkImageGenerator* SkPictureImageGenerator::Create(const SkISize& size, const SkP
return nullptr;
}
- return SkNEW_ARGS(SkPictureImageGenerator, (size, picture, matrix, paint));
+ return new SkPictureImageGenerator(size, picture, matrix, paint);
}
SkPictureImageGenerator::SkPictureImageGenerator(const SkISize& size, const SkPicture* picture,
diff --git a/src/core/SkPictureRecorder.cpp b/src/core/SkPictureRecorder.cpp
index 0c50dd9bb7..8612aa77d3 100644
--- a/src/core/SkPictureRecorder.cpp
+++ b/src/core/SkPictureRecorder.cpp
@@ -19,7 +19,7 @@
SkPictureRecorder::SkPictureRecorder() {
fActivelyRecording = false;
- fRecorder.reset(SkNEW_ARGS(SkRecorder, (nullptr, SkRect::MakeWH(0,0), &fMiniRecorder)));
+ fRecorder.reset(new SkRecorder(nullptr, SkRect::MakeWH(0, 0), &fMiniRecorder));
}
SkPictureRecorder::~SkPictureRecorder() {}
@@ -36,7 +36,7 @@ SkCanvas* SkPictureRecorder::beginRecording(const SkRect& cullRect,
}
if (!fRecord) {
- fRecord.reset(SkNEW(SkRecord));
+ fRecord.reset(new SkRecord);
}
SkRecorder::DrawPictureMode dpm = (recordFlags & kPlaybackDrawPicture_RecordFlag)
? SkRecorder::Playback_DrawPictureMode
@@ -64,7 +64,7 @@ SkPicture* SkPictureRecorder::endRecordingAsPicture() {
SkAutoTUnref<SkLayerInfo> saveLayerData;
if (fBBH && (fFlags & kComputeSaveLayerInfo_RecordFlag)) {
- saveLayerData.reset(SkNEW(SkLayerInfo));
+ saveLayerData.reset(new SkLayerInfo);
}
SkDrawableList* drawableList = fRecorder->getDrawableList();
@@ -87,12 +87,8 @@ SkPicture* SkPictureRecorder::endRecordingAsPicture() {
for (int i = 0; pictList && i < pictList->count(); i++) {
subPictureBytes += SkPictureUtils::ApproximateBytesUsed(pictList->begin()[i]);
}
- return SkNEW_ARGS(SkBigPicture, (fCullRect,
- fRecord.detach(),
- pictList,
- fBBH.detach(),
- saveLayerData.detach(),
- subPictureBytes));
+ return new SkBigPicture(fCullRect, fRecord.detach(), pictList, fBBH.detach(),
+ saveLayerData.detach(), subPictureBytes);
}
SkPicture* SkPictureRecorder::endRecordingAsPicture(const SkRect& cullRect) {
@@ -159,7 +155,7 @@ protected:
SkAutoTUnref<SkLayerInfo> saveLayerData;
if (fBBH && fDoSaveLayerInfo) {
- saveLayerData.reset(SkNEW(SkLayerInfo));
+ saveLayerData.reset(new SkLayerInfo);
SkBBoxHierarchy* bbh = NULL; // we've already computed fBBH (received in constructor)
// TODO: update saveLayer info computation to reuse the already computed
@@ -173,12 +169,8 @@ protected:
}
// SkBigPicture will take ownership of a ref on both fRecord and fBBH.
// We're not willing to give up our ownership, so we must ref them for SkPicture.
- return SkNEW_ARGS(SkBigPicture, (fBounds,
- SkRef(fRecord.get()),
- pictList,
- SkSafeRef(fBBH.get()),
- saveLayerData.detach(),
- subPictureBytes));
+ return new SkBigPicture(fBounds, SkRef(fRecord.get()), pictList, SkSafeRef(fBBH.get()),
+ saveLayerData.detach(), subPictureBytes);
}
};
@@ -194,10 +186,9 @@ SkDrawable* SkPictureRecorder::endRecordingAsDrawable() {
SkRecordFillBounds(fCullRect, *fRecord, fBBH.get());
}
- SkDrawable* drawable = SkNEW_ARGS(SkRecordedDrawable,
- (fRecord, fBBH, fRecorder->detachDrawableList(),
- fCullRect,
- SkToBool(fFlags & kComputeSaveLayerInfo_RecordFlag)));
+ SkDrawable* drawable =
+ new SkRecordedDrawable(fRecord, fBBH, fRecorder->detachDrawableList(), fCullRect,
+ SkToBool(fFlags & kComputeSaveLayerInfo_RecordFlag));
// release our refs now, so only the drawable will be the owner.
fRecord.reset(NULL);
diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp
index b84333939e..569ef3d822 100644
--- a/src/core/SkPictureShader.cpp
+++ b/src/core/SkPictureShader.cpp
@@ -124,7 +124,7 @@ SkShader* SkPictureShader::Create(const SkPicture* picture, TileMode tmx, TileMo
if (!picture || picture->cullRect().isEmpty() || (tile && tile->isEmpty())) {
return SkShader::CreateEmptyShader();
}
- return SkNEW_ARGS(SkPictureShader, (picture, tmx, tmy, localMatrix, tile));
+ return new SkPictureShader(picture, tmx, tmy, localMatrix, tile);
}
SkFlattenable* SkPictureShader::CreateProc(SkReadBuffer& buffer) {
@@ -250,7 +250,7 @@ SkShader* SkPictureShader::refBitmapShader(const SkMatrix& matrix, const SkMatri
shaderMatrix.preScale(1 / tileScale.width(), 1 / tileScale.height());
tileShader.reset(CreateBitmapShader(bm, fTmx, fTmy, &shaderMatrix));
- SkResourceCache::Add(SkNEW_ARGS(BitmapShaderRec, (key, tileShader.get(), bm.getSize())));
+ SkResourceCache::Add(new BitmapShaderRec(key, tileShader.get(), bm.getSize()));
}
return tileShader.detach();
@@ -272,8 +272,7 @@ SkShader::Context* SkPictureShader::onCreateContext(const ContextRec& rec, void*
SkShader::Context* SkPictureShader::PictureShaderContext::Create(void* storage,
const SkPictureShader& shader, const ContextRec& rec, SkShader* bitmapShader) {
- PictureShaderContext* ctx = SkNEW_PLACEMENT_ARGS(storage, PictureShaderContext,
- (shader, rec, bitmapShader));
+ PictureShaderContext* ctx = new (storage) PictureShaderContext(shader, rec, bitmapShader);
if (NULL == ctx->fBitmapShaderContext) {
ctx->~PictureShaderContext();
ctx = NULL;
diff --git a/src/core/SkPixelRef.cpp b/src/core/SkPixelRef.cpp
index 47f958dc38..7bcaffe554 100644
--- a/src/core/SkPixelRef.cpp
+++ b/src/core/SkPixelRef.cpp
@@ -243,7 +243,7 @@ uint32_t SkPixelRef::getGenerationID() const {
void SkPixelRef::addGenIDChangeListener(GenIDChangeListener* listener) {
if (NULL == listener || !this->genIDIsUnique()) {
// No point in tracking this if we're not going to call it.
- SkDELETE(listener);
+ delete listener;
return;
}
*fGenIDChangeListeners.append() = listener;
diff --git a/src/core/SkRWBuffer.cpp b/src/core/SkRWBuffer.cpp
index 6669471b5e..7c775135eb 100644
--- a/src/core/SkRWBuffer.cpp
+++ b/src/core/SkRWBuffer.cpp
@@ -229,9 +229,7 @@ void SkRWBuffer::validate() const {
}
#endif
-SkROBuffer* SkRWBuffer::newRBufferSnapshot() const {
- return SkNEW_ARGS(SkROBuffer, (fHead, fTotalUsed));
-}
+SkROBuffer* SkRWBuffer::newRBufferSnapshot() const { return new SkROBuffer(fHead, fTotalUsed); }
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -305,9 +303,7 @@ public:
return fBuffer->size() == fGlobalOffset;
}
- SkStreamAsset* duplicate() const override {
- return SkNEW_ARGS(SkROBufferStreamAsset, (fBuffer));
- }
+ SkStreamAsset* duplicate() const override { return new SkROBufferStreamAsset(fBuffer); }
size_t getPosition() const override {
return fGlobalOffset;
@@ -349,5 +345,5 @@ private:
SkStreamAsset* SkRWBuffer::newStreamSnapshot() const {
SkAutoTUnref<SkROBuffer> buffer(this->newRBufferSnapshot());
- return SkNEW_ARGS(SkROBufferStreamAsset, (buffer));
+ return new SkROBufferStreamAsset(buffer);
}
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index 890a0bff24..fe8f5f4933 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -687,7 +687,7 @@ private:
dst.fPreMat = src.fPreMat;
dst.fPreMat.postConcat(fFillBounds.ctm());
if (src.fPaint) {
- dst.fPaint = SkNEW_ARGS(SkPaint, (*src.fPaint));
+ dst.fPaint = new SkPaint(*src.fPaint);
}
dst.fSaveLayerOpID = src.fSaveLayerOpID;
dst.fRestoreOpID = src.fRestoreOpID;
@@ -696,7 +696,7 @@ private:
// Store 'saveLayer ops from enclosing picture' + drawPict op + 'ops from sub-picture'
dst.fKeySize = fSaveLayerOpStack.count() + src.fKeySize + 1;
- dst.fKey = SkNEW_ARRAY(int, dst.fKeySize);
+ dst.fKey = new int[dst.fKeySize];
memcpy(dst.fKey, fSaveLayerOpStack.begin(), fSaveLayerOpStack.count() * sizeof(int));
dst.fKey[fSaveLayerOpStack.count()] = fFillBounds.currentOp();
memcpy(&dst.fKey[fSaveLayerOpStack.count()+1], src.fKey, src.fKeySize * sizeof(int));
@@ -763,7 +763,7 @@ private:
block.fLocalMat = fFillBounds.ctm();
block.fPreMat = SkMatrix::I();
if (sli.fPaint) {
- block.fPaint = SkNEW_ARGS(SkPaint, (*sli.fPaint));
+ block.fPaint = new SkPaint(*sli.fPaint);
}
block.fSrcBounds = sli.fBounds;
@@ -773,7 +773,7 @@ private:
block.fIsNested = fSaveLayersInStack > 0;
block.fKeySize = fSaveLayerOpStack.count();
- block.fKey = SkNEW_ARRAY(int, block.fKeySize);
+ block.fKey = new int[block.fKeySize];
memcpy(block.fKey, fSaveLayerOpStack.begin(), block.fKeySize * sizeof(int));
fSaveLayerOpStack.pop();
diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp
index b12b1eb296..0fe9e28848 100644
--- a/src/core/SkRecorder.cpp
+++ b/src/core/SkRecorder.cpp
@@ -27,7 +27,7 @@ SkBigPicture::SnapshotArray* SkDrawableList::newDrawableSnapshot() {
for (int i = 0; i < count; ++i) {
pics[i] = fArray[i]->newPictureSnapshot();
}
- return SkNEW_ARGS(SkBigPicture::SnapshotArray, (pics.detach(), count));
+ return new SkBigPicture::SnapshotArray(pics.detach(), count);
}
void SkDrawableList::append(SkDrawable* drawable) {
@@ -66,9 +66,11 @@ void SkRecorder::forgetRecord() {
}
// To make appending to fRecord a little less verbose.
-#define APPEND(T, ...) \
- if (fMiniRecorder) { this->flushMiniRecorder(); } \
- SkNEW_PLACEMENT_ARGS(fRecord->append<SkRecords::T>(), SkRecords::T, (__VA_ARGS__))
+#define APPEND(T, ...) \
+ if (fMiniRecorder) { \
+ this->flushMiniRecorder(); \
+ } \
+ new (fRecord->append<SkRecords::T>()) SkRecords::T(__VA_ARGS__)
#define TRY_MINIRECORDER(method, ...) \
if (fMiniRecorder && fMiniRecorder->method(__VA_ARGS__)) { return; }
@@ -83,7 +85,7 @@ T* SkRecorder::copy(const T* src) {
if (NULL == src) {
return NULL;
}
- return SkNEW_PLACEMENT_ARGS(fRecord->alloc<T>(), T, (*src));
+ return new (fRecord->alloc<T>()) T(*src);
}
// This copy() is for arrays.
@@ -95,7 +97,7 @@ T* SkRecorder::copy(const T src[], size_t count) {
}
T* dst = fRecord->alloc<T>(count);
for (size_t i = 0; i < count; i++) {
- SkNEW_PLACEMENT_ARGS(dst + i, T, (src[i]));
+ new (dst + i) T(src[i]);
}
return dst;
}
@@ -157,7 +159,7 @@ void SkRecorder::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, const
void SkRecorder::onDrawDrawable(SkDrawable* drawable, const SkMatrix* matrix) {
if (!fDrawableList) {
- fDrawableList.reset(SkNEW(SkDrawableList));
+ fDrawableList.reset(new SkDrawableList);
}
fDrawableList->append(drawable);
APPEND(DrawDrawable, this->copy(matrix), drawable->getBounds(), fDrawableList->count() - 1);
diff --git a/src/core/SkResourceCache.cpp b/src/core/SkResourceCache.cpp
index 922fc7ee0a..911a09071e 100644
--- a/src/core/SkResourceCache.cpp
+++ b/src/core/SkResourceCache.cpp
@@ -105,9 +105,7 @@ SkOneShotDiscardablePixelRef::SkOneShotDiscardablePixelRef(const SkImageInfo& in
fFirstTime = true;
}
-SkOneShotDiscardablePixelRef::~SkOneShotDiscardablePixelRef() {
- SkDELETE(fDM);
-}
+SkOneShotDiscardablePixelRef::~SkOneShotDiscardablePixelRef() { delete fDM; }
bool SkOneShotDiscardablePixelRef::onNewLockPixels(LockRec* rec) {
if (fFirstTime) {
@@ -176,8 +174,7 @@ bool SkResourceCacheDiscardableAllocator::allocPixelRef(SkBitmap* bitmap, SkColo
}
SkImageInfo info = bitmap->info();
- bitmap->setPixelRef(SkNEW_ARGS(SkOneShotDiscardablePixelRef,
- (info, dm, bitmap->rowBytes())))->unref();
+ bitmap->setPixelRef(new SkOneShotDiscardablePixelRef(info, dm, bitmap->rowBytes()))->unref();
bitmap->lockPixels();
return bitmap->readyToDraw();
}
@@ -186,7 +183,7 @@ SkResourceCache::SkResourceCache(DiscardableFactory factory) {
this->init();
fDiscardableFactory = factory;
- fAllocator = SkNEW_ARGS(SkResourceCacheDiscardableAllocator, (factory));
+ fAllocator = new SkResourceCacheDiscardableAllocator(factory);
}
SkResourceCache::SkResourceCache(size_t byteLimit) {
@@ -200,7 +197,7 @@ SkResourceCache::~SkResourceCache() {
Rec* rec = fHead;
while (rec) {
Rec* next = rec->fNext;
- SkDELETE(rec);
+ delete rec;
rec = next;
}
delete fHash;
@@ -243,7 +240,7 @@ void SkResourceCache::add(Rec* rec) {
// See if we already have this key (racy inserts, etc.)
Rec* existing = fHash->find(rec->getKey());
if (existing) {
- SkDELETE(rec);
+ delete rec;
return;
}
@@ -280,7 +277,7 @@ void SkResourceCache::remove(Rec* rec) {
bytesStr.c_str(), rec, rec->getHash(), totalStr.c_str(), fCount);
}
- SkDELETE(rec);
+ delete rec;
}
void SkResourceCache::purgeAsNeeded(bool forcePurge) {
@@ -374,9 +371,9 @@ SkCachedData* SkResourceCache::newCachedData(size_t bytes) {
if (fDiscardableFactory) {
SkDiscardableMemory* dm = fDiscardableFactory(bytes);
- return dm ? SkNEW_ARGS(SkCachedData, (bytes, dm)) : NULL;
+ return dm ? new SkCachedData(bytes, dm) : NULL;
} else {
- return SkNEW_ARGS(SkCachedData, (sk_malloc_throw(bytes), bytes));
+ return new SkCachedData(sk_malloc_throw(bytes), bytes);
}
}
@@ -537,7 +534,7 @@ static void cleanup_gResourceCache() {
// makes this unsafe to delete when the main process atexit()s.
// SkLazyPtr does the same sort of thing.
#if SK_DEVELOPER
- SkDELETE(gResourceCache);
+ delete gResourceCache;
#endif
}
@@ -547,9 +544,9 @@ static SkResourceCache* get_cache() {
gMutex.assertHeld();
if (NULL == gResourceCache) {
#ifdef SK_USE_DISCARDABLE_SCALEDIMAGECACHE
- gResourceCache = SkNEW_ARGS(SkResourceCache, (SkDiscardableMemory::Create));
+ gResourceCache = new SkResourceCache(SkDiscardableMemory::Create);
#else
- gResourceCache = SkNEW_ARGS(SkResourceCache, (SK_DEFAULT_IMAGE_CACHE_LIMIT));
+ gResourceCache = new SkResourceCache(SK_DEFAULT_IMAGE_CACHE_LIMIT);
#endif
atexit(cleanup_gResourceCache);
}
diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp
index b765aad97c..5f0f653ec6 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -870,8 +870,7 @@ SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc,
SkScalerContext* c = this->onCreateScalerContext(desc);
if (!c && !allowFailure) {
- c = SkNEW_ARGS(SkScalerContext_Empty,
- (const_cast<SkTypeface*>(this), desc));
+ c = new SkScalerContext_Empty(const_cast<SkTypeface*>(this), desc);
}
return c;
}
diff --git a/src/core/SkSemaphore.cpp b/src/core/SkSemaphore.cpp
index ac62930082..29d0e0148a 100644
--- a/src/core/SkSemaphore.cpp
+++ b/src/core/SkSemaphore.cpp
@@ -55,8 +55,8 @@
};
#endif
-SkSemaphore::SkSemaphore() : fCount(0), fOSSemaphore(SkNEW(OSSemaphore)) {}
-SkSemaphore::~SkSemaphore() { SkDELETE(fOSSemaphore); }
+ SkSemaphore::SkSemaphore() : fCount(0), fOSSemaphore(new OSSemaphore) {}
+ SkSemaphore::~SkSemaphore() { delete fOSSemaphore; }
void SkSemaphore::signal(int n) {
SkASSERT(n >= 0);
diff --git a/src/core/SkShader.cpp b/src/core/SkShader.cpp
index 41724d9048..6da73fc45f 100644
--- a/src/core/SkShader.cpp
+++ b/src/core/SkShader.cpp
@@ -224,13 +224,9 @@ SkShader* SkShader::refAsALocalMatrixShader(SkMatrix*) const {
return NULL;
}
-SkShader* SkShader::CreateEmptyShader() {
- return SkNEW(SkEmptyShader);
-}
+SkShader* SkShader::CreateEmptyShader() { return new SkEmptyShader; }
-SkShader* SkShader::CreateColorShader(SkColor color) {
- return SkNEW_ARGS(SkColorShader, (color));
-}
+SkShader* SkShader::CreateColorShader(SkColor color) { return new SkColorShader(color); }
SkShader* SkShader::CreateBitmapShader(const SkBitmap& src, TileMode tmx, TileMode tmy,
const SkMatrix* localMatrix) {
@@ -264,7 +260,7 @@ bool SkColorShader::isOpaque() const {
}
SkFlattenable* SkColorShader::CreateProc(SkReadBuffer& buffer) {
- return SkNEW_ARGS(SkColorShader, (buffer.readColor()));
+ return new SkColorShader(buffer.readColor());
}
void SkColorShader::flatten(SkWriteBuffer& buffer) const {
@@ -280,7 +276,7 @@ uint8_t SkColorShader::ColorShaderContext::getSpan16Alpha() const {
}
SkShader::Context* SkColorShader::onCreateContext(const ContextRec& rec, void* storage) const {
- return SkNEW_PLACEMENT_ARGS(storage, ColorShaderContext, (*this, rec));
+ return new (storage) ColorShaderContext(*this, rec);
}
SkColorShader::ColorShaderContext::ColorShaderContext(const SkColorShader& shader,
diff --git a/src/core/SkSmallAllocator.h b/src/core/SkSmallAllocator.h
index 018705f974..a2c132a50f 100644
--- a/src/core/SkSmallAllocator.h
+++ b/src/core/SkSmallAllocator.h
@@ -63,7 +63,7 @@ public:
if (NULL == buf) {
return NULL;
}
- SkNEW_PLACEMENT(buf, T);
+ new (buf) T;
return static_cast<T*>(buf);
}
@@ -72,7 +72,7 @@ public:
if (NULL == buf) {
return NULL;
}
- SkNEW_PLACEMENT_ARGS(buf, T, (a1));
+ new (buf) T(a1);
return static_cast<T*>(buf);
}
@@ -82,7 +82,7 @@ public:
if (NULL == buf) {
return NULL;
}
- SkNEW_PLACEMENT_ARGS(buf, T, (a1, a2));
+ new (buf) T(a1, a2);
return static_cast<T*>(buf);
}
@@ -92,7 +92,7 @@ public:
if (NULL == buf) {
return NULL;
}
- SkNEW_PLACEMENT_ARGS(buf, T, (a1, a2, a3));
+ new (buf) T(a1, a2, a3);
return static_cast<T*>(buf);
}
@@ -102,7 +102,7 @@ public:
if (NULL == buf) {
return NULL;
}
- SkNEW_PLACEMENT_ARGS(buf, T, (a1, a2, a3, a4));
+ new (buf) T(a1, a2, a3, a4);
return static_cast<T*>(buf);
}
diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp
index f32f68a10a..8b2e8ab4ce 100644
--- a/src/core/SkStream.cpp
+++ b/src/core/SkStream.cpp
@@ -390,9 +390,7 @@ bool SkMemoryStream::rewind() {
return true;
}
-SkMemoryStream* SkMemoryStream::duplicate() const {
- return SkNEW_ARGS(SkMemoryStream, (fData));
-}
+SkMemoryStream* SkMemoryStream::duplicate() const { return new SkMemoryStream(fData); }
size_t SkMemoryStream::getPosition() const {
return fOffset;
@@ -687,8 +685,11 @@ public:
class SkBlockMemoryStream : public SkStreamAsset {
public:
SkBlockMemoryStream(SkDynamicMemoryWStream::Block* head, size_t size)
- : fBlockMemory(SkNEW_ARGS(SkBlockMemoryRefCnt, (head))), fCurrent(head)
- , fSize(size) , fOffset(0), fCurrentOffset(0) { }
+ : fBlockMemory(new SkBlockMemoryRefCnt(head))
+ , fCurrent(head)
+ , fSize(size)
+ , fOffset(0)
+ , fCurrentOffset(0) {}
SkBlockMemoryStream(SkBlockMemoryRefCnt* headRef, size_t size)
: fBlockMemory(SkRef(headRef)), fCurrent(fBlockMemory->fHead)
@@ -753,7 +754,7 @@ public:
}
SkBlockMemoryStream* duplicate() const override {
- return SkNEW_ARGS(SkBlockMemoryStream, (fBlockMemory.get(), fSize));
+ return new SkBlockMemoryStream(fBlockMemory.get(), fSize);
}
size_t getPosition() const override {
@@ -810,11 +811,11 @@ private:
SkStreamAsset* SkDynamicMemoryWStream::detachAsStream() {
if (fCopy) {
- SkMemoryStream* stream = SkNEW_ARGS(SkMemoryStream, (fCopy));
+ SkMemoryStream* stream = new SkMemoryStream(fCopy);
this->reset();
return stream;
}
- SkBlockMemoryStream* stream = SkNEW_ARGS(SkBlockMemoryStream, (fHead, fBytesWritten));
+ SkBlockMemoryStream* stream = new SkBlockMemoryStream(fHead, fBytesWritten);
fHead = 0;
this->reset();
return stream;
@@ -861,14 +862,14 @@ static SkData* mmap_filename(const char path[]) {
SkStreamAsset* SkStream::NewFromFile(const char path[]) {
SkAutoTUnref<SkData> data(mmap_filename(path));
if (data.get()) {
- return SkNEW_ARGS(SkMemoryStream, (data.get()));
+ return new SkMemoryStream(data.get());
}
// If we get here, then our attempt at using mmap failed, so try normal
// file access.
- SkFILEStream* stream = SkNEW_ARGS(SkFILEStream, (path));
+ SkFILEStream* stream = new SkFILEStream(path);
if (!stream->isValid()) {
- SkDELETE(stream);
+ delete stream;
stream = NULL;
}
return stream;
@@ -938,7 +939,7 @@ SkStreamRewindable* SkStreamRewindableFromSkStream(SkStream* stream) {
length -= stream->getPosition();
}
SkAutoTUnref<SkData> data(SkData::NewFromStream(stream, length));
- return SkNEW_ARGS(SkMemoryStream, (data.get()));
+ return new SkMemoryStream(data.get());
}
SkDynamicMemoryWStream tempStream;
const size_t bufferSize = 4096;
diff --git a/src/core/SkTLList.h b/src/core/SkTLList.h
index 3543529886..3a91efeed5 100644
--- a/src/core/SkTLList.h
+++ b/src/core/SkTLList.h
@@ -70,7 +70,7 @@ public:
this->validate();
Node* node = this->createNode();
fList.addToHead(node);
- SkNEW_PLACEMENT_ARGS(node->fObj, T, (t));
+ new (node->fObj) T(t);
this->validate();
return reinterpret_cast<T*>(node->fObj);
}
@@ -79,7 +79,7 @@ public:
this->validate();
Node* node = this->createNode();
fList.addToHead(node);
- SkNEW_PLACEMENT(node->fObj, T);
+ new (node->fObj) T;
this->validate();
return reinterpret_cast<T*>(node->fObj);
}
@@ -88,7 +88,7 @@ public:
this->validate();
Node* node = this->createNode();
fList.addToTail(node);
- SkNEW_PLACEMENT_ARGS(node->fObj, T, (t));
+ new (node->fObj) T(t);
this->validate();
return reinterpret_cast<T*>(node->fObj);
}
@@ -97,7 +97,7 @@ public:
this->validate();
Node* node = this->createNode();
fList.addToTail(node);
- SkNEW_PLACEMENT(node->fObj, T);
+ new (node->fObj) T;
this->validate();
return reinterpret_cast<T*>(node->fObj);
}
@@ -105,13 +105,13 @@ public:
/** Adds a new element to the list before the location indicated by the iterator. If the
iterator refers to a NULL location then the new element is added at the tail */
T* addBefore(const T& t, const Iter& location) {
- return SkNEW_PLACEMENT_ARGS(this->internalAddBefore(location), T, (t));
+ return new (this->internalAddBefore(location)) T(t);
}
/** Adds a new element to the list after the location indicated by the iterator. If the
iterator refers to a NULL location then the new element is added at the head */
T* addAfter(const T& t, const Iter& location) {
- return SkNEW_PLACEMENT_ARGS(this->internalAddAfter(location), T, (t));
+ return new (this->internalAddAfter(location)) T(t);
}
/** Convenience methods for getting an iterator initialized to the head/tail of the list. */
@@ -249,11 +249,11 @@ private:
} else {
Block* block = reinterpret_cast<Block*>(sk_malloc_flags(this->blockSize(), 0));
node = &block->fNodes[0];
- SkNEW_PLACEMENT(node, Node);
+ new (node) Node;
node->fBlock = block;
block->fNodesInUse = 1;
for (int i = 1; i < fAllocCnt; ++i) {
- SkNEW_PLACEMENT(block->fNodes + i, Node);
+ new (block->fNodes + i) Node;
fFreeList.addToHead(block->fNodes + i);
block->fNodes[i].fBlock = block;
}
diff --git a/src/core/SkTLS.cpp b/src/core/SkTLS.cpp
index 346fed80ce..b22446bd98 100755
--- a/src/core/SkTLS.cpp
+++ b/src/core/SkTLS.cpp
@@ -50,7 +50,7 @@ void SkTLS::Destructor(void* ptr) {
SkTLSRec* rec = (SkTLSRec*)ptr;
do {
SkTLSRec* next = rec->fNext;
- SkDELETE(rec);
+ delete rec;
rec = next;
} while (rec);
}
@@ -121,7 +121,7 @@ void SkTLS::Delete(CreateProc createProc) {
// we have a new head of our chain
SkTLS::PlatformSetSpecific(next);
}
- SkDELETE(curr);
+ delete curr;
break;
}
prev = curr;
diff --git a/src/core/SkTMultiMap.h b/src/core/SkTMultiMap.h
index 1168ed6e91..5f8589d912 100644
--- a/src/core/SkTMultiMap.h
+++ b/src/core/SkTMultiMap.h
@@ -40,14 +40,14 @@ public:
if (list) {
// The new ValueList entry is inserted as the second element in the
// linked list, and it will contain the value of the first element.
- ValueList* newEntry = SkNEW_ARGS(ValueList, (list->fValue));
+ ValueList* newEntry = new ValueList(list->fValue);
newEntry->fNext = list->fNext;
// The existing first ValueList entry is updated to contain the
// inserted value.
list->fNext = newEntry;
list->fValue = value;
} else {
- fHash.add(SkNEW_ARGS(ValueList, (value)));
+ fHash.add(new ValueList(value));
}
++fCount;
@@ -68,13 +68,13 @@ public:
ValueList* next = list->fNext;
list->fValue = next->fValue;
list->fNext = next->fNext;
- SkDELETE(next);
+ delete next;
} else if (prev) {
prev->fNext = NULL;
- SkDELETE(list);
+ delete list;
} else {
fHash.remove(key);
- SkDELETE(list);
+ delete list;
}
--fCount;
diff --git a/src/core/SkTaskGroup.cpp b/src/core/SkTaskGroup.cpp
index e809f571ef..9462903427 100644
--- a/src/core/SkTaskGroup.cpp
+++ b/src/core/SkTaskGroup.cpp
@@ -111,7 +111,7 @@ private:
threads = sk_num_cores();
}
for (int i = 0; i < threads; i++) {
- fThreads.push(SkNEW_ARGS(SkThread, (&ThreadPool::Loop, this)));
+ fThreads.push(new SkThread(&ThreadPool::Loop, this));
fThreads.top()->start();
}
}
@@ -204,13 +204,11 @@ ThreadPool* ThreadPool::gGlobal = NULL;
SkTaskGroup::Enabler::Enabler(int threads) {
SkASSERT(ThreadPool::gGlobal == NULL);
if (threads != 0) {
- ThreadPool::gGlobal = SkNEW_ARGS(ThreadPool, (threads));
+ ThreadPool::gGlobal = new ThreadPool(threads);
}
}
-SkTaskGroup::Enabler::~Enabler() {
- SkDELETE(ThreadPool::gGlobal);
-}
+SkTaskGroup::Enabler::~Enabler() { delete ThreadPool::gGlobal; }
SkTaskGroup::SkTaskGroup() : fPending(0) {}
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp
index c94e22f2bc..7da1118cd4 100644
--- a/src/core/SkTypeface.cpp
+++ b/src/core/SkTypeface.cpp
@@ -27,9 +27,7 @@ SkTypeface* (*gCreateTypefaceDelegate)(const char [], SkTypeface::Style ) = NULL
class SkEmptyTypeface : public SkTypeface {
public:
- static SkEmptyTypeface* Create() {
- return SkNEW(SkEmptyTypeface);
- }
+ static SkEmptyTypeface* Create() { return new SkEmptyTypeface; }
protected:
SkEmptyTypeface() : SkTypeface(SkFontStyle(), 0, true) { }
@@ -59,7 +57,7 @@ protected:
familyName->reset();
}
SkTypeface::LocalizedStrings* onCreateFamilyNameIterator() const override {
- return SkNEW(EmptyLocalizedStrings);
+ return new EmptyLocalizedStrings;
};
int onGetTableTags(SkFontTableTag tags[]) const override { return 0; }
size_t onGetTableData(SkFontTableTag, size_t, size_t, void*) const override {
@@ -330,7 +328,7 @@ struct SkTypeface::BoundsComputer {
BoundsComputer(const SkTypeface& tf) : fTypeface(tf) {}
SkRect* operator()() const {
- SkRect* rect = SkNEW(SkRect);
+ SkRect* rect = new SkRect;
if (!fTypeface.onComputeBounds(rect)) {
rect->setEmpty();
}
diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp
index c9a81226a4..17ce215c7a 100644
--- a/src/core/SkXfermode.cpp
+++ b/src/core/SkXfermode.cpp
@@ -1006,7 +1006,7 @@ SkXfermode* create_mode(int iMode) {
if (auto xfermode = SkOpts::create_xfermode(rec, mode)) {
return xfermode;
}
- return SkNEW_ARGS(SkProcCoeffXfermode, (rec, mode));
+ return new SkProcCoeffXfermode(rec, mode);
}
} // namespace
diff --git a/src/core/SkYUVPlanesCache.cpp b/src/core/SkYUVPlanesCache.cpp
index b113c07974..f013599cc5 100644
--- a/src/core/SkYUVPlanesCache.cpp
+++ b/src/core/SkYUVPlanesCache.cpp
@@ -85,5 +85,5 @@ SkCachedData* SkYUVPlanesCache::FindAndRef(uint32_t genID, Info* info,
void SkYUVPlanesCache::Add(uint32_t genID, SkCachedData* data, Info* info,
SkResourceCache* localCache) {
YUVPlanesKey key(genID);
- return CHECK_LOCAL(localCache, add, Add, SkNEW_ARGS(YUVPlanesRec, (key, data, info)));
+ return CHECK_LOCAL(localCache, add, Add, new YUVPlanesRec(key, data, info));
}