diff options
author | mdempsky <mdempsky@chromium.org> | 2015-09-22 06:10:35 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-22 06:10:35 -0700 |
commit | 106b12427e642d067dd5b48664eb693653853583 (patch) | |
tree | d70686c724a895ae98e04574d432c0eecef030f5 | |
parent | 55fb4f3fdaa301c1c251259fedff4ab0b958c23b (diff) |
Remove SkNEW and SkDELETE macros
This CL removes the uses of SkNEW that have resprouted since commit
385fe4d, and removes the macros entirely now that Android and Chromium
have been cleaned up to no longer depend on them.
A bunch of files implicitly depend on #include <new> from SkPostConfig.h
still though, so keep that for now. To be fixed in a followup CL.
[mtklein mucking around]
Only public API removed.
TBR=reed@google.com
Review URL: https://codereview.chromium.org/1360653004
-rw-r--r-- | include/core/SkImageGenerator.h | 6 | ||||
-rw-r--r-- | include/core/SkPostConfig.h | 12 | ||||
-rw-r--r-- | include/gpu/effects/GrExtractAlphaFragmentProcessor.h | 2 | ||||
-rw-r--r-- | src/codec/SkBmpCodec.cpp | 2 | ||||
-rw-r--r-- | src/codec/SkCodec_libgif.cpp | 2 | ||||
-rw-r--r-- | src/effects/SkImageSource.cpp | 4 | ||||
-rw-r--r-- | src/gpu/batches/GrDrawPathBatch.h | 4 | ||||
-rw-r--r-- | src/gpu/effects/GrExtractAlphaFragmentProcessor.cpp | 4 | ||||
-rw-r--r-- | src/image/SkImage_Generator.cpp | 2 |
9 files changed, 15 insertions, 23 deletions
diff --git a/include/core/SkImageGenerator.h b/include/core/SkImageGenerator.h index fdafa0b87b..b91aa653a5 100644 --- a/include/core/SkImageGenerator.h +++ b/include/core/SkImageGenerator.h @@ -30,9 +30,9 @@ class SkPicture; * If generator is NULL, will safely return false. * * 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(). + * installed into destination is destroyed, it will + * delete 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/include/core/SkPostConfig.h b/include/core/SkPostConfig.h index f4ce102858..f228937305 100644 --- a/include/core/SkPostConfig.h +++ b/include/core/SkPostConfig.h @@ -100,16 +100,8 @@ /////////////////////////////////////////////////////////////////////////////// -#ifndef SkNEW -# include <new> -# define SkNEW(type_name) (new type_name) -# define SkNEW_ARGS(type_name, args) (new type_name args) -# define SkNEW_ARRAY(type_name, count) (new type_name[(count)]) -# define SkNEW_PLACEMENT(buf, type_name) (new (buf) type_name) -# define SkNEW_PLACEMENT_ARGS(buf, type_name, args) (new (buf) type_name args) -# define SkDELETE(obj) (delete (obj)) -# define SkDELETE_ARRAY(array) (delete[] (array)) -#endif +// TODO(mdempsky): Move elsewhere as appropriate. +#include <new> #ifndef SK_CRASH # ifdef SK_BUILD_FOR_WIN diff --git a/include/gpu/effects/GrExtractAlphaFragmentProcessor.h b/include/gpu/effects/GrExtractAlphaFragmentProcessor.h index 59ae019887..29ff097d9d 100644 --- a/include/gpu/effects/GrExtractAlphaFragmentProcessor.h +++ b/include/gpu/effects/GrExtractAlphaFragmentProcessor.h @@ -18,7 +18,7 @@ public: if (!processor) { return nullptr; } - return SkNEW_ARGS(GrExtractAlphaFragmentProcessor, (processor)); + return new GrExtractAlphaFragmentProcessor(processor); } ~GrExtractAlphaFragmentProcessor() override {} diff --git a/src/codec/SkBmpCodec.cpp b/src/codec/SkBmpCodec.cpp index 406a603dce..a55cb8cf55 100644 --- a/src/codec/SkBmpCodec.cpp +++ b/src/codec/SkBmpCodec.cpp @@ -640,5 +640,5 @@ SkScanlineDecoder* SkBmpCodec::NewSDFromStream(SkStream* stream) { return NULL; } - return SkNEW_ARGS(SkBmpScanlineDecoder, (codec.detach())); + return new SkBmpScanlineDecoder(codec.detach()); } diff --git a/src/codec/SkCodec_libgif.cpp b/src/codec/SkCodec_libgif.cpp index 03980b586a..d8889defaf 100644 --- a/src/codec/SkCodec_libgif.cpp +++ b/src/codec/SkCodec_libgif.cpp @@ -701,5 +701,5 @@ SkScanlineDecoder* SkGifCodec::NewSDFromStream(SkStream* stream) { const SkImageInfo& srcInfo = codec->getInfo(); - return SkNEW_ARGS(SkGifScanlineDecoder, (srcInfo, codec.detach())); + return new SkGifScanlineDecoder(srcInfo, codec.detach()); } diff --git a/src/effects/SkImageSource.cpp b/src/effects/SkImageSource.cpp index 8f8c72b75c..2686fcb6c6 100644 --- a/src/effects/SkImageSource.cpp +++ b/src/effects/SkImageSource.cpp @@ -15,14 +15,14 @@ #include "SkString.h" SkImageFilter* SkImageSource::Create(const SkImage* image) { - return image ? SkNEW_ARGS(SkImageSource, (image)) : nullptr; + return image ? new SkImageSource(image) : nullptr; } SkImageFilter* SkImageSource::Create(const SkImage* image, const SkRect& srcRect, const SkRect& dstRect, SkFilterQuality filterQuality) { - return image ? SkNEW_ARGS(SkImageSource, (image, srcRect, dstRect, filterQuality)) : nullptr; + return image ? new SkImageSource(image, srcRect, dstRect, filterQuality) : nullptr; } SkImageSource::SkImageSource(const SkImage* image) diff --git a/src/gpu/batches/GrDrawPathBatch.h b/src/gpu/batches/GrDrawPathBatch.h index 228ad86617..bb76abb26b 100644 --- a/src/gpu/batches/GrDrawPathBatch.h +++ b/src/gpu/batches/GrDrawPathBatch.h @@ -97,7 +97,7 @@ public: static GrPathRangeDraw* Create(GrPathRange* range, TransformType transformType, int reserveCnt) { - return SkNEW_ARGS(GrPathRangeDraw, (range, transformType, reserveCnt)); + return new GrPathRangeDraw(range, transformType, reserveCnt); } void append(uint16_t index, float transform[]) { @@ -154,7 +154,7 @@ public: // This can't return a more abstract type because we install the stencil settings late :( static GrDrawPathBatchBase* Create(const SkMatrix& viewMatrix, const SkMatrix& localMatrix, GrColor color, GrPathRangeDraw* pathRangeDraw) { - return SkNEW_ARGS(GrDrawPathRangeBatch, (viewMatrix, localMatrix, color, pathRangeDraw)); + return new GrDrawPathRangeBatch(viewMatrix, localMatrix, color, pathRangeDraw); } ~GrDrawPathRangeBatch() override; diff --git a/src/gpu/effects/GrExtractAlphaFragmentProcessor.cpp b/src/gpu/effects/GrExtractAlphaFragmentProcessor.cpp index 483df64502..93a394eb78 100644 --- a/src/gpu/effects/GrExtractAlphaFragmentProcessor.cpp +++ b/src/gpu/effects/GrExtractAlphaFragmentProcessor.cpp @@ -28,7 +28,7 @@ private: }; GrGLFragmentProcessor* GrExtractAlphaFragmentProcessor::onCreateGLInstance() const { - return SkNEW(GLExtractAlphaFragmentProcessor); + return new GLExtractAlphaFragmentProcessor; } void GrExtractAlphaFragmentProcessor::onGetGLProcessorKey(const GrGLSLCaps&, @@ -52,5 +52,5 @@ GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrExtractAlphaFragmentProcessor); const GrFragmentProcessor* GrExtractAlphaFragmentProcessor::TestCreate(GrProcessorTestData* d) { SkAutoTUnref<const GrFragmentProcessor> child(GrProcessorUnitTest::CreateChildFP(d)); - return SkNEW_ARGS(GrExtractAlphaFragmentProcessor, (child)); + return new GrExtractAlphaFragmentProcessor(child); } diff --git a/src/image/SkImage_Generator.cpp b/src/image/SkImage_Generator.cpp index 0f1fa3692c..4981f37c08 100644 --- a/src/image/SkImage_Generator.cpp +++ b/src/image/SkImage_Generator.cpp @@ -89,5 +89,5 @@ SkImage* SkImage::NewFromGenerator(SkImageGenerator* generator, const SkIRect* s if (!cache) { return nullptr; } - return SkNEW_ARGS(SkImage_Generator, (cache)); + return new SkImage_Generator(cache); } |