diff options
author | halcanary <halcanary@google.com> | 2015-08-26 13:07:48 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-26 13:07:49 -0700 |
commit | 385fe4d4b62d7d1dd76116dd570df3290a2f487b (patch) | |
tree | 53d982ff238828331e86acd44071a44162a8688c /src/ports | |
parent | 5015176adf046ef906a2313b6e6b64b72cc84898 (diff) |
Style Change: SkNEW->new; SkDELETE->delete
DOCS_PREVIEW= https://skia.org/?cl=1316123003
Review URL: https://codereview.chromium.org/1316123003
Diffstat (limited to 'src/ports')
-rw-r--r-- | src/ports/SkFontConfigInterface_direct.cpp | 6 | ||||
-rw-r--r-- | src/ports/SkFontConfigTypeface.h | 4 | ||||
-rw-r--r-- | src/ports/SkFontHost_FreeType.cpp | 17 | ||||
-rw-r--r--[-rwxr-xr-x] | src/ports/SkFontHost_mac.cpp | 11 | ||||
-rw-r--r--[-rwxr-xr-x] | src/ports/SkFontHost_win.cpp | 15 | ||||
-rw-r--r-- | src/ports/SkFontMgr_android.cpp | 57 | ||||
-rw-r--r-- | src/ports/SkFontMgr_custom.cpp | 28 | ||||
-rw-r--r-- | src/ports/SkFontMgr_fontconfig.cpp | 16 | ||||
-rw-r--r-- | src/ports/SkFontMgr_win_dw.cpp | 9 | ||||
-rw-r--r-- | src/ports/SkImageDecoder_CG.cpp | 4 | ||||
-rw-r--r-- | src/ports/SkImageDecoder_WIC.cpp | 4 | ||||
-rw-r--r-- | src/ports/SkImageDecoder_empty.cpp | 2 | ||||
-rw-r--r-- | src/ports/SkImageGenerator_skia.cpp | 8 | ||||
-rw-r--r-- | src/ports/SkOSFile_posix.cpp | 6 | ||||
-rw-r--r-- | src/ports/SkOSFile_win.cpp | 6 | ||||
-rw-r--r-- | src/ports/SkRemotableFontMgr_win_dw.cpp | 5 | ||||
-rw-r--r-- | src/ports/SkTypeface_win_dw.cpp | 4 | ||||
-rw-r--r-- | src/ports/SkTypeface_win_dw.h | 5 |
18 files changed, 88 insertions, 119 deletions
diff --git a/src/ports/SkFontConfigInterface_direct.cpp b/src/ports/SkFontConfigInterface_direct.cpp index 9ef088d8b7..3400aa99a8 100644 --- a/src/ports/SkFontConfigInterface_direct.cpp +++ b/src/ports/SkFontConfigInterface_direct.cpp @@ -133,7 +133,7 @@ SkFontConfigInterface* SkFontConfigInterface::GetSingletonDirectInterface(SkBase SkAutoMutexAcquire ac(mutex); static SkFontConfigInterfaceDirect* singleton = NULL; if (singleton == NULL) { - singleton = SkNEW(SkFontConfigInterfaceDirect); + singleton = new SkFontConfigInterfaceDirect; } return singleton; } @@ -733,9 +733,7 @@ bool SkFontConfigInterfaceDirect::matchFamilySet(const char inFamilyName[], } } - SkFontStyleSet_FC* sset = SkNEW_ARGS(SkFontStyleSet_FC, - (trimmedMatches.begin(), - trimmedMatches.count())); + SkFontStyleSet_FC* sset = new SkFontStyleSet_FC (trimmedMatches.begin(), trimmedMatches.count()); #endif return false; } diff --git a/src/ports/SkFontConfigTypeface.h b/src/ports/SkFontConfigTypeface.h index 3672f4e8d3..d207f088ae 100644 --- a/src/ports/SkFontConfigTypeface.h +++ b/src/ports/SkFontConfigTypeface.h @@ -21,12 +21,12 @@ public: static FontConfigTypeface* Create(const SkFontStyle& style, const SkFontConfigInterface::FontIdentity& fi, const SkString& familyName) { - return SkNEW_ARGS(FontConfigTypeface, (style, fi, familyName)); + return new FontConfigTypeface(style, fi, familyName); } static FontConfigTypeface* Create(const SkFontStyle& style, bool fixedWidth, SkStreamAsset* localStream) { - return SkNEW_ARGS(FontConfigTypeface, (style, fixedWidth, localStream)); + return new FontConfigTypeface(style, fixedWidth, localStream); } const SkFontConfigInterface::FontIdentity& getIdentity() const { diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp index 63f598fd13..860f32002c 100644 --- a/src/ports/SkFontHost_FreeType.cpp +++ b/src/ports/SkFontHost_FreeType.cpp @@ -158,7 +158,7 @@ static bool ref_ft_library() { if (0 == gFTCount) { SkASSERT(NULL == gFTLibrary); - gFTLibrary = SkNEW(FreeTypeLibrary); + gFTLibrary = new FreeTypeLibrary; } ++gFTCount; return gFTLibrary->library(); @@ -172,7 +172,7 @@ static void unref_ft_library() { --gFTCount; if (0 == gFTCount) { SkASSERT(NULL != gFTLibrary); - SkDELETE(gFTLibrary); + delete gFTLibrary; SkDEBUGCODE(gFTLibrary = NULL;) } } @@ -319,7 +319,7 @@ static FT_Face ref_ft_face(const SkTypeface* typeface) { } // this passes ownership of stream to the rec - rec = SkNEW_ARGS(SkFaceRec, (data->detachStream(), fontID)); + rec = new SkFaceRec(data->detachStream(), fontID); FT_Open_Args args; memset(&args, 0, sizeof(args)); @@ -336,7 +336,7 @@ static FT_Face ref_ft_face(const SkTypeface* typeface) { FT_Error err = FT_Open_Face(gFTLibrary->library(), &args, data->getIndex(), &rec->fFace); if (err) { SkDEBUGF(("ERROR: unable to open font '%x'\n", fontID)); - SkDELETE(rec); + delete rec; return NULL; } SkASSERT(rec->fFace); @@ -374,7 +374,7 @@ static void unref_ft_face(FT_Face face) { gFaceRecHead = next; } FT_Done_Face(face); - SkDELETE(rec); + delete rec; } return; } @@ -662,11 +662,10 @@ static bool isAxisAligned(const SkScalerContext::Rec& rec) { SkScalerContext* SkTypeface_FreeType::onCreateScalerContext( const SkDescriptor* desc) const { - SkScalerContext_FreeType* c = SkNEW_ARGS(SkScalerContext_FreeType, - (const_cast<SkTypeface_FreeType*>(this), - desc)); + SkScalerContext_FreeType* c = + new SkScalerContext_FreeType(const_cast<SkTypeface_FreeType*>(this), desc); if (!c->success()) { - SkDELETE(c); + delete c; c = NULL; } return c; diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp index b55aa355f1..b144aee12e 100755..100644 --- a/src/ports/SkFontHost_mac.cpp +++ b/src/ports/SkFontHost_mac.cpp @@ -2198,9 +2198,8 @@ static SkTypeface* createFromDesc(CFStringRef cfFamilyName, CTFontDescriptorRef bool isFixedPitch; (void)computeStyleBits(ctFont, &isFixedPitch); - face = SkNEW_ARGS(SkTypeface_Mac, (ctFont.detach(), NULL, - cacheRequest.fStyle, isFixedPitch, - skFamilyName.c_str(), false)); + face = new SkTypeface_Mac(ctFont.detach(), NULL, cacheRequest.fStyle, isFixedPitch, + skFamilyName.c_str(), false); SkTypefaceCache::Add(face, face->fontStyle()); return face; } @@ -2298,7 +2297,7 @@ class SkFontMgr_Mac : public SkFontMgr { AutoCFRelease<CTFontDescriptorRef> desc( CTFontDescriptorCreateWithAttributes(cfAttr)); - return SkNEW_ARGS(SkFontStyleSet_Mac, (cfFamilyName, desc)); + return new SkFontStyleSet_Mac(cfFamilyName, desc); } public: @@ -2488,6 +2487,4 @@ protected: /////////////////////////////////////////////////////////////////////////////// -SkFontMgr* SkFontMgr::Factory() { - return SkNEW(SkFontMgr_Mac); -} +SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; } diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp index d19ab1adba..97e659ef6f 100755..100644 --- a/src/ports/SkFontHost_win.cpp +++ b/src/ports/SkFontHost_win.cpp @@ -2277,10 +2277,9 @@ size_t LogFontTypeface::onGetTableData(SkFontTableTag tag, size_t offset, } SkScalerContext* LogFontTypeface::onCreateScalerContext(const SkDescriptor* desc) const { - SkScalerContext_GDI* ctx = SkNEW_ARGS(SkScalerContext_GDI, - (const_cast<LogFontTypeface*>(this), desc)); + SkScalerContext_GDI* ctx = new SkScalerContext_GDI(const_cast<LogFontTypeface*>(this), desc); if (!ctx->isValid()) { - SkDELETE(ctx); + delete ctx; ctx = NULL; } return ctx; @@ -2442,7 +2441,7 @@ protected: SkFontStyleSet* onCreateStyleSet(int index) const override { SkASSERT((unsigned)index < (unsigned)fLogFontArray.count()); - return SkNEW_ARGS(SkFontStyleSetGDI, (fLogFontArray[index].elfLogFont.lfFaceName)); + return new SkFontStyleSetGDI(fLogFontArray[index].elfLogFont.lfFaceName); } SkFontStyleSet* onMatchFamily(const char familyName[]) const override { @@ -2451,7 +2450,7 @@ protected: } LOGFONT lf; logfont_for_name(familyName, &lf); - return SkNEW_ARGS(SkFontStyleSetGDI, (lf.lfFaceName)); + return new SkFontStyleSetGDI(lf.lfFaceName); } virtual SkTypeface* onMatchFamilyStyle(const char familyName[], @@ -2482,7 +2481,7 @@ protected: SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override { // could be in base impl - return this->createFromStream(SkNEW_ARGS(SkMemoryStream, (data))); + return this->createFromStream(new SkMemoryStream(data)); } SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override { @@ -2511,6 +2510,4 @@ private: /////////////////////////////////////////////////////////////////////////////// -SkFontMgr* SkFontMgr_New_GDI() { - return SkNEW(SkFontMgrGDI); -} +SkFontMgr* SkFontMgr_New_GDI() { return new SkFontMgrGDI; } diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp index 45c787a930..dc89d91931 100644 --- a/src/ports/SkFontMgr_android.cpp +++ b/src/ports/SkFontMgr_android.cpp @@ -204,33 +204,27 @@ public: // TODO: warn on defaulted axis? } - SkDEBUGCODE ( - // Check for axis specified, but not matched in font. - for (int i = 0; i < fontFile.fAxes.count(); ++i) { - SkFourByteTag skTag = fontFile.fAxes[i].fTag; - bool found = false; - for (int j = 0; j < axisDefinitions.count(); ++j) { - if (skTag == axisDefinitions[j].fTag) { - found = true; - break; + SkDEBUGCODE( + // Check for axis specified, but not matched in font. + for (int i = 0; i < fontFile.fAxes.count(); ++i) { + SkFourByteTag skTag = fontFile.fAxes[i].fTag; + bool found = false; + for (int j = 0; j < axisDefinitions.count(); ++j) { + if (skTag == axisDefinitions[j].fTag) { + found = true; + break; + } } - } - if (!found) { - SkDEBUGF(("Requested font axis not found: %s '%c%c%c%c'\n", - familyName.c_str(), - (skTag >> 24) & 0xFF, - (skTag >> 16) & 0xFF, - (skTag >> 8) & 0xFF, - (skTag ) & 0xFF)); - } - } - ) + if (!found) { + SkDEBUGF(("Requested font axis not found: %s '%c%c%c%c'\n", + familyName.c_str(), (skTag >> 24) & 0xFF, + (skTag >> 16) & 0xFF, (skTag >> 8) & 0xFF, (skTag)&0xFF)); + } + }) - fStyles.push_back().reset(SkNEW_ARGS(SkTypeface_AndroidSystem, - (pathName, ttcIndex, - axisValues.get(), axisDefinitions.count(), - style, isFixedWidth, familyName, - lang, variant))); + fStyles.push_back().reset(new SkTypeface_AndroidSystem( + pathName, ttcIndex, axisValues.get(), axisDefinitions.count(), style, + isFixedWidth, familyName, lang, variant)); } } @@ -476,7 +470,7 @@ protected: return NULL; } SkFontData* data(new SkFontData(stream.detach(), ttcIndex, NULL, 0)); - return SkNEW_ARGS(SkTypeface_AndroidStream, (data, style, isFixedPitch, name)); + return new SkTypeface_AndroidStream(data, style, isFixedPitch, name); } SkTypeface* onCreateFromFontData(SkFontData* data) const override { @@ -487,7 +481,7 @@ protected: if (!fScanner.scanFont(stream, data->getIndex(), &name, &style, &isFixedPitch, NULL)) { return NULL; } - return SkNEW_ARGS(SkTypeface_AndroidStream, (data, style, isFixedPitch, name)); + return new SkTypeface_AndroidStream(data, style, isFixedPitch, name); } @@ -531,17 +525,16 @@ private: } } - SkFontStyleSet_Android* newSet = - SkNEW_ARGS(SkFontStyleSet_Android, (family, fScanner)); + SkFontStyleSet_Android* newSet = new SkFontStyleSet_Android(family, fScanner); if (0 == newSet->count()) { - SkDELETE(newSet); + delete newSet; continue; } fFontStyleSets.push_back().reset(newSet); for (int j = 0; j < family.fNames.count(); j++) { NameToFamily* nextEntry = nameToFamily->append(); - SkNEW_PLACEMENT_ARGS(&nextEntry->name, SkString, (family.fNames[j])); + new (&nextEntry->name) SkString(family.fNames[j]); nextEntry->styleSet = newSet; } } @@ -591,5 +584,5 @@ SkFontMgr* SkFontMgr_New_Android(const SkFontMgr_Android_CustomFonts* custom) { custom->fFallbackFontsXml)); } - return SkNEW_ARGS(SkFontMgr_Android, (custom)); + return new SkFontMgr_Android(custom); } diff --git a/src/ports/SkFontMgr_custom.cpp b/src/ports/SkFontMgr_custom.cpp index 835acd786f..496a54cd38 100644 --- a/src/ports/SkFontMgr_custom.cpp +++ b/src/ports/SkFontMgr_custom.cpp @@ -296,8 +296,8 @@ protected: SkFontStyle style; SkString name; if (fScanner.scanFont(stream, ttcIndex, &name, &style, &isFixedPitch, NULL)) { - return SkNEW_ARGS(SkTypeface_Stream, (style, isFixedPitch, false, name, - stream.detach(), ttcIndex)); + return new SkTypeface_Stream(style, isFixedPitch, false, name, stream.detach(), + ttcIndex); } else { return NULL; } @@ -353,7 +353,7 @@ public: if (families->empty()) { SkFontStyleSet_Custom* family = new SkFontStyleSet_Custom(SkString()); families->push_back().reset(family); - family->appendTypeface(SkNEW(SkTypeface_Empty)); + family->appendTypeface(new SkTypeface_Empty); } } @@ -400,13 +400,9 @@ private: continue; } - SkTypeface_Custom* tf = SkNEW_ARGS(SkTypeface_File, ( - style, - isFixedPitch, - true, // system-font (cannot delete) - realname, - filename.c_str(), - faceIndex)); + SkTypeface_Custom* tf = new SkTypeface_File(style, isFixedPitch, + true, // system-font (cannot delete) + realname, filename.c_str(), faceIndex); SkFontStyleSet_Custom* addTo = find_family(*families, realname.c_str()); if (NULL == addTo) { @@ -454,7 +450,7 @@ public: if (families->empty()) { SkFontStyleSet_Custom* family = new SkFontStyleSet_Custom(SkString()); families->push_back().reset(family); - family->appendTypeface(SkNEW(SkTypeface_Empty)); + family->appendTypeface(new SkTypeface_Empty); } } @@ -491,13 +487,9 @@ private: return; } - SkTypeface_Custom* tf = SkNEW_ARGS(SkTypeface_Stream, ( - style, - isFixedPitch, - true, // system-font (cannot delete) - realname, - stream.detach(), - faceIndex)); + SkTypeface_Custom* tf = + new SkTypeface_Stream(style, isFixedPitch, true, // system-font (cannot delete) + realname, stream.detach(), faceIndex); SkFontStyleSet_Custom* addTo = find_family(*families, realname.c_str()); if (NULL == addTo) { diff --git a/src/ports/SkFontMgr_fontconfig.cpp b/src/ports/SkFontMgr_fontconfig.cpp index 5a34455546..3dc1ea03da 100644 --- a/src/ports/SkFontMgr_fontconfig.cpp +++ b/src/ports/SkFontMgr_fontconfig.cpp @@ -65,8 +65,8 @@ namespace { SK_DECLARE_STATIC_MUTEX(gFCMutex); #ifdef SK_DEBUG - void *CreateThreadFcLocked() { return SkNEW_ARGS(bool, (false)); } - void DeleteThreadFcLocked(void* v) { SkDELETE(static_cast<bool*>(v)); } +void* CreateThreadFcLocked() { return new bool(false); } +void DeleteThreadFcLocked(void* v) { delete static_cast<bool*>(v); } # define THREAD_FC_LOCKED \ static_cast<bool*>(SkTLS::Get(CreateThreadFcLocked, DeleteThreadFcLocked)) #endif @@ -416,7 +416,7 @@ class SkTypeface_fontconfig : public SkTypeface_FreeType { public: /** @param pattern takes ownership of the reference. */ static SkTypeface_fontconfig* Create(FcPattern* pattern) { - return SkNEW_ARGS(SkTypeface_fontconfig, (pattern)); + return new SkTypeface_fontconfig(pattern); } mutable SkAutoFcPattern fPattern; @@ -725,7 +725,7 @@ protected: } } - return SkNEW_ARGS(StyleSet, (this, matches.detach())); + return new StyleSet(this, matches.detach()); } virtual SkTypeface* onMatchFamilyStyle(const char familyName[], @@ -830,12 +830,12 @@ protected: return NULL; } - return SkNEW_ARGS(SkTypeface_stream, (new SkFontData(stream.detach(), ttcIndex, NULL, 0), - style, isFixedWidth)); + return new SkTypeface_stream(new SkFontData(stream.detach(), ttcIndex, NULL, 0), style, + isFixedWidth); } SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override { - return this->createFromStream(SkNEW_ARGS(SkMemoryStream, (data)), ttcIndex); + return this->createFromStream(new SkMemoryStream(data), ttcIndex); } SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override { @@ -856,7 +856,7 @@ protected: return NULL; } - return SkNEW_ARGS(SkTypeface_stream, (fontData, style, isFixedWidth)); + return new SkTypeface_stream(fontData, style, isFixedWidth); } virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], diff --git a/src/ports/SkFontMgr_win_dw.cpp b/src/ports/SkFontMgr_win_dw.cpp index ca8b260580..df51764ab8 100644 --- a/src/ports/SkFontMgr_win_dw.cpp +++ b/src/ports/SkFontMgr_win_dw.cpp @@ -479,7 +479,7 @@ SkFontStyleSet* SkFontMgr_DirectWrite::onCreateStyleSet(int index) const { SkTScopedComPtr<IDWriteFontFamily> fontFamily; HRNM(fFontCollection->GetFontFamily(index, &fontFamily), "Could not get requested family."); - return SkNEW_ARGS(SkFontStyleSet_DirectWrite, (this, fontFamily.get())); + return new SkFontStyleSet_DirectWrite(this, fontFamily.get()); } SkFontStyleSet* SkFontMgr_DirectWrite::onMatchFamily(const char familyName[]) const { @@ -914,7 +914,7 @@ SkTypeface* SkFontMgr_DirectWrite::onCreateFromStream(SkStreamAsset* stream, int } SkTypeface* SkFontMgr_DirectWrite::onCreateFromData(SkData* data, int ttcIndex) const { - return this->createFromStream(SkNEW_ARGS(SkMemoryStream, (data)), ttcIndex); + return this->createFromStream(new SkMemoryStream(data), ttcIndex); } SkTypeface* SkFontMgr_DirectWrite::onCreateFromFile(const char path[], int ttcIndex) const { @@ -1092,8 +1092,7 @@ SK_API SkFontMgr* SkFontMgr_New_DirectWrite(IDWriteFactory* factory) { }; } - return SkNEW_ARGS(SkFontMgr_DirectWrite, (factory, sysFontCollection.get(), - localeName, localeNameLen)); + return new SkFontMgr_DirectWrite(factory, sysFontCollection.get(), localeName, localeNameLen); } #include "SkFontMgr_indirect.h" @@ -1102,5 +1101,5 @@ SK_API SkFontMgr* SkFontMgr_New_DirectWriteRenderer(SkRemotableFontMgr* proxy) { if (impl.get() == NULL) { return NULL; } - return SkNEW_ARGS(SkFontMgr_Indirect, (impl.get(), proxy)); + return new SkFontMgr_Indirect(impl.get(), proxy); } diff --git a/src/ports/SkImageDecoder_CG.cpp b/src/ports/SkImageDecoder_CG.cpp index ba16e4b45c..e1e6dc17e7 100644 --- a/src/ports/SkImageDecoder_CG.cpp +++ b/src/ports/SkImageDecoder_CG.cpp @@ -221,7 +221,7 @@ SkImageDecoder* SkImageDecoder::Factory(SkStreamRewindable* stream) { SkImageDecoder* decoder = image_decoder_from_stream(stream); if (NULL == decoder) { // If no image decoder specific to the stream exists, use SkImageDecoder_CG. - return SkNEW(SkImageDecoder_CG); + return new SkImageDecoder_CG; } else { return decoder; } @@ -344,7 +344,7 @@ static SkImageEncoder* sk_imageencoder_cg_factory(SkImageEncoder::Type t) { default: return NULL; } - return SkNEW_ARGS(SkImageEncoder_CG, (t)); + return new SkImageEncoder_CG(t); } static SkImageEncoder_EncodeReg gEReg(sk_imageencoder_cg_factory); diff --git a/src/ports/SkImageDecoder_WIC.cpp b/src/ports/SkImageDecoder_WIC.cpp index 55344a7c18..919483135c 100644 --- a/src/ports/SkImageDecoder_WIC.cpp +++ b/src/ports/SkImageDecoder_WIC.cpp @@ -256,7 +256,7 @@ SkImageDecoder* SkImageDecoder::Factory(SkStreamRewindable* stream) { SkImageDecoder* decoder = image_decoder_from_stream(stream); if (NULL == decoder) { // If no image decoder specific to the stream exists, use SkImageDecoder_WIC. - return SkNEW(SkImageDecoder_WIC); + return new SkImageDecoder_WIC; } else { return decoder; } @@ -447,7 +447,7 @@ static SkImageEncoder* sk_imageencoder_wic_factory(SkImageEncoder::Type t) { default: return NULL; } - return SkNEW_ARGS(SkImageEncoder_WIC, (t)); + return new SkImageEncoder_WIC(t); } static SkImageEncoder_EncodeReg gEReg(sk_imageencoder_wic_factory); diff --git a/src/ports/SkImageDecoder_empty.cpp b/src/ports/SkImageDecoder_empty.cpp index e5ad6da6eb..e6cca089bc 100644 --- a/src/ports/SkImageDecoder_empty.cpp +++ b/src/ports/SkImageDecoder_empty.cpp @@ -49,7 +49,7 @@ bool SkImageDecoder::buildTileIndex(SkStreamRewindable*, int *width, int *height bool SkImageDecoder::onBuildTileIndex(SkStreamRewindable* stream, int* /*width*/, int* /*height*/) { - SkDELETE(stream); + delete stream; return false; } diff --git a/src/ports/SkImageGenerator_skia.cpp b/src/ports/SkImageGenerator_skia.cpp index 72480b8f68..2b11651e0b 100644 --- a/src/ports/SkImageGenerator_skia.cpp +++ b/src/ports/SkImageGenerator_skia.cpp @@ -49,8 +49,8 @@ protected: bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkPMColor ctableEntries[], int* ctableCount) override { SkMemoryStream stream(fData->data(), fData->size(), false); - SkAutoTUnref<BareMemoryAllocator> allocator(SkNEW_ARGS(BareMemoryAllocator, - (info, pixels, rowBytes))); + SkAutoTUnref<BareMemoryAllocator> allocator( + new BareMemoryAllocator(info, pixels, rowBytes)); fDecoder->setAllocator(allocator); fDecoder->setRequireUnpremultipliedColors(kUnpremul_SkAlphaType == info.alphaType()); @@ -97,9 +97,9 @@ SkImageGenerator* SkImageGenerator::NewFromEncodedImpl(SkData* data) { SkBitmap bm; stream.rewind(); if (!decoder->decode(&stream, &bm, kUnknown_SkColorType, SkImageDecoder::kDecodeBounds_Mode)) { - SkDELETE(decoder); + delete decoder; return NULL; } - return SkNEW_ARGS(SkImageDecoderGenerator, (bm.info(), decoder, data)); + return new SkImageDecoderGenerator(bm.info(), decoder, data); } diff --git a/src/ports/SkOSFile_posix.cpp b/src/ports/SkOSFile_posix.cpp index b7cf583440..b604c2190c 100644 --- a/src/ports/SkOSFile_posix.cpp +++ b/src/ports/SkOSFile_posix.cpp @@ -104,12 +104,10 @@ struct SkOSFileIterData { }; static_assert(sizeof(SkOSFileIterData) <= SkOSFile::Iter::kStorageSize, "not_enough_space"); -SkOSFile::Iter::Iter() { - SkNEW_PLACEMENT(fSelf.get(), SkOSFileIterData); -} +SkOSFile::Iter::Iter() { new (fSelf.get()) SkOSFileIterData; } SkOSFile::Iter::Iter(const char path[], const char suffix[]) { - SkNEW_PLACEMENT(fSelf.get(), SkOSFileIterData); + new (fSelf.get()) SkOSFileIterData; this->reset(path, suffix); } diff --git a/src/ports/SkOSFile_win.cpp b/src/ports/SkOSFile_win.cpp index 62510e7a4e..64bd516305 100644 --- a/src/ports/SkOSFile_win.cpp +++ b/src/ports/SkOSFile_win.cpp @@ -155,12 +155,10 @@ static uint16_t* concat_to_16(const char src[], const char suffix[]) { return dst; } -SkOSFile::Iter::Iter() { - SkNEW_PLACEMENT(fSelf.get(), SkOSFileIterData); -} +SkOSFile::Iter::Iter() { new (fSelf.get()) SkOSFileIterData; } SkOSFile::Iter::Iter(const char path[], const char suffix[]) { - SkNEW_PLACEMENT(fSelf.get(), SkOSFileIterData); + new (fSelf.get()) SkOSFileIterData; this->reset(path, suffix); } diff --git a/src/ports/SkRemotableFontMgr_win_dw.cpp b/src/ports/SkRemotableFontMgr_win_dw.cpp index 006346acab..2d06255a24 100644 --- a/src/ports/SkRemotableFontMgr_win_dw.cpp +++ b/src/ports/SkRemotableFontMgr_win_dw.cpp @@ -466,7 +466,7 @@ public: HRNM(loader->CreateStreamFromKey(id.fKey, id.fKeySize, &fontFileStream), "Could not create font file stream."); - return SkNEW_ARGS(SkDWriteFontFileStream, (fontFileStream.get())); + return new SkDWriteFontFileStream(fontFileStream.get()); } private: @@ -502,6 +502,5 @@ SkRemotableFontMgr* SkRemotableFontMgr_New_DirectWrite() { }; } - return SkNEW_ARGS(SkRemotableFontMgr_DirectWrite, (sysFontCollection.get(), - localeName, localeNameLen)); + return new SkRemotableFontMgr_DirectWrite(sysFontCollection.get(), localeName, localeNameLen); } diff --git a/src/ports/SkTypeface_win_dw.cpp b/src/ports/SkTypeface_win_dw.cpp index 90dc2c49ad..3af4cca4b2 100644 --- a/src/ports/SkTypeface_win_dw.cpp +++ b/src/ports/SkTypeface_win_dw.cpp @@ -239,11 +239,11 @@ SkStreamAsset* DWriteFontTypeface::onOpenStream(int* ttcIndex) const { &fontFileStream), "Could not create font file stream."); - return SkNEW_ARGS(SkDWriteFontFileStream, (fontFileStream.get())); + return new SkDWriteFontFileStream(fontFileStream.get()); } SkScalerContext* DWriteFontTypeface::onCreateScalerContext(const SkDescriptor* desc) const { - return SkNEW_ARGS(SkScalerContext_DW, (const_cast<DWriteFontTypeface*>(this), desc)); + return new SkScalerContext_DW(const_cast<DWriteFontTypeface*>(this), desc); } void DWriteFontTypeface::onFilterRec(SkScalerContext::Rec* rec) const { diff --git a/src/ports/SkTypeface_win_dw.h b/src/ports/SkTypeface_win_dw.h index 71d928bcb9..866e634d78 100644 --- a/src/ports/SkTypeface_win_dw.h +++ b/src/ports/SkTypeface_win_dw.h @@ -78,9 +78,8 @@ public: IDWriteFontFileLoader* fontFileLoader = NULL, IDWriteFontCollectionLoader* fontCollectionLoader = NULL) { SkFontID fontID = SkTypefaceCache::NewFontID(); - return SkNEW_ARGS(DWriteFontTypeface, (get_style(font), fontID, - factory, fontFace, font, fontFamily, - fontFileLoader, fontCollectionLoader)); + return new DWriteFontTypeface(get_style(font), fontID, factory, fontFace, font, fontFamily, + fontFileLoader, fontCollectionLoader); } protected: |