Style Change: SkNEW->new; SkDELETE->delete
DOCS_PREVIEW= https://skia.org/?cl=1316123003
Review URL: https://codereview.chromium.org/1316123003
diff --git a/bench/AAClipBench.cpp b/bench/AAClipBench.cpp
index 4cc9abe..978a371 100644
--- a/bench/AAClipBench.cpp
+++ b/bench/AAClipBench.cpp
@@ -244,14 +244,14 @@
////////////////////////////////////////////////////////////////////////////////
-DEF_BENCH( return SkNEW_ARGS(AAClipBuilderBench, (false, false)); )
-DEF_BENCH( return SkNEW_ARGS(AAClipBuilderBench, (false, true)); )
-DEF_BENCH( return SkNEW_ARGS(AAClipBuilderBench, (true, false)); )
-DEF_BENCH( return SkNEW_ARGS(AAClipBuilderBench, (true, true)); )
-DEF_BENCH( return SkNEW_ARGS(AAClipRegionBench, ()); )
-DEF_BENCH( return SkNEW_ARGS(AAClipBench, (false, false)); )
-DEF_BENCH( return SkNEW_ARGS(AAClipBench, (false, true)); )
-DEF_BENCH( return SkNEW_ARGS(AAClipBench, (true, false)); )
-DEF_BENCH( return SkNEW_ARGS(AAClipBench, (true, true)); )
-DEF_BENCH( return SkNEW_ARGS(NestedAAClipBench, (false)); )
-DEF_BENCH( return SkNEW_ARGS(NestedAAClipBench, (true)); )
+DEF_BENCH(return new AAClipBuilderBench(false, false);)
+DEF_BENCH(return new AAClipBuilderBench(false, true);)
+DEF_BENCH(return new AAClipBuilderBench(true, false);)
+DEF_BENCH(return new AAClipBuilderBench(true, true);)
+DEF_BENCH(return new AAClipRegionBench();)
+DEF_BENCH(return new AAClipBench(false, false);)
+DEF_BENCH(return new AAClipBench(false, true);)
+DEF_BENCH(return new AAClipBench(true, false);)
+DEF_BENCH(return new AAClipBench(true, true);)
+DEF_BENCH(return new NestedAAClipBench(false);)
+DEF_BENCH(return new NestedAAClipBench(true);)
diff --git a/bench/AlternatingColorPatternBench.cpp b/bench/AlternatingColorPatternBench.cpp
index cbf5034..08a28ea 100644
--- a/bench/AlternatingColorPatternBench.cpp
+++ b/bench/AlternatingColorPatternBench.cpp
@@ -169,33 +169,32 @@
typedef Benchmark INHERITED;
};
-DEF_BENCH( return SkNEW_ARGS(AlternatingColorPatternBench,
- (kWhite_ColorPattern, kWhite_ColorPattern,
- kPath_DrawType)); )
-DEF_BENCH( return SkNEW_ARGS(AlternatingColorPatternBench,
- (kBlue_ColorPattern, kBlue_ColorPattern,
- kPath_DrawType)); )
-DEF_BENCH( return SkNEW_ARGS(AlternatingColorPatternBench,
- (kWhite_ColorPattern, kBlue_ColorPattern,
- kPath_DrawType)); )
+DEF_BENCH(return new AlternatingColorPatternBench(kWhite_ColorPattern,
+ kWhite_ColorPattern,
+ kPath_DrawType);)
+DEF_BENCH(return new AlternatingColorPatternBench(kBlue_ColorPattern,
+ kBlue_ColorPattern,
+ kPath_DrawType);)
+DEF_BENCH(return new AlternatingColorPatternBench(kWhite_ColorPattern,
+ kBlue_ColorPattern,
+ kPath_DrawType);)
-DEF_BENCH( return SkNEW_ARGS(AlternatingColorPatternBench,
- (kOpaqueBitmap_ColorPattern, kOpaqueBitmap_ColorPattern,
- kPath_DrawType)); )
-DEF_BENCH( return SkNEW_ARGS(AlternatingColorPatternBench,
- (kAlphaBitmap_ColorPattern, kAlphaBitmap_ColorPattern,
- kPath_DrawType)); )
-DEF_BENCH( return SkNEW_ARGS(AlternatingColorPatternBench,
- (kOpaqueBitmap_ColorPattern, kAlphaBitmap_ColorPattern,
- kPath_DrawType)); )
+DEF_BENCH(return new AlternatingColorPatternBench(kOpaqueBitmap_ColorPattern,
+ kOpaqueBitmap_ColorPattern,
+ kPath_DrawType);)
+DEF_BENCH(return new AlternatingColorPatternBench(kAlphaBitmap_ColorPattern,
+ kAlphaBitmap_ColorPattern,
+ kPath_DrawType);)
+DEF_BENCH(return new AlternatingColorPatternBench(kOpaqueBitmap_ColorPattern,
+ kAlphaBitmap_ColorPattern,
+ kPath_DrawType);)
-DEF_BENCH( return SkNEW_ARGS(AlternatingColorPatternBench,
- (kOpaqueBitmap_ColorPattern, kOpaqueBitmap_ColorPattern,
- kRect_DrawType)); )
-DEF_BENCH( return SkNEW_ARGS(AlternatingColorPatternBench,
- (kAlphaBitmap_ColorPattern, kAlphaBitmap_ColorPattern,
- kRect_DrawType)); )
-DEF_BENCH( return SkNEW_ARGS(AlternatingColorPatternBench,
- (kOpaqueBitmap_ColorPattern, kAlphaBitmap_ColorPattern,
- kRect_DrawType)); )
-
+DEF_BENCH(return new AlternatingColorPatternBench(kOpaqueBitmap_ColorPattern,
+ kOpaqueBitmap_ColorPattern,
+ kRect_DrawType);)
+DEF_BENCH(return new AlternatingColorPatternBench(kAlphaBitmap_ColorPattern,
+ kAlphaBitmap_ColorPattern,
+ kRect_DrawType);)
+DEF_BENCH(return new AlternatingColorPatternBench(kOpaqueBitmap_ColorPattern,
+ kAlphaBitmap_ColorPattern,
+ kRect_DrawType);)
diff --git a/bench/BenchLogger.cpp b/bench/BenchLogger.cpp
index 98423d0..5e74552 100644
--- a/bench/BenchLogger.cpp
+++ b/bench/BenchLogger.cpp
@@ -14,12 +14,12 @@
BenchLogger::~BenchLogger() {
if (fFileStream) {
- SkDELETE(fFileStream);
+ delete fFileStream;
}
}
bool BenchLogger::SetLogFile(const char *file) {
- fFileStream = SkNEW_ARGS(SkFILEWStream, (file));
+ fFileStream = new SkFILEWStream(file);
return fFileStream->isValid();
}
diff --git a/bench/ChromeBench.cpp b/bench/ChromeBench.cpp
index 4938785..231d09b 100644
--- a/bench/ChromeBench.cpp
+++ b/bench/ChromeBench.cpp
@@ -493,4 +493,4 @@
// Disabled this benchmark: it takes 15x longer than any other benchmark
// and is probably not giving us important information.
-// DEF_BENCH(return SkNEW(ScrollGmailBench));
+// DEF_BENCH(return new ScrollGmailBench);
diff --git a/bench/ColorPrivBench.cpp b/bench/ColorPrivBench.cpp
index e6c68b5..9c8acce 100644
--- a/bench/ColorPrivBench.cpp
+++ b/bench/ColorPrivBench.cpp
@@ -1,3 +1,9 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
#include "Benchmark.h"
#include "SkColorPriv.h"
#include "SkRandom.h"
@@ -74,8 +80,8 @@
};
#define COMMA ,
-DEF_BENCH( return SkNEW(FourByteInterpBench<true COMMA true>); )
-DEF_BENCH( return SkNEW(FourByteInterpBench<true COMMA false>); )
-DEF_BENCH( return SkNEW(FourByteInterpBench<false COMMA true>); )
-DEF_BENCH( return SkNEW(FourByteInterpBench<false COMMA false>); )
+DEF_BENCH(return (new FourByteInterpBench<true COMMA true>);)
+DEF_BENCH(return (new FourByteInterpBench<true COMMA false>);)
+DEF_BENCH(return (new FourByteInterpBench<false COMMA true>);)
+DEF_BENCH(return (new FourByteInterpBench<false COMMA false>);)
#undef COMMA
diff --git a/bench/FSRectBench.cpp b/bench/FSRectBench.cpp
index 914b5b6..03d1504 100644
--- a/bench/FSRectBench.cpp
+++ b/bench/FSRectBench.cpp
@@ -60,4 +60,4 @@
typedef Benchmark INHERITED;
};
-DEF_BENCH( return SkNEW_ARGS(FSRectBench, ()); )
+DEF_BENCH(return new FSRectBench();)
diff --git a/bench/FontScalerBench.cpp b/bench/FontScalerBench.cpp
index 0326a0c..f813adb 100644
--- a/bench/FontScalerBench.cpp
+++ b/bench/FontScalerBench.cpp
@@ -48,5 +48,5 @@
///////////////////////////////////////////////////////////////////////////////
-DEF_BENCH( return SkNEW_ARGS(FontScalerBench, (false)); )
-DEF_BENCH( return SkNEW_ARGS(FontScalerBench, (true)); )
+DEF_BENCH(return new FontScalerBench(false);)
+DEF_BENCH(return new FontScalerBench(true);)
diff --git a/bench/GameBench.cpp b/bench/GameBench.cpp
index 3d9885f..631a8f2 100644
--- a/bench/GameBench.cpp
+++ b/bench/GameBench.cpp
@@ -308,27 +308,18 @@
};
// Partial clear
-DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kScale_Type,
- GameBench::kPartial_Clear)); )
-DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kTranslate_Type,
- GameBench::kPartial_Clear)); )
-DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kTranslate_Type,
- GameBench::kPartial_Clear, true)); )
-DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kRotate_Type,
- GameBench::kPartial_Clear)); )
+DEF_BENCH(return new GameBench(GameBench::kScale_Type, GameBench::kPartial_Clear);)
+DEF_BENCH(return new GameBench(GameBench::kTranslate_Type, GameBench::kPartial_Clear);)
+DEF_BENCH(return new GameBench(GameBench::kTranslate_Type, GameBench::kPartial_Clear, true);)
+DEF_BENCH(return new GameBench(GameBench::kRotate_Type, GameBench::kPartial_Clear);)
// Full clear
-DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kScale_Type,
- GameBench::kFull_Clear)); )
-DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kTranslate_Type,
- GameBench::kFull_Clear)); )
-DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kTranslate_Type,
- GameBench::kFull_Clear, true)); )
-DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kRotate_Type,
- GameBench::kFull_Clear)); )
+DEF_BENCH(return new GameBench(GameBench::kScale_Type, GameBench::kFull_Clear);)
+DEF_BENCH(return new GameBench(GameBench::kTranslate_Type, GameBench::kFull_Clear);)
+DEF_BENCH(return new GameBench(GameBench::kTranslate_Type, GameBench::kFull_Clear, true);)
+DEF_BENCH(return new GameBench(GameBench::kRotate_Type, GameBench::kFull_Clear);)
// Atlased
-DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kTranslate_Type,
- GameBench::kFull_Clear, false, true)); )
-DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kTranslate_Type,
- GameBench::kFull_Clear, false, true, true)); )
+DEF_BENCH(return new GameBench(GameBench::kTranslate_Type, GameBench::kFull_Clear, false, true);)
+DEF_BENCH(return new GameBench(
+ GameBench::kTranslate_Type, GameBench::kFull_Clear, false, true, true);)
diff --git a/bench/GrResourceCacheBench.cpp b/bench/GrResourceCacheBench.cpp
index 1faff97..e7a9ca8 100644
--- a/bench/GrResourceCacheBench.cpp
+++ b/bench/GrResourceCacheBench.cpp
@@ -45,7 +45,7 @@
for (int i = 0; i < resourceCount; ++i) {
GrUniqueKey key;
BenchResource::ComputeKey(i, keyData32Count, &key);
- GrGpuResource* resource = SkNEW_ARGS(BenchResource, (gpu));
+ GrGpuResource* resource = new BenchResource(gpu);
resource->resourcePriv().setUniqueKey(key);
resource->unref();
}
diff --git a/bench/ImageCacheBench.cpp b/bench/ImageCacheBench.cpp
index 96c64f8..4d71cf0 100644
--- a/bench/ImageCacheBench.cpp
+++ b/bench/ImageCacheBench.cpp
@@ -46,7 +46,7 @@
void populateCache() {
for (int i = 0; i < CACHE_COUNT; ++i) {
- fCache.add(SkNEW_ARGS(TestRec, (TestKey(i), i)));
+ fCache.add(new TestRec(TestKey(i), i));
}
}
diff --git a/bench/RTreeBench.cpp b/bench/RTreeBench.cpp
index 3b3dc72..1da9fbe 100644
--- a/bench/RTreeBench.cpp
+++ b/bench/RTreeBench.cpp
@@ -127,12 +127,12 @@
///////////////////////////////////////////////////////////////////////////////
-DEF_BENCH(return SkNEW_ARGS(RTreeBuildBench, ("XY", &make_XYordered_rects)));
-DEF_BENCH(return SkNEW_ARGS(RTreeBuildBench, ("YX", &make_YXordered_rects)));
-DEF_BENCH(return SkNEW_ARGS(RTreeBuildBench, ("random", &make_random_rects)));
-DEF_BENCH(return SkNEW_ARGS(RTreeBuildBench, ("concentric", &make_concentric_rects)));
+DEF_BENCH(return new RTreeBuildBench("XY", &make_XYordered_rects));
+DEF_BENCH(return new RTreeBuildBench("YX", &make_YXordered_rects));
+DEF_BENCH(return new RTreeBuildBench("random", &make_random_rects));
+DEF_BENCH(return new RTreeBuildBench("concentric", &make_concentric_rects));
-DEF_BENCH(return SkNEW_ARGS(RTreeQueryBench, ("XY", &make_XYordered_rects)));
-DEF_BENCH(return SkNEW_ARGS(RTreeQueryBench, ("YX", &make_YXordered_rects)));
-DEF_BENCH(return SkNEW_ARGS(RTreeQueryBench, ("random", &make_random_rects)));
-DEF_BENCH(return SkNEW_ARGS(RTreeQueryBench, ("concentric", &make_concentric_rects)));
+DEF_BENCH(return new RTreeQueryBench("XY", &make_XYordered_rects));
+DEF_BENCH(return new RTreeQueryBench("YX", &make_YXordered_rects));
+DEF_BENCH(return new RTreeQueryBench("random", &make_random_rects));
+DEF_BENCH(return new RTreeQueryBench("concentric", &make_concentric_rects));
diff --git a/bench/RectBench.cpp b/bench/RectBench.cpp
index 4aa6b8b..db36395 100644
--- a/bench/RectBench.cpp
+++ b/bench/RectBench.cpp
@@ -249,40 +249,35 @@
kMaskType _type;
};
+DEF_BENCH(return new RectBench(1);)
+DEF_BENCH(return new RectBench(1, 4);)
+DEF_BENCH(return new RectBench(3);)
+DEF_BENCH(return new RectBench(3, 4);)
+DEF_BENCH(return new OvalBench(1);)
+DEF_BENCH(return new OvalBench(3);)
+DEF_BENCH(return new OvalBench(1, 4);)
+DEF_BENCH(return new OvalBench(3, 4);)
+DEF_BENCH(return new RRectBench(1);)
+DEF_BENCH(return new RRectBench(1, 4);)
+DEF_BENCH(return new RRectBench(3);)
+DEF_BENCH(return new RRectBench(3, 4);)
+DEF_BENCH(return new PointsBench(SkCanvas::kPoints_PointMode, "points");)
+DEF_BENCH(return new PointsBench(SkCanvas::kLines_PointMode, "lines");)
+DEF_BENCH(return new PointsBench(SkCanvas::kPolygon_PointMode, "polygon");)
-DEF_BENCH( return SkNEW_ARGS(RectBench, (1)); )
-DEF_BENCH( return SkNEW_ARGS(RectBench, (1, 4)); )
-DEF_BENCH( return SkNEW_ARGS(RectBench, (3)); )
-DEF_BENCH( return SkNEW_ARGS(RectBench, (3, 4)); )
-DEF_BENCH( return SkNEW_ARGS(OvalBench, (1)); )
-DEF_BENCH( return SkNEW_ARGS(OvalBench, (3)); )
-DEF_BENCH( return SkNEW_ARGS(OvalBench, (1, 4)); )
-DEF_BENCH( return SkNEW_ARGS(OvalBench, (3, 4)); )
-DEF_BENCH( return SkNEW_ARGS(RRectBench, (1)); )
-DEF_BENCH( return SkNEW_ARGS(RRectBench, (1, 4)); )
-DEF_BENCH( return SkNEW_ARGS(RRectBench, (3)); )
-DEF_BENCH( return SkNEW_ARGS(RRectBench, (3, 4)); )
-DEF_BENCH( return SkNEW_ARGS(PointsBench, (SkCanvas::kPoints_PointMode, "points")); )
-DEF_BENCH( return SkNEW_ARGS(PointsBench, (SkCanvas::kLines_PointMode, "lines")); )
-DEF_BENCH( return SkNEW_ARGS(PointsBench, (SkCanvas::kPolygon_PointMode, "polygon")); )
-
-DEF_BENCH( return SkNEW_ARGS(SrcModeRectBench, ()); )
+DEF_BENCH(return new SrcModeRectBench();)
/* init the blitmask bench
*/
-DEF_BENCH( return SkNEW_ARGS(BlitMaskBench,
- (SkCanvas::kPoints_PointMode,
- BlitMaskBench::kMaskOpaque, "maskopaque")
- ); )
-DEF_BENCH( return SkNEW_ARGS(BlitMaskBench,
- (SkCanvas::kPoints_PointMode,
- BlitMaskBench::kMaskBlack, "maskblack")
- ); )
-DEF_BENCH( return SkNEW_ARGS(BlitMaskBench,
- (SkCanvas::kPoints_PointMode,
- BlitMaskBench::kMaskColor, "maskcolor")
- ); )
-DEF_BENCH( return SkNEW_ARGS(BlitMaskBench,
- (SkCanvas::kPoints_PointMode,
- BlitMaskBench::KMaskShader, "maskshader")
- ); )
+DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode,
+ BlitMaskBench::kMaskOpaque,
+ "maskopaque");)
+DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode,
+ BlitMaskBench::kMaskBlack,
+ "maskblack");)
+DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode,
+ BlitMaskBench::kMaskColor,
+ "maskcolor");)
+DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode,
+ BlitMaskBench::KMaskShader,
+ "maskshader");)
diff --git a/bench/RectanizerBench.cpp b/bench/RectanizerBench.cpp
index f7e1f04..506a363 100644
--- a/bench/RectanizerBench.cpp
+++ b/bench/RectanizerBench.cpp
@@ -76,10 +76,10 @@
SkASSERT(NULL == fRectanizer.get());
if (kPow2_RectanizerType == fRectanizerType) {
- fRectanizer.reset(SkNEW_ARGS(GrRectanizerPow2, (kWidth, kHeight)));
+ fRectanizer.reset(new GrRectanizerPow2(kWidth, kHeight));
} else {
SkASSERT(kSkyline_RectanizerType == fRectanizerType);
- fRectanizer.reset(SkNEW_ARGS(GrRectanizerSkyline, (kWidth, kHeight)));
+ fRectanizer.reset(new GrRectanizerSkyline(kWidth, kHeight));
}
}
diff --git a/bench/RectoriBench.cpp b/bench/RectoriBench.cpp
index 8752a34..8d8bd3d 100644
--- a/bench/RectoriBench.cpp
+++ b/bench/RectoriBench.cpp
@@ -102,4 +102,4 @@
typedef Benchmark INHERITED;
};
-DEF_BENCH( return SkNEW_ARGS(RectoriBench, ()); )
+DEF_BENCH(return new RectoriBench();)
diff --git a/bench/RegionBench.cpp b/bench/RegionBench.cpp
index 2188cb3..b6f763c 100644
--- a/bench/RegionBench.cpp
+++ b/bench/RegionBench.cpp
@@ -121,12 +121,12 @@
#define SMALL 16
-DEF_BENCH( return SkNEW_ARGS(RegionBench, (SMALL, union_proc, "union")); )
-DEF_BENCH( return SkNEW_ARGS(RegionBench, (SMALL, sect_proc, "intersect")); )
-DEF_BENCH( return SkNEW_ARGS(RegionBench, (SMALL, diff_proc, "difference")); )
-DEF_BENCH( return SkNEW_ARGS(RegionBench, (SMALL, diffrect_proc, "differencerect")); )
-DEF_BENCH( return SkNEW_ARGS(RegionBench, (SMALL, diffrectbig_proc, "differencerectbig")); )
-DEF_BENCH( return SkNEW_ARGS(RegionBench, (SMALL, containsrect_proc, "containsrect")); )
-DEF_BENCH( return SkNEW_ARGS(RegionBench, (SMALL, sectsrgn_proc, "intersectsrgn")); )
-DEF_BENCH( return SkNEW_ARGS(RegionBench, (SMALL, sectsrect_proc, "intersectsrect")); )
-DEF_BENCH( return SkNEW_ARGS(RegionBench, (SMALL, containsxy_proc, "containsxy")); )
+DEF_BENCH(return new RegionBench(SMALL, union_proc, "union");)
+DEF_BENCH(return new RegionBench(SMALL, sect_proc, "intersect");)
+DEF_BENCH(return new RegionBench(SMALL, diff_proc, "difference");)
+DEF_BENCH(return new RegionBench(SMALL, diffrect_proc, "differencerect");)
+DEF_BENCH(return new RegionBench(SMALL, diffrectbig_proc, "differencerectbig");)
+DEF_BENCH(return new RegionBench(SMALL, containsrect_proc, "containsrect");)
+DEF_BENCH(return new RegionBench(SMALL, sectsrgn_proc, "intersectsrgn");)
+DEF_BENCH(return new RegionBench(SMALL, sectsrect_proc, "intersectsrect");)
+DEF_BENCH(return new RegionBench(SMALL, containsxy_proc, "containsxy");)
diff --git a/bench/RegionContainBench.cpp b/bench/RegionContainBench.cpp
index dfee956..10a6007 100644
--- a/bench/RegionContainBench.cpp
+++ b/bench/RegionContainBench.cpp
@@ -64,4 +64,4 @@
typedef Benchmark INHERITED;
};
-DEF_BENCH( return SkNEW_ARGS(RegionContainBench, (sect_proc, "sect")); )
+DEF_BENCH(return new RegionContainBench(sect_proc, "sect");)
diff --git a/bench/SKPAnimationBench.cpp b/bench/SKPAnimationBench.cpp
index 02fd48a..f43dc80 100644
--- a/bench/SKPAnimationBench.cpp
+++ b/bench/SKPAnimationBench.cpp
@@ -71,5 +71,5 @@
SKPAnimationBench::Animation* SKPAnimationBench::CreateZoomAnimation(SkScalar zoomMax,
double zoomPeriodMs) {
- return SkNEW_ARGS(ZoomAnimation, (zoomMax, zoomPeriodMs));
+ return new ZoomAnimation(zoomMax, zoomPeriodMs);
}
diff --git a/bench/SkipZeroesBench.cpp b/bench/SkipZeroesBench.cpp
index 7840a8a..75fe78a 100644
--- a/bench/SkipZeroesBench.cpp
+++ b/bench/SkipZeroesBench.cpp
@@ -113,5 +113,5 @@
};
// Enable the true version once the feature is checked in.
-DEF_BENCH( return SkNEW_ARGS(SkipZeroesBench, ("arrow.png", true)));
-DEF_BENCH( return SkNEW_ARGS(SkipZeroesBench, ("arrow.png", false)));
+DEF_BENCH(return new SkipZeroesBench("arrow.png", true));
+DEF_BENCH(return new SkipZeroesBench("arrow.png", false));
diff --git a/bench/StrokeBench.cpp b/bench/StrokeBench.cpp
index 70dc79e..750bd06 100644
--- a/bench/StrokeBench.cpp
+++ b/bench/StrokeBench.cpp
@@ -103,17 +103,17 @@
return paint;
}
-DEF_BENCH( return SkNEW_ARGS(StrokeBench, (line_path_maker(), paint_maker(), "line_1", 1)); )
-DEF_BENCH( return SkNEW_ARGS(StrokeBench, (quad_path_maker(), paint_maker(), "quad_1", 1)); )
-DEF_BENCH( return SkNEW_ARGS(StrokeBench, (conic_path_maker(), paint_maker(), "conic_1", 1)); )
-DEF_BENCH( return SkNEW_ARGS(StrokeBench, (cubic_path_maker(), paint_maker(), "cubic_1", 1)); )
+DEF_BENCH(return new StrokeBench(line_path_maker(), paint_maker(), "line_1", 1);)
+DEF_BENCH(return new StrokeBench(quad_path_maker(), paint_maker(), "quad_1", 1);)
+DEF_BENCH(return new StrokeBench(conic_path_maker(), paint_maker(), "conic_1", 1);)
+DEF_BENCH(return new StrokeBench(cubic_path_maker(), paint_maker(), "cubic_1", 1);)
-DEF_BENCH( return SkNEW_ARGS(StrokeBench, (line_path_maker(), paint_maker(), "line_4", 4)); )
-DEF_BENCH( return SkNEW_ARGS(StrokeBench, (quad_path_maker(), paint_maker(), "quad_4", 4)); )
-DEF_BENCH( return SkNEW_ARGS(StrokeBench, (conic_path_maker(), paint_maker(), "conic_4", 4)); )
-DEF_BENCH( return SkNEW_ARGS(StrokeBench, (cubic_path_maker(), paint_maker(), "cubic_4", 4)); )
+DEF_BENCH(return new StrokeBench(line_path_maker(), paint_maker(), "line_4", 4);)
+DEF_BENCH(return new StrokeBench(quad_path_maker(), paint_maker(), "quad_4", 4);)
+DEF_BENCH(return new StrokeBench(conic_path_maker(), paint_maker(), "conic_4", 4);)
+DEF_BENCH(return new StrokeBench(cubic_path_maker(), paint_maker(), "cubic_4", 4);)
-DEF_BENCH( return SkNEW_ARGS(StrokeBench, (line_path_maker(), paint_maker(), "line_.25", .25f)); )
-DEF_BENCH( return SkNEW_ARGS(StrokeBench, (quad_path_maker(), paint_maker(), "quad_.25", .25f)); )
-DEF_BENCH( return SkNEW_ARGS(StrokeBench, (conic_path_maker(), paint_maker(), "conic_.25", .25f)); )
-DEF_BENCH( return SkNEW_ARGS(StrokeBench, (cubic_path_maker(), paint_maker(), "cubic_.25", .25f)); )
+DEF_BENCH(return new StrokeBench(line_path_maker(), paint_maker(), "line_.25", .25f);)
+DEF_BENCH(return new StrokeBench(quad_path_maker(), paint_maker(), "quad_.25", .25f);)
+DEF_BENCH(return new StrokeBench(conic_path_maker(), paint_maker(), "conic_.25", .25f);)
+DEF_BENCH(return new StrokeBench(cubic_path_maker(), paint_maker(), "cubic_.25", .25f);)
diff --git a/bench/VertBench.cpp b/bench/VertBench.cpp
index e426ad8..6e49bf4 100644
--- a/bench/VertBench.cpp
+++ b/bench/VertBench.cpp
@@ -92,4 +92,4 @@
///////////////////////////////////////////////////////////////////////////////
-DEF_BENCH( return SkNEW_ARGS(VertBench, ()); )
+DEF_BENCH(return new VertBench();)
diff --git a/bench/WritePixelsBench.cpp b/bench/WritePixelsBench.cpp
index 3ee9034..0b98cf8 100644
--- a/bench/WritePixelsBench.cpp
+++ b/bench/WritePixelsBench.cpp
@@ -71,5 +71,5 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_BENCH( return SkNEW_ARGS(WritePixelsBench, (kRGBA_8888_SkColorType, kPremul_SkAlphaType)); )
-DEF_BENCH( return SkNEW_ARGS(WritePixelsBench, (kRGBA_8888_SkColorType, kUnpremul_SkAlphaType)); )
+DEF_BENCH(return new WritePixelsBench(kRGBA_8888_SkColorType, kPremul_SkAlphaType);)
+DEF_BENCH(return new WritePixelsBench(kRGBA_8888_SkColorType, kUnpremul_SkAlphaType);)
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 550a35f..75d0ce3 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -514,7 +514,7 @@
SkPMColor colors[256];
int colorCount;
const SkImageInfo info = codec->getInfo().makeColorType(colorType);
- SkAutoTDeleteArray<uint8_t> row(SkNEW_ARRAY(uint8_t, info.minRowBytes()));
+ SkAutoTDeleteArray<uint8_t> row(new uint8_t[info.minRowBytes()]);
SkAutoTDelete<SkScanlineDecoder> scanlineDecoder(SkScanlineDecoder::NewFromData(encoded));
if (NULL == scanlineDecoder || scanlineDecoder->start(info, NULL,
colors, &colorCount) != SkCodec::kSuccess)
@@ -553,7 +553,7 @@
}
static void cleanup_run(Target* target) {
- SkDELETE(target);
+ delete target;
#if SK_SUPPORT_GPU
if (FLAGS_abandonGpuContext) {
gGrFactory->abandonContexts();
@@ -676,7 +676,7 @@
if (gm->runAsBench()) {
fSourceType = "gm";
fBenchType = "micro";
- return SkNEW_ARGS(GMBench, (gm.detach()));
+ return new GMBench(gm.detach());
}
}
@@ -692,7 +692,7 @@
fBenchType = "recording";
fSKPBytes = static_cast<double>(SkPictureUtils::ApproximateBytesUsed(pic));
fSKPOps = pic->approximateOpCount();
- return SkNEW_ARGS(RecordingBench, (name.c_str(), pic.get(), FLAGS_bbh));
+ return new RecordingBench(name.c_str(), pic.get(), FLAGS_bbh);
}
// Then once each for each scale as SKPBenches (playback).
@@ -720,10 +720,8 @@
SkString name = SkOSPath::Basename(path.c_str());
fSourceType = "skp";
fBenchType = "playback";
- return SkNEW_ARGS(SKPBench,
- (name.c_str(), pic.get(), fClip, fScales[fCurrentScale],
- fUseMPDs[fCurrentUseMPD++], FLAGS_loopSKP));
-
+ return new SKPBench(name.c_str(), pic.get(), fClip, fScales[fCurrentScale],
+ fUseMPDs[fCurrentUseMPD++], FLAGS_loopSKP);
}
fCurrentUseMPD = 0;
fCurrentSKP++;
@@ -746,8 +744,8 @@
SkString name = SkOSPath::Basename(path.c_str());
SkAutoTUnref<SKPAnimationBench::Animation> animation(
SKPAnimationBench::CreateZoomAnimation(fZoomMax, fZoomPeriodMs));
- return SkNEW_ARGS(SKPAnimationBench, (name.c_str(), pic.get(), fClip, animation,
- FLAGS_loopSKP));
+ return new SKPAnimationBench(name.c_str(), pic.get(), fClip, animation,
+ FLAGS_loopSKP);
}
}
@@ -944,7 +942,7 @@
#if SK_SUPPORT_GPU
GrContextOptions grContextOpts;
grContextOpts.fDrawPathToCompressedTexture = FLAGS_gpuCompressAlphaMasks;
- gGrFactory.reset(SkNEW_ARGS(GrContextFactory, (grContextOpts)));
+ gGrFactory.reset(new GrContextFactory(grContextOpts));
#endif
if (FLAGS_veryVerbose) {
@@ -982,9 +980,9 @@
}
}
- SkAutoTDelete<ResultsWriter> log(SkNEW(ResultsWriter));
+ SkAutoTDelete<ResultsWriter> log(new ResultsWriter);
if (!FLAGS_outResultsFile.isEmpty()) {
- log.reset(SkNEW(NanoJSONResultsWriter(FLAGS_outResultsFile[0])));
+ log.reset(new NanoJSONResultsWriter(FLAGS_outResultsFile[0]));
}
if (1 == FLAGS_properties.count() % 2) {
diff --git a/bench/subset/SubsetBenchPriv.h b/bench/subset/SubsetBenchPriv.h
index d2c3410..d387684 100644
--- a/bench/subset/SubsetBenchPriv.h
+++ b/bench/subset/SubsetBenchPriv.h
@@ -40,7 +40,7 @@
static inline void alloc_pixels(SkBitmap* bitmap, const SkImageInfo& info, SkPMColor* colors,
int colorCount) {
if (kIndex_8_SkColorType == info.colorType()) {
- SkAutoTUnref<SkColorTable> colorTable(SkNEW_ARGS(SkColorTable, (colors, colorCount)));
+ SkAutoTUnref<SkColorTable> colorTable(new SkColorTable(colors, colorCount));
bitmap->allocPixels(info, NULL, colorTable);
} else {
bitmap->allocPixels(info);
diff --git a/bench/subset/SubsetSingleBench.cpp b/bench/subset/SubsetSingleBench.cpp
index 303cd55..9713cfd 100644
--- a/bench/subset/SubsetSingleBench.cpp
+++ b/bench/subset/SubsetSingleBench.cpp
@@ -67,7 +67,7 @@
SkAutoTDelete<SkScanlineDecoder> scanlineDecoder(
SkScanlineDecoder::NewFromStream(fStream->duplicate()));
const SkImageInfo info = scanlineDecoder->getInfo().makeColorType(fColorType);
- SkAutoTDeleteArray<uint8_t> row(SkNEW_ARRAY(uint8_t, info.minRowBytes()));
+ SkAutoTDeleteArray<uint8_t> row(new uint8_t[info.minRowBytes()]);
scanlineDecoder->start(info, NULL, colors, &colorCount);
SkBitmap bitmap;
diff --git a/bench/subset/SubsetTranslateBench.cpp b/bench/subset/SubsetTranslateBench.cpp
index 2e66c38..35654d6 100644
--- a/bench/subset/SubsetTranslateBench.cpp
+++ b/bench/subset/SubsetTranslateBench.cpp
@@ -63,7 +63,7 @@
SkAutoTDelete<SkScanlineDecoder> scanlineDecoder(
SkScanlineDecoder::NewFromStream(fStream->duplicate()));
const SkImageInfo info = scanlineDecoder->getInfo().makeColorType(fColorType);
- SkAutoTDeleteArray<uint8_t> row(SkNEW_ARRAY(uint8_t, info.minRowBytes()));
+ SkAutoTDeleteArray<uint8_t> row(new uint8_t[info.minRowBytes()]);
scanlineDecoder->start(info, NULL, colors, &colorCount);
SkBitmap bitmap;
@@ -94,7 +94,7 @@
// We create a color table here to satisfy allocPixels() when the output
// type is kIndex8. It's okay that this is uninitialized since we never
// use it.
- SkColorTable* colorTable = SkNEW_ARGS(SkColorTable, (colors, 0));
+ SkColorTable* colorTable = new SkColorTable(colors, 0);
for (int count = 0; count < n; count++) {
int width, height;
SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(fStream));
diff --git a/bench/subset/SubsetZoomBench.cpp b/bench/subset/SubsetZoomBench.cpp
index 84d50aa..d8abfd7 100644
--- a/bench/subset/SubsetZoomBench.cpp
+++ b/bench/subset/SubsetZoomBench.cpp
@@ -63,7 +63,7 @@
SkAutoTDelete<SkScanlineDecoder> scanlineDecoder(
SkScanlineDecoder::NewFromStream(fStream->duplicate()));
const SkImageInfo info = scanlineDecoder->getInfo().makeColorType(fColorType);
- SkAutoTDeleteArray<uint8_t> row(SkNEW_ARRAY(uint8_t, info.minRowBytes()));
+ SkAutoTDeleteArray<uint8_t> row(new uint8_t[info.minRowBytes()]);
scanlineDecoder->start(info, NULL, colors, &colorCount);
const int centerX = info.width() / 2;
diff --git a/debugger/QT/SkDebuggerGUI.cpp b/debugger/QT/SkDebuggerGUI.cpp
index cd888b2..d86e378 100644
--- a/debugger/QT/SkDebuggerGUI.cpp
+++ b/debugger/QT/SkDebuggerGUI.cpp
@@ -725,7 +725,7 @@
void SkDebuggerGUI::loadPicture(const SkString& fileName) {
fFileName = fileName;
fLoading = true;
- SkAutoTDelete<SkStream> stream(SkNEW_ARGS(SkFILEStream, (fileName.c_str())));
+ SkAutoTDelete<SkStream> stream(new SkFILEStream(fileName.c_str()));
SkPicture* picture = SkPicture::CreateFromStream(stream);
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index a7240b8..d46e590 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -134,7 +134,7 @@
int maxColors = 256;
if (kIndex_8_SkColorType == decodeInfo.colorType()) {
SkPMColor colors[256];
- colorTable.reset(SkNEW_ARGS(SkColorTable, (colors, maxColors)));
+ colorTable.reset(new SkColorTable(colors, maxColors));
colorPtr = const_cast<SkPMColor*>(colorTable->readColors());
colorCountPtr = &maxColors;
}
@@ -220,7 +220,7 @@
largestSubsetDecodeInfo.width(), largestSubsetDecodeInfo.height());
}
const size_t rowBytes = decodeInfo.minRowBytes();
- char* buffer = SkNEW_ARRAY(char, largestSubsetDecodeInfo.height() * rowBytes);
+ char* buffer = new char[largestSubsetDecodeInfo.height() * rowBytes];
SkAutoTDeleteArray<char> lineDeleter(buffer);
for (int col = 0; col < divisor; col++) {
//currentSubsetWidth may be larger than subsetWidth for rightmost subsets
@@ -767,7 +767,7 @@
SVGSink::SVGSink() {}
Error SVGSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const {
- SkAutoTDelete<SkXMLWriter> xmlWriter(SkNEW_ARGS(SkXMLStreamWriter, (dst)));
+ SkAutoTDelete<SkXMLWriter> xmlWriter(new SkXMLStreamWriter(dst));
SkAutoTUnref<SkCanvas> canvas(SkSVGCanvas::Create(
SkRect::MakeWH(SkIntToScalar(src.size().width()), SkIntToScalar(src.size().height())),
xmlWriter));
diff --git a/experimental/SimpleCocoaApp/SimpleApp.mm b/experimental/SimpleCocoaApp/SimpleApp.mm
index 7dac2a4..6f9958f 100644
--- a/experimental/SimpleCocoaApp/SimpleApp.mm
+++ b/experimental/SimpleCocoaApp/SimpleApp.mm
@@ -1,3 +1,9 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
#include "SkCanvas.h"
#include "SkCGUtils.h"
#include "SkGraphics.h"
@@ -23,15 +29,14 @@
SkBitmap bm;
if (SkImageDecoder::DecodeFile(path, &bm)) {
bm.setImmutable();
- pic = SkNEW(SkPicture);
+ pic = new SkPicture;
SkCanvas* can = pic->beginRecording(bm.width(), bm.height());
can->drawBitmap(bm, 0, 0, NULL);
pic->endRecording();
} else {
SkFILEStream stream(path);
if (stream.isValid()) {
- pic = SkNEW_ARGS(SkPicture,
- (&stream, NULL, &SkImageDecoder::DecodeStream));
+ pic = new SkPicture(&stream, NULL, &SkImageDecoder::DecodeStream);
}
if (false) { // re-record
@@ -247,7 +252,7 @@
canvas.divName(filename, false);
SkPicture* pic = LoadPicture(path.c_str());
pic->draw(&canvas);
- SkDELETE(pic);
+ delete pic;
}
SkDebugf("\n</div>\n\n");
@@ -261,7 +266,7 @@
canvas.divName(filename, true);
SkPicture* pic = LoadPicture(path.c_str());
pic->draw(&canvas);
- SkDELETE(pic);
+ delete pic;
}
SkDebugf("];\n\n");
diff --git a/gm/aaclip.cpp b/gm/aaclip.cpp
index 10733b3..7ede6a5 100644
--- a/gm/aaclip.cpp
+++ b/gm/aaclip.cpp
@@ -105,7 +105,7 @@
typedef skiagm::GM INHERITED;
};
-DEF_GM( return SkNEW(AAClipGM); )
+DEF_GM(return new AAClipGM;)
/////////////////////////////////////////////////////////////////////////
@@ -118,7 +118,7 @@
(SkPMColor*)bm.getPixels(),
bm.rowBytes());
} else {
- return SkNEW_ARGS(SkCanvas, (bm));
+ return new SkCanvas(bm);
}
}
@@ -190,7 +190,7 @@
};
#if 0 // Disabled pending fix from reed@
-DEF_GM( return SkNEW(CGImageGM); )
+DEF_GM( return new CGImageGM; )
#endif
#endif
@@ -260,5 +260,4 @@
private:
typedef skiagm::GM INHERITED;
};
-DEF_GM( return SkNEW(ClipCubicGM); )
-
+DEF_GM(return new ClipCubicGM;)
diff --git a/gm/all_bitmap_configs.cpp b/gm/all_bitmap_configs.cpp
index 7ff8675..2fbd71d 100644
--- a/gm/all_bitmap_configs.cpp
+++ b/gm/all_bitmap_configs.cpp
@@ -124,8 +124,7 @@
pmColors[i] = premultiply_color(colors[i]);
}
SkBitmap bm;
- SkAutoTUnref<SkColorTable> ctable(
- SkNEW_ARGS(SkColorTable, (pmColors, SK_ARRAY_COUNT(pmColors))));
+ SkAutoTUnref<SkColorTable> ctable(new SkColorTable(pmColors, SK_ARRAY_COUNT(pmColors)));
SkImageInfo info = SkImageInfo::Make(SCALE, SCALE, kIndex_8_SkColorType,
kPremul_SkAlphaType);
bm.allocPixels(info, NULL, ctable);
diff --git a/gm/alphagradients.cpp b/gm/alphagradients.cpp
index 426acaa..b209cec 100644
--- a/gm/alphagradients.cpp
+++ b/gm/alphagradients.cpp
@@ -76,4 +76,4 @@
typedef skiagm::GM INHERITED;
};
-DEF_GM( return SkNEW(AlphaGradientsGM); )
+DEF_GM(return new AlphaGradientsGM;)
diff --git a/gm/anisotropic.cpp b/gm/anisotropic.cpp
index c1f5190..6610926 100644
--- a/gm/anisotropic.cpp
+++ b/gm/anisotropic.cpp
@@ -109,6 +109,5 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(AnisotropicGM); )
-
+DEF_GM(return new AnisotropicGM;)
}
diff --git a/gm/arcofzorro.cpp b/gm/arcofzorro.cpp
index 6efea27..792f7da 100644
--- a/gm/arcofzorro.cpp
+++ b/gm/arcofzorro.cpp
@@ -79,6 +79,5 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(ArcOfZorroGM); )
-
+DEF_GM(return new ArcOfZorroGM;)
}
diff --git a/gm/astcbitmap.cpp b/gm/astcbitmap.cpp
index 316bf88..8ee7746 100644
--- a/gm/astcbitmap.cpp
+++ b/gm/astcbitmap.cpp
@@ -99,4 +99,4 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(skiagm::ASTCBitmapGM); )
+DEF_GM(return new skiagm::ASTCBitmapGM;)
diff --git a/gm/badpaint.cpp b/gm/badpaint.cpp
index cce8146..7c51c74 100644
--- a/gm/badpaint.cpp
+++ b/gm/badpaint.cpp
@@ -57,4 +57,4 @@
/////////////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(BadPaintGM); )
+DEF_GM(return new BadPaintGM;)
diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp
index 2636f26..9edc114 100644
--- a/gm/beziereffects.cpp
+++ b/gm/beziereffects.cpp
@@ -40,7 +40,7 @@
static GrDrawBatch* Create(const GrGeometryProcessor* gp, const Geometry& geo,
const SkScalar klmEqs[9], SkScalar sign) {
- return SkNEW_ARGS(BezierCubicOrConicTestBatch, (gp, geo, klmEqs, sign));
+ return new BezierCubicOrConicTestBatch(gp, geo, klmEqs, sign);
}
private:
@@ -440,7 +440,7 @@
static GrDrawBatch* Create(const GrGeometryProcessor* gp, const Geometry& geo,
const GrPathUtils::QuadUVMatrix& devToUV) {
- return SkNEW_ARGS(BezierQuadTestBatch, (gp, geo, devToUV));
+ return new BezierQuadTestBatch(gp, geo, devToUV);
}
private:
@@ -631,10 +631,9 @@
typedef GM INHERITED;
};
-DEF_GM( return SkNEW(BezierCubicEffects); )
-DEF_GM( return SkNEW(BezierConicEffects); )
-DEF_GM( return SkNEW(BezierQuadEffects); )
-
+DEF_GM(return new BezierCubicEffects;)
+DEF_GM(return new BezierConicEffects;)
+DEF_GM(return new BezierQuadEffects;)
}
#endif
diff --git a/gm/bigblurs.cpp b/gm/bigblurs.cpp
index 5500005..d68b2ca 100644
--- a/gm/bigblurs.cpp
+++ b/gm/bigblurs.cpp
@@ -111,6 +111,5 @@
typedef GM INHERITED;
};
-DEF_GM( return SkNEW(BigBlursGM); )
-
+DEF_GM(return new BigBlursGM;)
}
diff --git a/gm/bigtext.cpp b/gm/bigtext.cpp
index c69d9b9..17f69c5 100644
--- a/gm/bigtext.cpp
+++ b/gm/bigtext.cpp
@@ -52,4 +52,4 @@
typedef skiagm::GM INHERITED;
};
-DEF_GM( return SkNEW(BigTextGM); )
+DEF_GM(return new BigTextGM;)
diff --git a/gm/bigtileimagefilter.cpp b/gm/bigtileimagefilter.cpp
index b788209..dbd41c2 100644
--- a/gm/bigtileimagefilter.cpp
+++ b/gm/bigtileimagefilter.cpp
@@ -103,6 +103,5 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(BigTileImageFilterGM); )
-
+DEF_GM(return new BigTileImageFilterGM;)
}
diff --git a/gm/bitmapsource2.cpp b/gm/bitmapsource2.cpp
index bc4acf7..6c32f62 100644
--- a/gm/bitmapsource2.cpp
+++ b/gm/bitmapsource2.cpp
@@ -82,9 +82,8 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW_ARGS(BitmapSourceGM, ("none", kNone_SkFilterQuality) ); )
-DEF_GM( return SkNEW_ARGS(BitmapSourceGM, ("low", kLow_SkFilterQuality) ); )
-DEF_GM( return SkNEW_ARGS(BitmapSourceGM, ("med", kMedium_SkFilterQuality) ); )
-DEF_GM( return SkNEW_ARGS(BitmapSourceGM, ("high", kHigh_SkFilterQuality) ); )
-
+DEF_GM(return new BitmapSourceGM("none", kNone_SkFilterQuality);)
+DEF_GM(return new BitmapSourceGM("low", kLow_SkFilterQuality);)
+DEF_GM(return new BitmapSourceGM("med", kMedium_SkFilterQuality);)
+DEF_GM(return new BitmapSourceGM("high", kHigh_SkFilterQuality);)
}
diff --git a/gm/bmpfilterqualityrepeat.cpp b/gm/bmpfilterqualityrepeat.cpp
index dd7b901..c147014 100644
--- a/gm/bmpfilterqualityrepeat.cpp
+++ b/gm/bmpfilterqualityrepeat.cpp
@@ -77,4 +77,4 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(BmpFilterQualityRepeat); )
+DEF_GM(return new BmpFilterQualityRepeat;)
diff --git a/gm/clip_strokerect.cpp b/gm/clip_strokerect.cpp
index 0175eda..f4183b1 100644
--- a/gm/clip_strokerect.cpp
+++ b/gm/clip_strokerect.cpp
@@ -67,5 +67,4 @@
typedef skiagm::GM INHERITED;
};
-DEF_GM( return SkNEW(ClipStrokeRectGM); )
-
+DEF_GM(return new ClipStrokeRectGM;)
diff --git a/gm/clipdrawdraw.cpp b/gm/clipdrawdraw.cpp
index 9659201..aa635d9 100644
--- a/gm/clipdrawdraw.cpp
+++ b/gm/clipdrawdraw.cpp
@@ -64,6 +64,5 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM(return SkNEW(ClipDrawDrawGM);)
-
+DEF_GM(return new ClipDrawDrawGM;)
}
diff --git a/gm/cmykjpeg.cpp b/gm/cmykjpeg.cpp
index 851e9c7..d4fb2fa 100644
--- a/gm/cmykjpeg.cpp
+++ b/gm/cmykjpeg.cpp
@@ -38,7 +38,7 @@
stream.rewind();
codec->setDitherImage(dither);
codec->decode(&stream, &fBitmap, kN32_SkColorType, SkImageDecoder::kDecodePixels_Mode);
- SkDELETE(codec);
+ delete codec;
}
}
diff --git a/gm/colorfilters.cpp b/gm/colorfilters.cpp
index bedb7f6..73ca7f3 100644
--- a/gm/colorfilters.cpp
+++ b/gm/colorfilters.cpp
@@ -84,4 +84,4 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(ColorFiltersGM); )
+DEF_GM(return new ColorFiltersGM;)
diff --git a/gm/colortype.cpp b/gm/colortype.cpp
index 8e69664..4d8c9d6 100644
--- a/gm/colortype.cpp
+++ b/gm/colortype.cpp
@@ -40,7 +40,7 @@
if (NULL == orig) {
orig = SkTypeface::RefDefault();
}
- fColorType = SkNEW_ARGS(SkGTypeface, (orig, paint));
+ fColorType = new SkGTypeface(orig, paint);
orig->unref();
}
@@ -70,4 +70,4 @@
typedef skiagm::GM INHERITED;
};
-DEF_GM( return SkNEW(ColorTypeGM); )
+DEF_GM(return new ColorTypeGM;)
diff --git a/gm/colortypexfermode.cpp b/gm/colortypexfermode.cpp
index 97becde..2926523 100644
--- a/gm/colortypexfermode.cpp
+++ b/gm/colortypexfermode.cpp
@@ -47,7 +47,7 @@
if (NULL == orig) {
orig = SkTypeface::RefDefault();
}
- fColorType = SkNEW_ARGS(SkGTypeface, (orig, paint));
+ fColorType = new SkGTypeface(orig, paint);
orig->unref();
fBG.installPixels(SkImageInfo::Make(2, 2, kARGB_4444_SkColorType,
diff --git a/gm/complexclip.cpp b/gm/complexclip.cpp
index ba44aa0..74c877d 100644
--- a/gm/complexclip.cpp
+++ b/gm/complexclip.cpp
@@ -200,13 +200,12 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW_ARGS(ComplexClipGM, (false, false, false)); )
-DEF_GM( return SkNEW_ARGS(ComplexClipGM, (false, false, true)); )
-DEF_GM( return SkNEW_ARGS(ComplexClipGM, (false, true, false)); )
-DEF_GM( return SkNEW_ARGS(ComplexClipGM, (false, true, true)); )
-DEF_GM( return SkNEW_ARGS(ComplexClipGM, (true, false, false)); )
-DEF_GM( return SkNEW_ARGS(ComplexClipGM, (true, false, true)); )
-DEF_GM( return SkNEW_ARGS(ComplexClipGM, (true, true, false)); )
-DEF_GM( return SkNEW_ARGS(ComplexClipGM, (true, true, true)); )
-
+DEF_GM(return new ComplexClipGM(false, false, false);)
+DEF_GM(return new ComplexClipGM(false, false, true);)
+DEF_GM(return new ComplexClipGM(false, true, false);)
+DEF_GM(return new ComplexClipGM(false, true, true);)
+DEF_GM(return new ComplexClipGM(true, false, false);)
+DEF_GM(return new ComplexClipGM(true, false, true);)
+DEF_GM(return new ComplexClipGM(true, true, false);)
+DEF_GM(return new ComplexClipGM(true, true, true);)
}
diff --git a/gm/composeshader.cpp b/gm/composeshader.cpp
index 8933cf3..9d2103b 100644
--- a/gm/composeshader.cpp
+++ b/gm/composeshader.cpp
@@ -35,7 +35,7 @@
SkAutoTUnref<SkXfermode> xfer(SkXfermode::Create(mode));
- return SkNEW_ARGS(SkComposeShader, (shaderA, shaderB, xfer));
+ return new SkComposeShader(shaderA, shaderB, xfer);
}
class ComposeShaderGM : public skiagm::GM {
diff --git a/gm/conicpaths.cpp b/gm/conicpaths.cpp
index 2bdd1f8..71057b8 100644
--- a/gm/conicpaths.cpp
+++ b/gm/conicpaths.cpp
@@ -128,7 +128,7 @@
SkPath fGiantCircle;
typedef skiagm::GM INHERITED;
};
-DEF_GM( return SkNEW(ConicPathsGM); )
+DEF_GM(return new ConicPathsGM;)
//////////////////////////////////////////////////////////////////////////////
diff --git a/gm/constcolorprocessor.cpp b/gm/constcolorprocessor.cpp
index 30544af..2287af4 100644
--- a/gm/constcolorprocessor.cpp
+++ b/gm/constcolorprocessor.cpp
@@ -192,7 +192,7 @@
const SkScalar ConstColorProcessor::kPad = 10.f;
const SkScalar ConstColorProcessor::kRectSize = 20.f;
-DEF_GM( return SkNEW(ConstColorProcessor); )
+DEF_GM(return new ConstColorProcessor;)
}
#endif
diff --git a/gm/convex_all_line_paths.cpp b/gm/convex_all_line_paths.cpp
index 435a37a..6c494cd 100644
--- a/gm/convex_all_line_paths.cpp
+++ b/gm/convex_all_line_paths.cpp
@@ -211,7 +211,7 @@
break;
}
- data.reset(SkNEW_ARRAY(SkPoint, numPts));
+ data.reset(new SkPoint[numPts]);
create_ngon(numPts, data.get(), width, height);
points = data.get();
@@ -317,6 +317,5 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(ConvexLineOnlyPathsGM); )
-
+DEF_GM(return new ConvexLineOnlyPathsGM;)
}
diff --git a/gm/convexpolyclip.cpp b/gm/convexpolyclip.cpp
index 2ed17f2..2aa05a8 100644
--- a/gm/convexpolyclip.cpp
+++ b/gm/convexpolyclip.cpp
@@ -297,6 +297,5 @@
typedef GM INHERITED;
};
-DEF_GM( return SkNEW(ConvexPolyClip); )
-
+DEF_GM(return new ConvexPolyClip;)
}
diff --git a/gm/convexpolyeffect.cpp b/gm/convexpolyeffect.cpp
index 30471a79..bd92069 100644
--- a/gm/convexpolyeffect.cpp
+++ b/gm/convexpolyeffect.cpp
@@ -38,7 +38,7 @@
const char* name() const override { return "ConvexPolyTestBatch"; }
static GrDrawBatch* Create(const GrGeometryProcessor* gp, const Geometry& geo) {
- return SkNEW_ARGS(ConvexPolyTestBatch, (gp, geo));
+ return new ConvexPolyTestBatch(gp, geo);
}
private:
@@ -275,7 +275,7 @@
typedef GM INHERITED;
};
-DEF_GM( return SkNEW(ConvexPolyEffect); )
+DEF_GM(return new ConvexPolyEffect;)
}
#endif
diff --git a/gm/dashing.cpp b/gm/dashing.cpp
index bd906cb..15e4bc2 100644
--- a/gm/dashing.cpp
+++ b/gm/dashing.cpp
@@ -474,10 +474,9 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM(return SkNEW(DashingGM);)
-DEF_GM(return SkNEW(Dashing2GM);)
-DEF_GM(return SkNEW(Dashing3GM);)
-DEF_GM(return SkNEW(Dashing4GM);)
-DEF_GM(return SkNEW_ARGS(Dashing5GM, (true));)
-DEF_GM(return SkNEW_ARGS(Dashing5GM, (false));)
-
+DEF_GM(return new DashingGM;)
+DEF_GM(return new Dashing2GM;)
+DEF_GM(return new Dashing3GM;)
+DEF_GM(return new Dashing4GM;)
+DEF_GM(return new Dashing5GM(true);)
+DEF_GM(return new Dashing5GM(false);)
diff --git a/gm/dcshader.cpp b/gm/dcshader.cpp
index 0c4049b..e0cb2d7 100644
--- a/gm/dcshader.cpp
+++ b/gm/dcshader.cpp
@@ -50,7 +50,7 @@
SkFlattenable* DCShader::CreateProc(SkReadBuffer& buf) {
SkMatrix matrix;
buf.readMatrix(&matrix);
- return SkNEW_ARGS(DCShader, (matrix));
+ return new DCShader(matrix);
}
class DCFP : public GrFragmentProcessor {
@@ -76,7 +76,7 @@
}
void onSetData(const GrGLProgramDataManager&, const GrProcessor&) override {}
};
- return SkNEW(DCGLFP);
+ return new DCGLFP;
}
const char* name() const override { return "DCFP"; }
@@ -98,7 +98,7 @@
const SkMatrix* localMatrix, GrColor* color,
GrProcessorDataManager* procDataManager,
GrFragmentProcessor** fp) const {
- *fp = SkNEW_ARGS(DCFP, (procDataManager, fDeviceMatrix));
+ *fp = new DCFP(procDataManager, fDeviceMatrix);
*color = GrColorPackA4(paint.getAlpha());
return true;
}
@@ -111,7 +111,7 @@
~DCShaderGM() override {
for (int i = 0; i < fPrims.count(); ++i) {
- SkDELETE(fPrims[i]);
+ delete fPrims[i];
}
}
@@ -212,15 +212,15 @@
virtual const char* text() const { return "Hello, Skia!"; }
};
- fPrims.push_back(SkNEW(Rect));
- fPrims.push_back(SkNEW(Circle));
- fPrims.push_back(SkNEW(RRect));
- fPrims.push_back(SkNEW(DRRect));
- fPrims.push_back(SkNEW(Path));
- fPrims.push_back(SkNEW(Points(SkCanvas::kPoints_PointMode)));
- fPrims.push_back(SkNEW(Points(SkCanvas::kLines_PointMode)));
- fPrims.push_back(SkNEW(Points(SkCanvas::kPolygon_PointMode)));
- fPrims.push_back(SkNEW(Text));
+ fPrims.push_back(new Rect);
+ fPrims.push_back(new Circle);
+ fPrims.push_back(new RRect);
+ fPrims.push_back(new DRRect);
+ fPrims.push_back(new Path);
+ fPrims.push_back(new Points(SkCanvas::kPoints_PointMode));
+ fPrims.push_back(new Points(SkCanvas::kLines_PointMode));
+ fPrims.push_back(new Points(SkCanvas::kPolygon_PointMode));
+ fPrims.push_back(new Text);
}
void onDraw(SkCanvas* canvas) override {
@@ -253,7 +253,7 @@
for (int i = 0; i < fPrims.count(); ++i) {
for (int j = 0; j < devMats.count(); ++j) {
for (int k = 0; k < viewMats.count(); ++k) {
- paint.setShader(SkNEW_ARGS(DCShader, (devMats[j])))->unref();
+ paint.setShader(new DCShader(devMats[j]))->unref();
paint.setAntiAlias(SkToBool(aa));
canvas->save();
canvas->concat(viewMats[k]);
@@ -291,6 +291,6 @@
typedef GM INHERITED;
};
-DEF_GM( return SkNEW(DCShaderGM); )
+DEF_GM(return new DCShaderGM;)
}
#endif
diff --git a/gm/dftext.cpp b/gm/dftext.cpp
old mode 100755
new mode 100644
index 0b68add..f6bc0b2
--- a/gm/dftext.cpp
+++ b/gm/dftext.cpp
@@ -215,4 +215,4 @@
typedef skiagm::GM INHERITED;
};
-DEF_GM( return SkNEW(DFTextGM); )
+DEF_GM(return new DFTextGM;)
diff --git a/gm/discard.cpp b/gm/discard.cpp
index d30e15c..93da1ab 100644
--- a/gm/discard.cpp
+++ b/gm/discard.cpp
@@ -87,7 +87,7 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(DiscardGM); )
+DEF_GM(return new DiscardGM;)
} // end namespace
diff --git a/gm/downsamplebitmap.cpp b/gm/downsamplebitmap.cpp
index 4aceef9..5732378 100644
--- a/gm/downsamplebitmap.cpp
+++ b/gm/downsamplebitmap.cpp
@@ -180,7 +180,7 @@
if (codec) {
stream.rewind();
codec->decode(&stream, &fBM, kN32_SkColorType, SkImageDecoder::kDecodePixels_Mode);
- SkDELETE(codec);
+ delete codec;
} else {
fBM.allocN32Pixels(1, 1);
*(fBM.getAddr32(0,0)) = 0xFF0000FF; // red == bad
diff --git a/gm/emboss.cpp b/gm/emboss.cpp
index d3a8937..20d3c91 100644
--- a/gm/emboss.cpp
+++ b/gm/emboss.cpp
@@ -58,4 +58,4 @@
typedef skiagm::GM INHERITED;
};
-DEF_GM( return SkNEW(EmbossGM); )
+DEF_GM(return new EmbossGM;)
diff --git a/gm/etc1bitmap.cpp b/gm/etc1bitmap.cpp
index c66f7b2..363bd44 100644
--- a/gm/etc1bitmap.cpp
+++ b/gm/etc1bitmap.cpp
@@ -219,10 +219,10 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(skiagm::ETC1Bitmap_PKM_GM); )
-DEF_GM( return SkNEW(skiagm::ETC1Bitmap_KTX_GM); )
-DEF_GM( return SkNEW(skiagm::ETC1Bitmap_R11_KTX_GM); )
+DEF_GM(return new skiagm::ETC1Bitmap_PKM_GM;)
+DEF_GM(return new skiagm::ETC1Bitmap_KTX_GM;)
+DEF_GM(return new skiagm::ETC1Bitmap_R11_KTX_GM;)
#ifndef SK_IGNORE_ETC1_SUPPORT
-DEF_GM( return SkNEW(skiagm::ETC1Bitmap_NPOT_GM); )
+DEF_GM(return new skiagm::ETC1Bitmap_NPOT_GM;)
#endif // SK_IGNORE_ETC1_SUPPORT
diff --git a/gm/filterbitmap.cpp b/gm/filterbitmap.cpp
index 46500ba..1af1695 100644
--- a/gm/filterbitmap.cpp
+++ b/gm/filterbitmap.cpp
@@ -205,7 +205,7 @@
if (codec) {
stream.rewind();
codec->decode(&stream, &fBM, kN32_SkColorType, SkImageDecoder::kDecodePixels_Mode);
- SkDELETE(codec);
+ delete codec;
} else {
fBM.allocN32Pixels(1, 1);
*(fBM.getAddr32(0,0)) = 0xFF0000FF; // red == bad
diff --git a/gm/filterfastbounds.cpp b/gm/filterfastbounds.cpp
index a4b65e0..f6797db 100644
--- a/gm/filterfastbounds.cpp
+++ b/gm/filterfastbounds.cpp
@@ -321,6 +321,5 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM(return SkNEW(ImageFilterFastBoundGM);)
-
+DEF_GM(return new ImageFilterFastBoundGM;)
}
diff --git a/gm/filterindiabox.cpp b/gm/filterindiabox.cpp
index b9f5a7a..8df39bc 100644
--- a/gm/filterindiabox.cpp
+++ b/gm/filterindiabox.cpp
@@ -108,7 +108,7 @@
if (codec) {
stream.rewind();
codec->decode(&stream, &fBM, kN32_SkColorType, SkImageDecoder::kDecodePixels_Mode);
- SkDELETE(codec);
+ delete codec;
} else {
fBM.allocN32Pixels(1, 1);
*(fBM.getAddr32(0,0)) = 0xFF0000FF; // red == bad
diff --git a/gm/fontcache.cpp b/gm/fontcache.cpp
index 5f1141e..77a4c86 100644
--- a/gm/fontcache.cpp
+++ b/gm/fontcache.cpp
@@ -83,4 +83,4 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(FontCacheGM); )
+DEF_GM(return new FontCacheGM;)
diff --git a/gm/fontmgr.cpp b/gm/fontmgr.cpp
index 35914e7..9339115 100644
--- a/gm/fontmgr.cpp
+++ b/gm/fontmgr.cpp
@@ -300,12 +300,12 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(FontMgrGM); )
-DEF_GM( return SkNEW(FontMgrMatchGM); )
-DEF_GM( return SkNEW(FontMgrBoundsGM(1.0, 0)); )
-DEF_GM( return SkNEW(FontMgrBoundsGM(0.75, 0)); )
-DEF_GM( return SkNEW(FontMgrBoundsGM(1.0, -0.25)); )
+DEF_GM(return new FontMgrGM;)
+DEF_GM(return new FontMgrMatchGM;)
+DEF_GM(return new FontMgrBoundsGM(1.0, 0);)
+DEF_GM(return new FontMgrBoundsGM(0.75, 0);)
+DEF_GM(return new FontMgrBoundsGM(1.0, -0.25);)
#ifdef SK_BUILD_FOR_WIN
- DEF_GM( return SkNEW_ARGS(FontMgrGM, (SkFontMgr_New_DirectWrite())); )
+DEF_GM(return new FontMgrGM(SkFontMgr_New_DirectWrite());)
#endif
diff --git a/gm/giantbitmap.cpp b/gm/giantbitmap.cpp
index 2ee3797..e8bfad4 100644
--- a/gm/giantbitmap.cpp
+++ b/gm/giantbitmap.cpp
@@ -66,9 +66,7 @@
fDoRotate = doRotate;
}
- virtual ~GiantBitmapGM() {
- SkDELETE(fBM);
- }
+ virtual ~GiantBitmapGM() { delete fBM; }
protected:
diff --git a/gm/gm.h b/gm/gm.h
index 24c6100..7765dca 100644
--- a/gm/gm.h
+++ b/gm/gm.h
@@ -24,13 +24,11 @@
static skiagm::GMRegistry SK_MACRO_APPEND_LINE(R_)(SK_MACRO_APPEND_LINE(F_));
// See colorwheel.cpp for example usage.
-#define DEF_SIMPLE_GM(NAME, CANVAS, W, H) \
- static void SK_MACRO_CONCAT(NAME, _GM)(SkCanvas* CANVAS); \
- DEF_GM( return SkNEW_ARGS(skiagm::SimpleGM, \
- (SkString(#NAME), \
- SK_MACRO_CONCAT(NAME, _GM), \
- SkISize::Make(W, H))); ) \
- void SK_MACRO_CONCAT(NAME, _GM)(SkCanvas* CANVAS)
+#define DEF_SIMPLE_GM(NAME, CANVAS, W, H) \
+ static void SK_MACRO_CONCAT(NAME, _GM)(SkCanvas * CANVAS); \
+ DEF_GM(return new skiagm::SimpleGM(SkString(#NAME), SK_MACRO_CONCAT(NAME, _GM), \
+ SkISize::Make(W, H));) \
+ void SK_MACRO_CONCAT(NAME, _GM)(SkCanvas * CANVAS)
namespace skiagm {
diff --git a/gm/gradients_no_texture.cpp b/gm/gradients_no_texture.cpp
index e706ac6..d06ae5b 100644
--- a/gm/gradients_no_texture.cpp
+++ b/gm/gradients_no_texture.cpp
@@ -128,15 +128,15 @@
ColorPos() : fColors(NULL), fPos(NULL), fCount(0) {}
~ColorPos() {
- SkDELETE_ARRAY(fColors);
- SkDELETE_ARRAY(fPos);
+ delete[] fColors;
+ delete[] fPos;
}
void construct(const SkColor colors[], const SkScalar pos[], int count) {
- fColors = SkNEW_ARRAY(SkColor, count);
+ fColors = new SkColor[count];
memcpy(fColors, colors, count * sizeof(SkColor));
if (pos) {
- fPos = SkNEW_ARRAY(SkScalar, count);
+ fPos = new SkScalar[count];
memcpy(fPos, pos, count * sizeof(SkScalar));
fPos[0] = 0;
fPos[count - 1] = 1;
@@ -248,5 +248,5 @@
///////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(GradientsNoTextureGM));
-DEF_GM( return SkNEW(GradientsManyColorsGM));
+DEF_GM(return new GradientsNoTextureGM);
+DEF_GM(return new GradientsManyColorsGM);
diff --git a/gm/imagefiltersbase.cpp b/gm/imagefiltersbase.cpp
index 426a4dc..61c3f11 100644
--- a/gm/imagefiltersbase.cpp
+++ b/gm/imagefiltersbase.cpp
@@ -26,9 +26,7 @@
FailImageFilter::GetFlattenableType());
}
};
- static FailImageFilter* Create() {
- return SkNEW(FailImageFilter);
- }
+ static FailImageFilter* Create() { return new FailImageFilter; }
SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter)
@@ -70,7 +68,7 @@
}
};
static IdentityImageFilter* Create(SkImageFilter* input = NULL) {
- return SkNEW_ARGS(IdentityImageFilter, (input));
+ return new IdentityImageFilter(input);
}
SK_TO_STRING_OVERRIDE()
diff --git a/gm/imagefiltersgraph.cpp b/gm/imagefiltersgraph.cpp
index cfedaf0..521dd3c 100644
--- a/gm/imagefiltersgraph.cpp
+++ b/gm/imagefiltersgraph.cpp
@@ -34,7 +34,7 @@
}
};
static SkImageFilter* Create(SkScalar dx, SkScalar dy, SkImageFilter* input) {
- return SkNEW_ARGS(SimpleOffsetFilter, (dx, dy, input));
+ return new SimpleOffsetFilter(dx, dy, input);
}
virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const Context& ctx,
diff --git a/gm/imagefromyuvtextures.cpp b/gm/imagefromyuvtextures.cpp
index 7767c46..68faf80 100644
--- a/gm/imagefromyuvtextures.cpp
+++ b/gm/imagefromyuvtextures.cpp
@@ -169,7 +169,7 @@
typedef GM INHERITED;
};
-DEF_GM( return SkNEW(ImageFromYUVTextures); )
+DEF_GM(return new ImageFromYUVTextures;)
}
#endif
diff --git a/gm/internal_links.cpp b/gm/internal_links.cpp
index bb5447e..bc1dc24 100644
--- a/gm/internal_links.cpp
+++ b/gm/internal_links.cpp
@@ -72,7 +72,7 @@
//////////////////////////////////////////////////////////////////////////////
-static GM* MyFactory(void*) { return SkNEW(InternalLinksGM); }
+static GM* MyFactory(void*) { return new InternalLinksGM; }
static GMRegistry reg(MyFactory);
}
diff --git a/gm/largeglyphblur.cpp b/gm/largeglyphblur.cpp
index 8723824..b74f902 100644
--- a/gm/largeglyphblur.cpp
+++ b/gm/largeglyphblur.cpp
@@ -65,5 +65,5 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(LargeGlyphBlur); )
+DEF_GM(return new LargeGlyphBlur;)
}
diff --git a/gm/lerpmode.cpp b/gm/lerpmode.cpp
index b483c13..f690c76 100644
--- a/gm/lerpmode.cpp
+++ b/gm/lerpmode.cpp
@@ -60,4 +60,4 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(LerpXfermodeGM); )
+DEF_GM(return new LerpXfermodeGM;)
diff --git a/gm/lighting.cpp b/gm/lighting.cpp
index f6d236c..a464a07 100644
--- a/gm/lighting.cpp
+++ b/gm/lighting.cpp
@@ -170,6 +170,5 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(ImageLightingGM); )
-
+DEF_GM(return new ImageLightingGM;)
}
diff --git a/gm/lightingshader.cpp b/gm/lightingshader.cpp
index c73ad5b..8bb3595 100644
--- a/gm/lightingshader.cpp
+++ b/gm/lightingshader.cpp
@@ -185,6 +185,5 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(LightingShaderGM); )
-
+DEF_GM(return new LightingShaderGM;)
}
diff --git a/gm/lumafilter.cpp b/gm/lumafilter.cpp
index 1423788..46a22f8 100644
--- a/gm/lumafilter.cpp
+++ b/gm/lumafilter.cpp
@@ -152,4 +152,4 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(LumaFilterGM); )
+DEF_GM(return new LumaFilterGM;)
diff --git a/gm/mixedtextblobs.cpp b/gm/mixedtextblobs.cpp
index a98f531..e66e73c 100644
--- a/gm/mixedtextblobs.cpp
+++ b/gm/mixedtextblobs.cpp
@@ -163,5 +163,5 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(MixedTextBlobsGM); )
+DEF_GM(return new MixedTextBlobsGM;)
}
diff --git a/gm/modecolorfilters.cpp b/gm/modecolorfilters.cpp
index f9a3a10..9f70bf8 100644
--- a/gm/modecolorfilters.cpp
+++ b/gm/modecolorfilters.cpp
@@ -49,8 +49,7 @@
SkIntToScalar(checkSize), SkIntToScalar(checkSize));
canvas.drawRect(rect1, paint);
canvas.drawRect(rect0, paint);
- return SkNEW_ARGS(SkBitmapProcShader, (bmp, SkShader::kRepeat_TileMode,
- SkShader::kRepeat_TileMode));
+ return new SkBitmapProcShader(bmp, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);
}
class ModeColorFilterGM : public GM {
diff --git a/gm/multipicturedraw.cpp b/gm/multipicturedraw.cpp
index 21c9d18..3a0b0fa 100644
--- a/gm/multipicturedraw.cpp
+++ b/gm/multipicturedraw.cpp
@@ -258,7 +258,10 @@
class ComposeStep {
public:
ComposeStep() : fSurf(NULL), fX(0.0f), fY(0.0f), fPaint(NULL) { }
- ~ComposeStep() { SkSafeUnref(fSurf); SkDELETE(fPaint); }
+ ~ComposeStep() {
+ SkSafeUnref(fSurf);
+ delete fPaint;
+ }
SkSurface* fSurf;
SkScalar fX;
@@ -415,7 +418,7 @@
step.fX = SkIntToScalar(x*kTileWidth);
step.fY = SkIntToScalar(y*kTileHeight);
- step.fPaint = SkNEW(SkPaint);
+ step.fPaint = new SkPaint;
step.fPaint->setColorFilter(
SkColorFilter::CreateModeFilter(colors[x][y], SkXfermode::kModulate_Mode))->unref();
@@ -540,33 +543,33 @@
typedef GM INHERITED;
};
- DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kNoClipSingle_Content,
- MultiPictureDraw::kSimple_Layout));)
- DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kRectClipMulti_Content,
- MultiPictureDraw::kSimple_Layout));)
- DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kRRectClipMulti_Content,
- MultiPictureDraw::kSimple_Layout));)
- DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kPathClipMulti_Content,
- MultiPictureDraw::kSimple_Layout));)
- DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kInvPathClipMulti_Content,
- MultiPictureDraw::kSimple_Layout));)
- DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kSierpinski_Content,
- MultiPictureDraw::kSimple_Layout));)
- DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kBigLayer_Content,
- MultiPictureDraw::kSimple_Layout));)
+ DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kNoClipSingle_Content,
+ MultiPictureDraw::kSimple_Layout);)
+ DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kRectClipMulti_Content,
+ MultiPictureDraw::kSimple_Layout);)
+ DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kRRectClipMulti_Content,
+ MultiPictureDraw::kSimple_Layout);)
+ DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kPathClipMulti_Content,
+ MultiPictureDraw::kSimple_Layout);)
+ DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kInvPathClipMulti_Content,
+ MultiPictureDraw::kSimple_Layout);)
+ DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kSierpinski_Content,
+ MultiPictureDraw::kSimple_Layout);)
+ DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kBigLayer_Content,
+ MultiPictureDraw::kSimple_Layout);)
- DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kNoClipSingle_Content,
- MultiPictureDraw::kTiled_Layout));)
- DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kRectClipMulti_Content,
- MultiPictureDraw::kTiled_Layout));)
- DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kRRectClipMulti_Content,
- MultiPictureDraw::kTiled_Layout));)
- DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kPathClipMulti_Content,
- MultiPictureDraw::kTiled_Layout));)
- DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kInvPathClipMulti_Content,
- MultiPictureDraw::kTiled_Layout));)
- DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kSierpinski_Content,
- MultiPictureDraw::kTiled_Layout));)
- DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kBigLayer_Content,
- MultiPictureDraw::kTiled_Layout));)
+ DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kNoClipSingle_Content,
+ MultiPictureDraw::kTiled_Layout);)
+ DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kRectClipMulti_Content,
+ MultiPictureDraw::kTiled_Layout);)
+ DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kRRectClipMulti_Content,
+ MultiPictureDraw::kTiled_Layout);)
+ DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kPathClipMulti_Content,
+ MultiPictureDraw::kTiled_Layout);)
+ DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kInvPathClipMulti_Content,
+ MultiPictureDraw::kTiled_Layout);)
+ DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kSierpinski_Content,
+ MultiPictureDraw::kTiled_Layout);)
+ DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kBigLayer_Content,
+ MultiPictureDraw::kTiled_Layout);)
}
diff --git a/gm/patch.cpp b/gm/patch.cpp
index ea7954c..df3a84e 100644
--- a/gm/patch.cpp
+++ b/gm/patch.cpp
@@ -154,6 +154,5 @@
typedef GM INHERITED;
};
-DEF_GM(return SkNEW(SkPatchGM); )
-
+DEF_GM(return new SkPatchGM;)
}
diff --git a/gm/patchgrid.cpp b/gm/patchgrid.cpp
index 5c719bf..89a9847 100644
--- a/gm/patchgrid.cpp
+++ b/gm/patchgrid.cpp
@@ -156,6 +156,5 @@
typedef GM INHERITED;
};
-DEF_GM(return SkNEW(SkPatchGridGM); )
-
+DEF_GM(return new SkPatchGridGM;)
}
diff --git a/gm/peekpixels.cpp b/gm/peekpixels.cpp
index 37ec32f..b8c1678 100644
--- a/gm/peekpixels.cpp
+++ b/gm/peekpixels.cpp
@@ -68,4 +68,4 @@
typedef skiagm::GM INHERITED;
};
-DEF_GM( return SkNEW(PeekPixelsGM); )
+DEF_GM(return new PeekPixelsGM;)
diff --git a/gm/picture.cpp b/gm/picture.cpp
index f1d2a79..175e0a7 100644
--- a/gm/picture.cpp
+++ b/gm/picture.cpp
@@ -81,4 +81,4 @@
typedef skiagm::GM INHERITED;
};
-DEF_GM( return SkNEW(PictureGM); )
+DEF_GM(return new PictureGM;)
diff --git a/gm/pictureimagegenerator.cpp b/gm/pictureimagegenerator.cpp
index a978e67..9149ec1 100644
--- a/gm/pictureimagegenerator.cpp
+++ b/gm/pictureimagegenerator.cpp
@@ -183,4 +183,4 @@
typedef skiagm::GM INHERITED;
};
-DEF_GM( return SkNEW(PictureGeneratorGM); )
+DEF_GM(return new PictureGeneratorGM;)
diff --git a/gm/pictureshader.cpp b/gm/pictureshader.cpp
index 3f719be..d28749a 100644
--- a/gm/pictureshader.cpp
+++ b/gm/pictureshader.cpp
@@ -181,7 +181,7 @@
typedef GM INHERITED;
};
-DEF_GM( return SkNEW_ARGS(PictureShaderGM, (50, 100)); )
+DEF_GM(return new PictureShaderGM(50, 100);)
DEF_SIMPLE_GM(tiled_picture_shader, canvas, 400, 400) {
// https://code.google.com/p/skia/issues/detail?id=3398
diff --git a/gm/pictureshadertile.cpp b/gm/pictureshadertile.cpp
index 11d6b34..a84e233 100644
--- a/gm/pictureshadertile.cpp
+++ b/gm/pictureshadertile.cpp
@@ -155,4 +155,4 @@
typedef GM INHERITED;
};
-DEF_GM( return SkNEW(PictureShaderTileGM); )
+DEF_GM(return new PictureShaderTileGM;)
diff --git a/gm/pixelsnap.cpp b/gm/pixelsnap.cpp
index ea85a94..5f1a745 100644
--- a/gm/pixelsnap.cpp
+++ b/gm/pixelsnap.cpp
@@ -175,7 +175,7 @@
};
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(PointSnapGM); )
-DEF_GM( return SkNEW(LineSnapGM); )
-DEF_GM( return SkNEW(RectSnapGM); )
-DEF_GM( return SkNEW(ComboSnapGM); )
+DEF_GM(return new PointSnapGM;)
+DEF_GM(return new LineSnapGM;)
+DEF_GM(return new RectSnapGM;)
+DEF_GM(return new ComboSnapGM;)
diff --git a/gm/smallarc.cpp b/gm/smallarc.cpp
old mode 100755
new mode 100644
index 2109b90..6c0df8d
--- a/gm/smallarc.cpp
+++ b/gm/smallarc.cpp
@@ -50,6 +50,5 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(SmallArcGM); )
-
+DEF_GM(return new SmallArcGM;)
}
diff --git a/gm/strokefill.cpp b/gm/strokefill.cpp
index a7e404d..4e8eaff 100644
--- a/gm/strokefill.cpp
+++ b/gm/strokefill.cpp
@@ -355,6 +355,5 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM(return SkNEW(StrokeFillGM);)
-
+DEF_GM(return new StrokeFillGM;)
}
diff --git a/gm/strokes.cpp b/gm/strokes.cpp
index 19ba844..57517a0 100644
--- a/gm/strokes.cpp
+++ b/gm/strokes.cpp
@@ -407,4 +407,4 @@
static skiagm::GMRegistry R3(F3);
static skiagm::GMRegistry R4(F4);
-DEF_GM( return SkNEW(ZeroLenStrokesGM); )
+DEF_GM( return new ZeroLenStrokesGM; )
diff --git a/gm/stroketext.cpp b/gm/stroketext.cpp
index 6ec425b..75ce164 100644
--- a/gm/stroketext.cpp
+++ b/gm/stroketext.cpp
@@ -98,4 +98,4 @@
typedef skiagm::GM INHERITED;
};
-DEF_GM( return SkNEW(StrokeTextGM); )
+DEF_GM(return new StrokeTextGM;)
diff --git a/gm/tallstretchedbitmaps.cpp b/gm/tallstretchedbitmaps.cpp
index 4581f10..dfd31a0 100644
--- a/gm/tallstretchedbitmaps.cpp
+++ b/gm/tallstretchedbitmaps.cpp
@@ -103,5 +103,4 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM(return SkNEW(TallStretchedBitmapsGM);)
-
+DEF_GM(return new TallStretchedBitmapsGM;)
diff --git a/gm/textblob.cpp b/gm/textblob.cpp
index cd5c12a..5020e7c 100644
--- a/gm/textblob.cpp
+++ b/gm/textblob.cpp
@@ -186,4 +186,4 @@
typedef skiagm::GM INHERITED;
};
-DEF_GM( return SkNEW_ARGS(TextBlobGM, ("hamburgefons")); )
+DEF_GM(return new TextBlobGM("hamburgefons");)
diff --git a/gm/textblobcolortrans.cpp b/gm/textblobcolortrans.cpp
index 8b5413a..0e4e0ff 100644
--- a/gm/textblobcolortrans.cpp
+++ b/gm/textblobcolortrans.cpp
@@ -97,5 +97,5 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(TextBlobColorTrans); )
+DEF_GM(return new TextBlobColorTrans;)
}
diff --git a/gm/textblobgeometrychange.cpp b/gm/textblobgeometrychange.cpp
index fec1ac0..bae2381 100644
--- a/gm/textblobgeometrychange.cpp
+++ b/gm/textblobgeometrychange.cpp
@@ -77,5 +77,5 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(TextBlobGeometryChange); )
+DEF_GM(return new TextBlobGeometryChange;)
}
diff --git a/gm/textbloblooper.cpp b/gm/textbloblooper.cpp
index 337942c..dc4be0b 100644
--- a/gm/textbloblooper.cpp
+++ b/gm/textbloblooper.cpp
@@ -255,5 +255,5 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(TextBlobLooperGM); )
+DEF_GM(return new TextBlobLooperGM;)
}
diff --git a/gm/textblobmixedsizes.cpp b/gm/textblobmixedsizes.cpp
index 9d91b61..a76c6f5 100644
--- a/gm/textblobmixedsizes.cpp
+++ b/gm/textblobmixedsizes.cpp
@@ -184,8 +184,8 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW_ARGS(TextBlobMixedSizes, (false)); )
+DEF_GM( return new TextBlobMixedSizes(false); )
#if SK_SUPPORT_GPU
-DEF_GM( return SkNEW_ARGS(TextBlobMixedSizes, (true)); )
+DEF_GM( return new TextBlobMixedSizes(true); )
#endif
}
diff --git a/gm/textblobrandomfont.cpp b/gm/textblobrandomfont.cpp
index c1e754c..ada46ca 100644
--- a/gm/textblobrandomfont.cpp
+++ b/gm/textblobrandomfont.cpp
@@ -44,7 +44,7 @@
if (NULL == orig) {
orig.reset(SkTypeface::RefDefault());
}
- SkAutoTUnref<SkTypeface> random(SkNEW_ARGS(SkRandomTypeface, (orig, paint, false)));
+ SkAutoTUnref<SkTypeface> random(new SkRandomTypeface(orig, paint, false));
paint.setTypeface(random);
SkRect bounds;
@@ -74,8 +74,7 @@
const char* emojiText = sk_tool_utils::emoji_sample_text();
paint.measureText(emojiText, strlen(emojiText), &bounds);
offset += bounds.height();
- SkAutoTUnref<SkTypeface> randomEmoji(SkNEW_ARGS(SkRandomTypeface, (orig, paint,
- false)));
+ SkAutoTUnref<SkTypeface> randomEmoji(new SkRandomTypeface(orig, paint, false));
paint.setTypeface(randomEmoji);
sk_tool_utils::add_to_text_blob(&builder, emojiText, paint, 0, offset);
}
@@ -149,6 +148,6 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(TextBlobRandomFont); )
+DEF_GM(return new TextBlobRandomFont;)
}
#endif
diff --git a/gm/textblobshader.cpp b/gm/textblobshader.cpp
index 3b2a9a5..5c9372d 100644
--- a/gm/textblobshader.cpp
+++ b/gm/textblobshader.cpp
@@ -109,4 +109,4 @@
typedef skiagm::GM INHERITED;
};
-DEF_GM( return SkNEW_ARGS(TextBlobShaderGM, ("Blobber")); )
+DEF_GM(return new TextBlobShaderGM("Blobber");)
diff --git a/gm/textblobtransforms.cpp b/gm/textblobtransforms.cpp
index 0813d87..eed1809 100644
--- a/gm/textblobtransforms.cpp
+++ b/gm/textblobtransforms.cpp
@@ -168,5 +168,5 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(TextBlobTransforms); )
+DEF_GM(return new TextBlobTransforms;)
}
diff --git a/gm/textblobuseaftergpufree.cpp b/gm/textblobuseaftergpufree.cpp
index 3994c5d..363cd2f 100644
--- a/gm/textblobuseaftergpufree.cpp
+++ b/gm/textblobuseaftergpufree.cpp
@@ -70,6 +70,6 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(TextBlobUseAfterGpuFree); )
+DEF_GM(return new TextBlobUseAfterGpuFree;)
}
#endif
diff --git a/gm/texturedomaineffect.cpp b/gm/texturedomaineffect.cpp
index 07b7119..7c53467 100644
--- a/gm/texturedomaineffect.cpp
+++ b/gm/texturedomaineffect.cpp
@@ -155,7 +155,7 @@
const SkScalar TextureDomainEffect::kDrawPad = 10.f;
const SkScalar TextureDomainEffect::kTestPad = 10.f;
-DEF_GM( return SkNEW(TextureDomainEffect); )
+DEF_GM(return new TextureDomainEffect;)
}
#endif
diff --git a/gm/thinstrokedrects.cpp b/gm/thinstrokedrects.cpp
index 8bde102..73e1f52 100644
--- a/gm/thinstrokedrects.cpp
+++ b/gm/thinstrokedrects.cpp
@@ -73,6 +73,5 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(ThinStrokedRectsGM); )
-
+DEF_GM(return new ThinStrokedRectsGM;)
}
diff --git a/gm/tiledscaledbitmap.cpp b/gm/tiledscaledbitmap.cpp
index 79e1111..daecbb0 100644
--- a/gm/tiledscaledbitmap.cpp
+++ b/gm/tiledscaledbitmap.cpp
@@ -79,6 +79,5 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM(return SkNEW(TiledScaledBitmapGM);)
-
+DEF_GM(return new TiledScaledBitmapGM;)
}
diff --git a/gm/tileimagefilter.cpp b/gm/tileimagefilter.cpp
index 9d0f95e..1ec0511 100644
--- a/gm/tileimagefilter.cpp
+++ b/gm/tileimagefilter.cpp
@@ -121,6 +121,5 @@
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW(TileImageFilterGM); )
-
+DEF_GM(return new TileImageFilterGM;)
}
diff --git a/gm/variedtext.cpp b/gm/variedtext.cpp
index 887a7c3..83fe720 100644
--- a/gm/variedtext.cpp
+++ b/gm/variedtext.cpp
@@ -160,7 +160,7 @@
typedef skiagm::GM INHERITED;
};
-DEF_GM( return SkNEW(VariedTextGM(false, false)); )
-DEF_GM( return SkNEW(VariedTextGM(true, false)); )
-DEF_GM( return SkNEW(VariedTextGM(false, true)); )
-DEF_GM( return SkNEW(VariedTextGM(true, true)); )
+DEF_GM(return new VariedTextGM(false, false);)
+DEF_GM(return new VariedTextGM(true, false);)
+DEF_GM(return new VariedTextGM(false, true);)
+DEF_GM(return new VariedTextGM(true, true);)
diff --git a/gm/vertices.cpp b/gm/vertices.cpp
index 2f7a9b9..9533d81 100644
--- a/gm/vertices.cpp
+++ b/gm/vertices.cpp
@@ -123,5 +123,5 @@
/////////////////////////////////////////////////////////////////////////////////////
-DEF_GM( return SkNEW_ARGS(VerticesGM, (0xFF)); )
-DEF_GM( return SkNEW_ARGS(VerticesGM, (0x80)); )
+DEF_GM(return new VerticesGM(0xFF);)
+DEF_GM(return new VerticesGM(0x80);)
diff --git a/gm/yuvtorgbeffect.cpp b/gm/yuvtorgbeffect.cpp
index 4ec86f4..7dbd24e 100644
--- a/gm/yuvtorgbeffect.cpp
+++ b/gm/yuvtorgbeffect.cpp
@@ -140,7 +140,7 @@
typedef GM INHERITED;
};
-DEF_GM( return SkNEW(YUVtoRGBEffect); )
+DEF_GM(return new YUVtoRGBEffect;)
}
#endif
diff --git a/include/core/SkAnnotation.h b/include/core/SkAnnotation.h
index 62c844a..80503c7 100644
--- a/include/core/SkAnnotation.h
+++ b/include/core/SkAnnotation.h
@@ -26,12 +26,10 @@
virtual ~SkAnnotation();
static SkAnnotation* Create(const char key[], SkData* value) {
- return SkNEW_ARGS(SkAnnotation, (key, value));
+ return new SkAnnotation(key, value);
}
- static SkAnnotation* Create(SkReadBuffer& buffer) {
- return SkNEW_ARGS(SkAnnotation, (buffer));
- }
+ static SkAnnotation* Create(SkReadBuffer& buffer) { return new SkAnnotation(buffer); }
/**
* Return the data for the specified key, or NULL.
diff --git a/include/core/SkImageDecoder.h b/include/core/SkImageDecoder.h
index f1e36e1..15953ef 100644
--- a/include/core/SkImageDecoder.h
+++ b/include/core/SkImageDecoder.h
@@ -442,10 +442,8 @@
// This macro defines the global creation entry point for each decoder. Each
// decoder implementation that registers with the decoder factory must call it.
-#define DEFINE_DECODER_CREATOR(codec) \
- SkImageDecoder *Create ## codec () { \
- return SkNEW( Sk ## codec ); \
- }
+#define DEFINE_DECODER_CREATOR(codec) \
+ SkImageDecoder* Create##codec() { return new Sk##codec; }
// All the decoders known by Skia. Note that, depending on the compiler settings,
// not all of these will be available
diff --git a/include/core/SkImageEncoder.h b/include/core/SkImageEncoder.h
index a9eecc4..fc999dc 100644
--- a/include/core/SkImageEncoder.h
+++ b/include/core/SkImageEncoder.h
@@ -87,10 +87,8 @@
// This macro defines the global creation entry point for each encoder. Each
// encoder implementation that registers with the encoder factory must call it.
-#define DEFINE_ENCODER_CREATOR(codec) \
- SkImageEncoder *Create ## codec () { \
- return SkNEW( Sk ## codec ); \
- }
+#define DEFINE_ENCODER_CREATOR(codec) \
+ SkImageEncoder* Create##codec() { return new Sk##codec; }
// All the encoders known by Skia. Note that, depending on the compiler settings,
// not all of these will be available
diff --git a/include/core/SkLazyPtr.h b/include/core/SkLazyPtr.h
index 035a269..b0cd2ff 100644
--- a/include/core/SkLazyPtr.h
+++ b/include/core/SkLazyPtr.h
@@ -13,12 +13,12 @@
* Example usage:
*
* Foo* GetSingletonFoo() {
- * SK_DECLARE_STATIC_LAZY_PTR(Foo, singleton); // Created with SkNEW, destroyed with SkDELETE.
+ * SK_DECLARE_STATIC_LAZY_PTR(Foo, singleton); // Created with new, destroyed with delete.
* return singleton.get();
* }
*
* These macros take an optional T* (*Create)() and void (*Destroy)(T*) at the end.
- * If not given, we'll use SkNEW and SkDELETE.
+ * If not given, we'll use new and delete.
* These options are most useful when T doesn't have a public constructor or destructor.
* Create comes first, so you may use a custom Create with a default Destroy, but not vice versa.
*
@@ -86,8 +86,14 @@
}
}
-template <typename T> T* sk_new() { return SkNEW(T); }
-template <typename T> void sk_delete(T* ptr) { SkDELETE(ptr); }
+template <typename T>
+T* sk_new() {
+ return new T;
+}
+template <typename T>
+void sk_delete(T* ptr) {
+ delete ptr;
+}
// We're basing these implementations here on this article:
// http://preshing.com/20140709/the-purpose-of-memory_order_consume-in-cpp11/
@@ -128,7 +134,10 @@
T* fPtr;
};
-template <typename T> T* sk_new_arg(int i) { return SkNEW_ARGS(T, (i)); }
+template <typename T>
+T* sk_new_arg(int i) {
+ return new T(i);
+}
// This has no constructor and must be zero-initalized (the macro above does this).
template <typename T, int N, T* (*Create)(int) = sk_new_arg<T>, void (*Destroy)(T*) = sk_delete<T> >
@@ -162,7 +171,7 @@
T* get() const {
T* ptr = Private::consume_load(&fPtr);
- return ptr ? ptr : Private::try_cas<T*, Destroy>(&fPtr, SkNEW(T));
+ return ptr ? ptr : Private::try_cas<T*, Destroy>(&fPtr, new T);
}
template <typename Create>
diff --git a/include/core/SkPathEffect.h b/include/core/SkPathEffect.h
index 34d0dd7..72ea462 100644
--- a/include/core/SkPathEffect.h
+++ b/include/core/SkPathEffect.h
@@ -185,7 +185,7 @@
and decremented in the destructor.
*/
static SkComposePathEffect* Create(SkPathEffect* outer, SkPathEffect* inner) {
- return SkNEW_ARGS(SkComposePathEffect, (outer, inner));
+ return new SkComposePathEffect(outer, inner);
}
virtual bool filterPath(SkPath* dst, const SkPath& src,
@@ -222,7 +222,7 @@
and decremented in the destructor.
*/
static SkSumPathEffect* Create(SkPathEffect* first, SkPathEffect* second) {
- return SkNEW_ARGS(SkSumPathEffect, (first, second));
+ return new SkSumPathEffect(first, second);
}
virtual bool filterPath(SkPath* dst, const SkPath& src,
diff --git a/include/core/SkRefCnt.h b/include/core/SkRefCnt.h
index 0462540..5b83d0b 100644
--- a/include/core/SkRefCnt.h
+++ b/include/core/SkRefCnt.h
@@ -109,7 +109,7 @@
*/
virtual void internal_dispose() const {
this->internal_dispose_restore_refcnt_to_1();
- SkDELETE(this);
+ delete this;
}
// The following friends are those which override internal_dispose()
@@ -242,8 +242,8 @@
void ref() const { (void)sk_atomic_fetch_add(&fRefCnt, +1, sk_memory_order_relaxed); }
void unref() const {
if (1 == sk_atomic_fetch_add(&fRefCnt, -1, sk_memory_order_acq_rel)) {
- SkDEBUGCODE(fRefCnt = 1;) // restore the 1 for our destructor's assert
- SkDELETE((const Derived*)this);
+ SkDEBUGCODE(fRefCnt = 1;) // restore the 1 for our destructor's assert
+ delete (const Derived*)this;
}
}
void deref() const { this->unref(); }
diff --git a/include/core/SkTArray.h b/include/core/SkTArray.h
index 9dc5880..d67956b 100644
--- a/include/core/SkTArray.h
+++ b/include/core/SkTArray.h
@@ -32,18 +32,18 @@
template<typename T>
inline void copy(SkTArray<T, false>* self, int dst, int src) {
- SkNEW_PLACEMENT_ARGS(&self->fItemArray[dst], T, (self->fItemArray[src]));
+ new (&self->fItemArray[dst]) T(self->fItemArray[src]);
}
template<typename T>
inline void copy(SkTArray<T, false>* self, const T* array) {
for (int i = 0; i < self->fCount; ++i) {
- SkNEW_PLACEMENT_ARGS(self->fItemArray + i, T, (array[i]));
+ new (self->fItemArray + i) T(array[i]);
}
}
template<typename T>
inline void copyAndDelete(SkTArray<T, false>* self, char* newMemArray) {
for (int i = 0; i < self->fCount; ++i) {
- SkNEW_PLACEMENT_ARGS(newMemArray + sizeof(T) * i, T, (self->fItemArray[i]));
+ new (newMemArray + sizeof(T) * i) T(self->fItemArray[i]);
self->fItemArray[i].~T();
}
}
@@ -135,7 +135,7 @@
this->checkRealloc(n);
fCount = n;
for (int i = 0; i < fCount; ++i) {
- SkNEW_PLACEMENT(fItemArray + i, T);
+ new (fItemArray + i) T;
}
}
@@ -180,7 +180,7 @@
*/
T& push_back() {
T* newT = reinterpret_cast<T*>(this->push_back_raw(1));
- SkNEW_PLACEMENT(newT, T);
+ new (newT) T;
return *newT;
}
@@ -189,7 +189,7 @@
*/
T& push_back(const T& t) {
T* newT = reinterpret_cast<T*>(this->push_back_raw(1));
- SkNEW_PLACEMENT_ARGS(newT, T, (t));
+ new (newT) T(t);
return *newT;
}
@@ -202,7 +202,7 @@
SkASSERT(n >= 0);
T* newTs = reinterpret_cast<T*>(this->push_back_raw(n));
for (int i = 0; i < n; ++i) {
- SkNEW_PLACEMENT(newTs + i, T);
+ new (newTs + i) T;
}
return newTs;
}
@@ -215,7 +215,7 @@
SkASSERT(n >= 0);
T* newTs = reinterpret_cast<T*>(this->push_back_raw(n));
for (int i = 0; i < n; ++i) {
- SkNEW_PLACEMENT_ARGS(newTs[i], T, (t));
+ new (newTs[i]) T(t);
}
return newTs;
}
@@ -228,7 +228,7 @@
SkASSERT(n >= 0);
this->checkRealloc(n);
for (int i = 0; i < n; ++i) {
- SkNEW_PLACEMENT_ARGS(fItemArray + fCount + i, T, (t[i]));
+ new (fItemArray + fCount + i) T(t[i]);
}
fCount += n;
return fItemArray + fCount - n;
diff --git a/include/core/SkTDArray.h b/include/core/SkTDArray.h
index 337b6fd..26c6c7f 100644
--- a/include/core/SkTDArray.h
+++ b/include/core/SkTDArray.h
@@ -274,7 +274,7 @@
T* iter = fArray;
T* stop = fArray + fCount;
while (iter < stop) {
- SkDELETE (*iter);
+ delete *iter;
iter += 1;
}
this->reset();
diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h
index 863b8ab..f6f30e6 100644
--- a/include/core/SkTypeface.h
+++ b/include/core/SkTypeface.h
@@ -263,7 +263,7 @@
public:
virtual ~LocalizedStrings() { }
virtual bool next(LocalizedString* localizedString) = 0;
- void unref() { SkDELETE(this); }
+ void unref() { delete this; }
};
/**
* Returns an iterator which will attempt to enumerate all of the
diff --git a/include/effects/Sk1DPathEffect.h b/include/effects/Sk1DPathEffect.h
index 6b3ec6d..6a7804f 100644
--- a/include/effects/Sk1DPathEffect.h
+++ b/include/effects/Sk1DPathEffect.h
@@ -58,7 +58,7 @@
*/
static SkPath1DPathEffect* Create(const SkPath& path, SkScalar advance, SkScalar phase,
Style style) {
- return SkNEW_ARGS(SkPath1DPathEffect, (path, advance, phase, style));
+ return new SkPath1DPathEffect(path, advance, phase, style);
}
virtual bool filterPath(SkPath*, const SkPath&,
diff --git a/include/effects/Sk2DPathEffect.h b/include/effects/Sk2DPathEffect.h
index 7fbf94b..fa12dcf 100644
--- a/include/effects/Sk2DPathEffect.h
+++ b/include/effects/Sk2DPathEffect.h
@@ -56,7 +56,7 @@
class SK_API SkLine2DPathEffect : public Sk2DPathEffect {
public:
static SkLine2DPathEffect* Create(SkScalar width, const SkMatrix& matrix) {
- return SkNEW_ARGS(SkLine2DPathEffect, (width, matrix));
+ return new SkLine2DPathEffect(width, matrix);
}
virtual bool filterPath(SkPath* dst, const SkPath& src,
@@ -85,7 +85,7 @@
* the latice.
*/
static SkPath2DPathEffect* Create(const SkMatrix& matrix, const SkPath& path) {
- return SkNEW_ARGS(SkPath2DPathEffect, (matrix, path));
+ return new SkPath2DPathEffect(matrix, path);
}
SK_TO_STRING_OVERRIDE()
diff --git a/include/effects/SkArcToPathEffect.h b/include/effects/SkArcToPathEffect.h
index 6ae7e36..4716ea1 100644
--- a/include/effects/SkArcToPathEffect.h
+++ b/include/effects/SkArcToPathEffect.h
@@ -19,7 +19,7 @@
if (radius <= 0) {
return NULL;
}
- return SkNEW_ARGS(SkArcToPathEffect, (radius));
+ return new SkArcToPathEffect(radius);
}
bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override;
diff --git a/include/effects/SkBitmapSource.h b/include/effects/SkBitmapSource.h
index e4281c9..38b1302 100644
--- a/include/effects/SkBitmapSource.h
+++ b/include/effects/SkBitmapSource.h
@@ -13,13 +13,11 @@
class SK_API SkBitmapSource : public SkImageFilter {
public:
- static SkBitmapSource* Create(const SkBitmap& bitmap) {
- return SkNEW_ARGS(SkBitmapSource, (bitmap));
- }
+ static SkBitmapSource* Create(const SkBitmap& bitmap) { return new SkBitmapSource(bitmap); }
static SkBitmapSource* Create(const SkBitmap& bitmap,
const SkRect& srcRect, const SkRect& dstRect,
SkFilterQuality filterQuality = kHigh_SkFilterQuality) {
- return SkNEW_ARGS(SkBitmapSource, (bitmap, srcRect, dstRect, filterQuality));
+ return new SkBitmapSource(bitmap, srcRect, dstRect, filterQuality);
}
void computeFastBounds(const SkRect& src, SkRect* dst) const override;
diff --git a/include/effects/SkBlurDrawLooper.h b/include/effects/SkBlurDrawLooper.h
index 26bcd52..808557b 100644
--- a/include/effects/SkBlurDrawLooper.h
+++ b/include/effects/SkBlurDrawLooper.h
@@ -37,7 +37,7 @@
static SkBlurDrawLooper* Create(SkColor color, SkScalar sigma, SkScalar dx, SkScalar dy,
uint32_t flags = kNone_BlurFlag) {
- return SkNEW_ARGS(SkBlurDrawLooper, (color, sigma, dx, dy, flags));
+ return new SkBlurDrawLooper(color, sigma, dx, dy, flags);
}
virtual ~SkBlurDrawLooper();
diff --git a/include/effects/SkBlurImageFilter.h b/include/effects/SkBlurImageFilter.h
index ec29c8e..b0bd309 100644
--- a/include/effects/SkBlurImageFilter.h
+++ b/include/effects/SkBlurImageFilter.h
@@ -17,7 +17,7 @@
SkScalar sigmaY,
SkImageFilter* input = NULL,
const CropRect* cropRect = NULL) {
- return SkNEW_ARGS(SkBlurImageFilter, (sigmaX, sigmaY, input, cropRect));
+ return new SkBlurImageFilter(sigmaX, sigmaY, input, cropRect);
}
void computeFastBounds(const SkRect&, SkRect*) const override;
diff --git a/include/effects/SkColorMatrixFilter.h b/include/effects/SkColorMatrixFilter.h
index a129654..9f16643 100644
--- a/include/effects/SkColorMatrixFilter.h
+++ b/include/effects/SkColorMatrixFilter.h
@@ -14,10 +14,10 @@
class SK_API SkColorMatrixFilter : public SkColorFilter {
public:
static SkColorMatrixFilter* Create(const SkColorMatrix& cm) {
- return SkNEW_ARGS(SkColorMatrixFilter, (cm));
+ return new SkColorMatrixFilter(cm);
}
static SkColorMatrixFilter* Create(const SkScalar array[20]) {
- return SkNEW_ARGS(SkColorMatrixFilter, (array));
+ return new SkColorMatrixFilter(array);
}
void filterSpan(const SkPMColor src[], int count, SkPMColor[]) const override;
diff --git a/include/effects/SkComposeImageFilter.h b/include/effects/SkComposeImageFilter.h
index e3dc1ff..4946fa1 100644
--- a/include/effects/SkComposeImageFilter.h
+++ b/include/effects/SkComposeImageFilter.h
@@ -22,7 +22,7 @@
return SkRef(outer);
}
SkImageFilter* inputs[2] = { outer, inner };
- return SkNEW_ARGS(SkComposeImageFilter, (inputs));
+ return new SkComposeImageFilter(inputs);
}
void computeFastBounds(const SkRect& src, SkRect* dst) const override;
diff --git a/include/effects/SkCornerPathEffect.h b/include/effects/SkCornerPathEffect.h
index 1935790..4c89085 100644
--- a/include/effects/SkCornerPathEffect.h
+++ b/include/effects/SkCornerPathEffect.h
@@ -20,9 +20,7 @@
/** radius must be > 0 to have an effect. It specifies the distance from each corner
that should be "rounded".
*/
- static SkCornerPathEffect* Create(SkScalar radius) {
- return SkNEW_ARGS(SkCornerPathEffect, (radius));
- }
+ static SkCornerPathEffect* Create(SkScalar radius) { return new SkCornerPathEffect(radius); }
virtual ~SkCornerPathEffect();
virtual bool filterPath(SkPath* dst, const SkPath& src,
diff --git a/include/effects/SkDashPathEffect.h b/include/effects/SkDashPathEffect.h
index 0fd00d7..d3adeed 100644
--- a/include/effects/SkDashPathEffect.h
+++ b/include/effects/SkDashPathEffect.h
@@ -38,7 +38,7 @@
*/
static SkDashPathEffect* Create(const SkScalar intervals[], int count,
SkScalar phase) {
- return SkNEW_ARGS(SkDashPathEffect, (intervals, count, phase));
+ return new SkDashPathEffect(intervals, count, phase);
}
virtual ~SkDashPathEffect();
diff --git a/include/effects/SkDiscretePathEffect.h b/include/effects/SkDiscretePathEffect.h
index d05d181..b55dca8 100644
--- a/include/effects/SkDiscretePathEffect.h
+++ b/include/effects/SkDiscretePathEffect.h
@@ -32,8 +32,7 @@
static SkDiscretePathEffect* Create(SkScalar segLength,
SkScalar deviation,
uint32_t seedAssist=0) {
- return SkNEW_ARGS(SkDiscretePathEffect,
- (segLength, deviation, seedAssist));
+ return new SkDiscretePathEffect(segLength, deviation, seedAssist);
}
virtual bool filterPath(SkPath* dst, const SkPath& src,
diff --git a/include/effects/SkDropShadowImageFilter.h b/include/effects/SkDropShadowImageFilter.h
index 3ff3d80..964a576 100644
--- a/include/effects/SkDropShadowImageFilter.h
+++ b/include/effects/SkDropShadowImageFilter.h
@@ -25,8 +25,8 @@
ShadowMode shadowMode,
SkImageFilter* input = NULL,
const CropRect* cropRect = NULL) {
- return SkNEW_ARGS(SkDropShadowImageFilter, (dx, dy, sigmaX, sigmaY, color,
- shadowMode, input, cropRect));
+ return new SkDropShadowImageFilter(dx, dy, sigmaX, sigmaY, color, shadowMode, input,
+ cropRect);
}
void computeFastBounds(const SkRect&, SkRect*) const override;
diff --git a/include/effects/SkMergeImageFilter.h b/include/effects/SkMergeImageFilter.h
index 5bb6826..714a755 100644
--- a/include/effects/SkMergeImageFilter.h
+++ b/include/effects/SkMergeImageFilter.h
@@ -21,12 +21,12 @@
const CropRect* cropRect = NULL) {
SkImageFilter* inputs[2] = { first, second };
SkXfermode::Mode modes[2] = { mode, mode };
- return SkNEW_ARGS(SkMergeImageFilter, (inputs, 2, modes, cropRect));
+ return new SkMergeImageFilter(inputs, 2, modes, cropRect);
}
static SkMergeImageFilter* Create(SkImageFilter* filters[], int count,
const SkXfermode::Mode modes[] = NULL,
const CropRect* cropRect = NULL) {
- return SkNEW_ARGS(SkMergeImageFilter, (filters, count, modes, cropRect));
+ return new SkMergeImageFilter(filters, count, modes, cropRect);
}
SK_TO_STRING_OVERRIDE()
diff --git a/include/effects/SkMorphologyImageFilter.h b/include/effects/SkMorphologyImageFilter.h
index 3a24225..8d17609 100644
--- a/include/effects/SkMorphologyImageFilter.h
+++ b/include/effects/SkMorphologyImageFilter.h
@@ -57,7 +57,7 @@
if (radiusX < 0 || radiusY < 0) {
return NULL;
}
- return SkNEW_ARGS(SkDilateImageFilter, (radiusX, radiusY, input, cropRect));
+ return new SkDilateImageFilter(radiusX, radiusY, input, cropRect);
}
bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
@@ -85,7 +85,7 @@
if (radiusX < 0 || radiusY < 0) {
return NULL;
}
- return SkNEW_ARGS(SkErodeImageFilter, (radiusX, radiusY, input, cropRect));
+ return new SkErodeImageFilter(radiusX, radiusY, input, cropRect);
}
bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
diff --git a/include/effects/SkOffsetImageFilter.h b/include/effects/SkOffsetImageFilter.h
index 17c9627..30e380d 100644
--- a/include/effects/SkOffsetImageFilter.h
+++ b/include/effects/SkOffsetImageFilter.h
@@ -20,7 +20,7 @@
if (!SkScalarIsFinite(dx) || !SkScalarIsFinite(dy)) {
return NULL;
}
- return SkNEW_ARGS(SkOffsetImageFilter, (dx, dy, input, cropRect));
+ return new SkOffsetImageFilter(dx, dy, input, cropRect);
}
void computeFastBounds(const SkRect& src, SkRect* dst) const override;
SK_TO_STRING_OVERRIDE()
diff --git a/include/effects/SkPictureImageFilter.h b/include/effects/SkPictureImageFilter.h
index 731e11e..231a492 100644
--- a/include/effects/SkPictureImageFilter.h
+++ b/include/effects/SkPictureImageFilter.h
@@ -17,7 +17,7 @@
* Refs the passed-in picture.
*/
static SkPictureImageFilter* Create(const SkPicture* picture) {
- return SkNEW_ARGS(SkPictureImageFilter, (picture));
+ return new SkPictureImageFilter(picture);
}
/**
@@ -25,9 +25,8 @@
* the picture is drawn. (No scaling is implied by the dest rect; only the CTM is applied.)
*/
static SkPictureImageFilter* Create(const SkPicture* picture, const SkRect& cropRect) {
- return SkNEW_ARGS(SkPictureImageFilter, (picture, cropRect,
- kDeviceSpace_PictureResolution,
- kLow_SkFilterQuality));
+ return new SkPictureImageFilter(picture, cropRect, kDeviceSpace_PictureResolution,
+ kLow_SkFilterQuality);
}
/**
@@ -40,8 +39,8 @@
static SkPictureImageFilter* CreateForLocalSpace(const SkPicture* picture,
const SkRect& cropRect,
SkFilterQuality filterQuality) {
- return SkNEW_ARGS(SkPictureImageFilter, (picture, cropRect,
- kLocalSpace_PictureResolution, filterQuality));
+ return new SkPictureImageFilter(picture, cropRect, kLocalSpace_PictureResolution,
+ filterQuality);
}
SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureImageFilter)
diff --git a/include/effects/SkPixelXorXfermode.h b/include/effects/SkPixelXorXfermode.h
index 3e6fa84..8b7f338 100644
--- a/include/effects/SkPixelXorXfermode.h
+++ b/include/effects/SkPixelXorXfermode.h
@@ -17,9 +17,7 @@
*/
class SK_API SkPixelXorXfermode : public SkXfermode {
public:
- static SkPixelXorXfermode* Create(SkColor opColor) {
- return SkNEW_ARGS(SkPixelXorXfermode, (opColor));
- }
+ static SkPixelXorXfermode* Create(SkColor opColor) { return new SkPixelXorXfermode(opColor); }
SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPixelXorXfermode)
diff --git a/include/effects/SkTableMaskFilter.h b/include/effects/SkTableMaskFilter.h
index 6084ec4..1d53087 100644
--- a/include/effects/SkTableMaskFilter.h
+++ b/include/effects/SkTableMaskFilter.h
@@ -30,19 +30,19 @@
static void MakeClipTable(uint8_t table[256], uint8_t min, uint8_t max);
static SkTableMaskFilter* Create(const uint8_t table[256]) {
- return SkNEW_ARGS(SkTableMaskFilter, (table));
+ return new SkTableMaskFilter(table);
}
static SkTableMaskFilter* CreateGamma(SkScalar gamma) {
uint8_t table[256];
MakeGammaTable(table, gamma);
- return SkNEW_ARGS(SkTableMaskFilter, (table));
+ return new SkTableMaskFilter(table);
}
static SkTableMaskFilter* CreateClip(uint8_t min, uint8_t max) {
uint8_t table[256];
MakeClipTable(table, min, max);
- return SkNEW_ARGS(SkTableMaskFilter, (table));
+ return new SkTableMaskFilter(table);
}
SkMask::Format getFormat() const override;
diff --git a/include/effects/SkTestImageFilters.h b/include/effects/SkTestImageFilters.h
index 233d7b2..4fa0c43 100644
--- a/include/effects/SkTestImageFilters.h
+++ b/include/effects/SkTestImageFilters.h
@@ -22,7 +22,7 @@
if (scale > SK_Scalar1 || scale <= 0) {
return NULL;
}
- return SkNEW_ARGS(SkDownSampleImageFilter, (scale, input));
+ return new SkDownSampleImageFilter(scale, input);
}
SK_TO_STRING_OVERRIDE()
diff --git a/include/effects/SkXfermodeImageFilter.h b/include/effects/SkXfermodeImageFilter.h
index 30a3a5c..57fd288 100644
--- a/include/effects/SkXfermodeImageFilter.h
+++ b/include/effects/SkXfermodeImageFilter.h
@@ -27,7 +27,7 @@
SkImageFilter* foreground = NULL,
const CropRect* cropRect = NULL) {
SkImageFilter* inputs[2] = { background, foreground };
- return SkNEW_ARGS(SkXfermodeImageFilter, (mode, inputs, cropRect));
+ return new SkXfermodeImageFilter(mode, inputs, cropRect);
}
SK_TO_STRING_OVERRIDE()
diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h
index e4b2b09..e11ccc7 100644
--- a/include/gpu/GrPaint.h
+++ b/include/gpu/GrPaint.h
@@ -126,7 +126,7 @@
fCoverageStages = paint.fCoverageStages;
fXPFactory.reset(SkRef(paint.getXPFactory()));
- fProcDataManager.reset(SkNEW_ARGS(GrProcessorDataManager, (*paint.processorDataManager())));
+ fProcDataManager.reset(new GrProcessorDataManager(*paint.processorDataManager()));
return *this;
}
diff --git a/include/gpu/GrProgramElement.h b/include/gpu/GrProgramElement.h
index 2d834de..e788486 100644
--- a/include/gpu/GrProgramElement.h
+++ b/include/gpu/GrProgramElement.h
@@ -45,7 +45,7 @@
--fRefCnt;
if (0 == fRefCnt) {
if (0 == fPendingExecutions) {
- SkDELETE(this);
+ delete this;
return;
} else {
this->removeRefs();
@@ -96,7 +96,7 @@
--fPendingExecutions;
if (0 == fPendingExecutions) {
if (0 == fRefCnt) {
- SkDELETE(this);
+ delete this;
return;
} else {
this->pendingIOComplete();
diff --git a/include/gpu/effects/GrConstColorProcessor.h b/include/gpu/effects/GrConstColorProcessor.h
index 505c1b3..ccd2868 100644
--- a/include/gpu/effects/GrConstColorProcessor.h
+++ b/include/gpu/effects/GrConstColorProcessor.h
@@ -29,7 +29,7 @@
static const int kInputModeCnt = kLastInputMode + 1;
static GrFragmentProcessor* Create(GrColor color, InputMode mode) {
- return SkNEW_ARGS(GrConstColorProcessor, (color, mode));
+ return new GrConstColorProcessor(color, mode);
}
~GrConstColorProcessor() override {}
diff --git a/include/gpu/gl/GrGLExtensions.h b/include/gpu/gl/GrGLExtensions.h
index 89adadf..6a8557b 100644
--- a/include/gpu/gl/GrGLExtensions.h
+++ b/include/gpu/gl/GrGLExtensions.h
@@ -21,7 +21,7 @@
*/
class SK_API GrGLExtensions {
public:
- GrGLExtensions() : fInitialized(false), fStrings(SkNEW(SkTArray<SkString>)) {}
+ GrGLExtensions() : fInitialized(false), fStrings(new SkTArray<SkString>) {}
GrGLExtensions(const GrGLExtensions&);
diff --git a/include/gpu/gl/angle/SkANGLEGLContext.h b/include/gpu/gl/angle/SkANGLEGLContext.h
index 8850cd0..6590c76 100644
--- a/include/gpu/gl/angle/SkANGLEGLContext.h
+++ b/include/gpu/gl/angle/SkANGLEGLContext.h
@@ -20,9 +20,9 @@
if (kGL_GrGLStandard == forcedGpuAPI) {
return NULL;
}
- SkANGLEGLContext* ctx = SkNEW(SkANGLEGLContext);
+ SkANGLEGLContext* ctx = new SkANGLEGLContext;
if (!ctx->isValid()) {
- SkDELETE(ctx);
+ delete ctx;
return NULL;
}
return ctx;
diff --git a/include/private/SkFunction.h b/include/private/SkFunction.h
index 024ba7c..1b99030 100644
--- a/include/private/SkFunction.h
+++ b/include/private/SkFunction.h
@@ -21,9 +21,10 @@
SkFunction() {}
template <typename Fn>
- SkFunction(const Fn& fn) : fFunction(SkNEW_ARGS(LambdaImpl<Fn>, (fn))) {}
+ SkFunction(const Fn& fn)
+ : fFunction(new LambdaImpl<Fn>(fn)) {}
- SkFunction(R (*fn)(Args...)) : fFunction(SkNEW_ARGS(FnPtrImpl, (fn))) {}
+ SkFunction(R (*fn)(Args...)) : fFunction(new FnPtrImpl(fn)) {}
SkFunction(const SkFunction& other) { *this = other; }
SkFunction& operator=(const SkFunction& other) {
@@ -51,7 +52,8 @@
LambdaImpl(const Fn& fn) : fFn(fn) {}
R call(Args... args) const override { return fFn(skstd::forward<Args>(args)...); }
- Interface* clone() const override { return SkNEW_ARGS(LambdaImpl<Fn>, (fFn)); }
+ Interface* clone() const override { return new LambdaImpl<Fn>(fFn); }
+
private:
Fn fFn;
};
@@ -61,7 +63,8 @@
FnPtrImpl(R (*fn)(Args...)) : fFn(fn) {}
R call(Args... args) const override { return fFn(skstd::forward<Args>(args)...); }
- Interface* clone() const override { return SkNEW_ARGS(FnPtrImpl, (fFn)); }
+ Interface* clone() const override { return new FnPtrImpl(fFn); }
+
private:
R (*fFn)(Args...);
};
diff --git a/include/private/SkTHash.h b/include/private/SkTHash.h
index 561fc89..53d5275 100644
--- a/include/private/SkTHash.h
+++ b/include/private/SkTHash.h
@@ -29,7 +29,7 @@
// Clear the table.
void reset() {
this->~SkTHashTable();
- SkNEW_PLACEMENT(this, SkTHashTable);
+ new (this) SkTHashTable;
}
// How many entries are in the table?
diff --git a/include/private/SkTemplates.h b/include/private/SkTemplates.h
index afab0ef..1cbc4f1 100644
--- a/include/private/SkTemplates.h
+++ b/include/private/SkTemplates.h
@@ -138,7 +138,7 @@
template <typename T> class SkAutoTDelete : SkNoncopyable {
public:
SkAutoTDelete(T* obj = NULL) : fObj(obj) {}
- ~SkAutoTDelete() { SkDELETE(fObj); }
+ ~SkAutoTDelete() { delete fObj; }
T* get() const { return fObj; }
operator T*() const { return fObj; }
@@ -147,7 +147,7 @@
void reset(T* obj) {
if (fObj != obj) {
- SkDELETE(fObj);
+ delete fObj;
fObj = obj;
}
}
@@ -156,7 +156,7 @@
* Delete the owned object, setting the internal pointer to NULL.
*/
void free() {
- SkDELETE(fObj);
+ delete fObj;
fObj = NULL;
}
@@ -200,15 +200,18 @@
template <typename T> class SkAutoTDeleteArray : SkNoncopyable {
public:
SkAutoTDeleteArray(T array[]) : fArray(array) {}
- ~SkAutoTDeleteArray() { SkDELETE_ARRAY(fArray); }
+ ~SkAutoTDeleteArray() { delete[] fArray; }
T* get() const { return fArray; }
- void free() { SkDELETE_ARRAY(fArray); fArray = NULL; }
+ void free() {
+ delete[] fArray;
+ fArray = NULL;
+ }
T* detach() { T* array = fArray; fArray = NULL; return array; }
void reset(T array[]) {
if (fArray != array) {
- SkDELETE_ARRAY(fArray);
+ delete[] fArray;
fArray = array;
}
}
@@ -231,7 +234,7 @@
SkASSERT(count >= 0);
fArray = NULL;
if (count) {
- fArray = SkNEW_ARRAY(T, count);
+ fArray = new T[count];
}
SkDEBUGCODE(fCount = count;)
}
@@ -239,18 +242,16 @@
/** Reallocates given a new count. Reallocation occurs even if new count equals old count.
*/
void reset(int count) {
- SkDELETE_ARRAY(fArray);
+ delete[] fArray;
SkASSERT(count >= 0);
fArray = NULL;
if (count) {
- fArray = SkNEW_ARRAY(T, count);
+ fArray = new T[count];
}
SkDEBUGCODE(fCount = count;)
}
- ~SkAutoTArray() {
- SkDELETE_ARRAY(fArray);
- }
+ ~SkAutoTArray() { delete[] fArray; }
/** Return the array of T elements. Will be NULL if count == 0
*/
@@ -329,7 +330,7 @@
iter = fArray;
T* stop = fArray + count;
while (iter < stop) {
- SkNEW_PLACEMENT(iter++, T);
+ new (iter++) T;
}
}
@@ -499,7 +500,7 @@
if (storage == obj) {
obj->~T();
} else {
- SkDELETE(obj);
+ delete obj;
}
}
@@ -512,12 +513,12 @@
* SkInPlaceDeleteCheck(obj, storage);
*/
template <typename T> T* SkInPlaceNewCheck(void* storage, size_t size) {
- return (sizeof(T) <= size) ? new (storage) T : SkNEW(T);
+ return (sizeof(T) <= size) ? new (storage) T : new T;
}
template <typename T, typename A1, typename A2, typename A3>
T* SkInPlaceNewCheck(void* storage, size_t size, const A1& a1, const A2& a2, const A3& a3) {
- return (sizeof(T) <= size) ? new (storage) T(a1, a2, a3) : SkNEW_ARGS(T, (a1, a2, a3));
+ return (sizeof(T) <= size) ? new (storage) T(a1, a2, a3) : new T(a1, a2, a3);
}
/**
diff --git a/platform_tools/android/apps/visualbench/src/main/jni/main.cpp b/platform_tools/android/apps/visualbench/src/main/jni/main.cpp
index 2ea6b76..ba78c3f 100644
--- a/platform_tools/android/apps/visualbench/src/main/jni/main.cpp
+++ b/platform_tools/android/apps/visualbench/src/main/jni/main.cpp
@@ -124,7 +124,7 @@
}
if (kDestroyRequested_State == visualBenchState.fState) {
- SkDELETE(visualBenchState.fWindow);
+ delete visualBenchState.fWindow;
visualBenchState.fWindow = NULL;
application_term();
ANativeActivity_finish(state->activity);
diff --git a/samplecode/ClockFaceView.cpp b/samplecode/ClockFaceView.cpp
index 4717c30..9a1f8f9 100644
--- a/samplecode/ClockFaceView.cpp
+++ b/samplecode/ClockFaceView.cpp
@@ -104,7 +104,7 @@
SkFlattenable* Dot2DPathEffect::CreateProc(SkReadBuffer& buffer) {
SkMatrix matrix;
buffer.readMatrix(&matrix);
- return SkNEW_ARGS(Dot2DPathEffect, (buffer.readScalar(), matrix, NULL));
+ return new Dot2DPathEffect(buffer.readScalar(), matrix, NULL);
}
class InverseFillPE : public SkPathEffect {
@@ -129,9 +129,7 @@
typedef SkPathEffect INHERITED;
};
-SkFlattenable* InverseFillPE::CreateProc(SkReadBuffer& buffer) {
- return SkNEW(InverseFillPE);
-}
+SkFlattenable* InverseFillPE::CreateProc(SkReadBuffer& buffer) { return new InverseFillPE; }
static SkPathEffect* makepe(float interp, SkTDArray<SkPoint>* pts) {
SkMatrix lattice;
diff --git a/samplecode/GMSampleView.cpp b/samplecode/GMSampleView.cpp
index e74612b..24c94cb 100644
--- a/samplecode/GMSampleView.cpp
+++ b/samplecode/GMSampleView.cpp
@@ -14,7 +14,7 @@
}
SkEvent* GMSampleView::NewShowSizeEvt(bool doShowSize) {
- SkEvent* evt = SkNEW_ARGS(SkEvent, ("GMSampleView::showSize"));
+ SkEvent* evt = new SkEvent("GMSampleView::showSize");
evt->setFast32(doShowSize);
return evt;
}
diff --git a/samplecode/OverView.cpp b/samplecode/OverView.cpp
index bdb8ddd..9e229ff 100644
--- a/samplecode/OverView.cpp
+++ b/samplecode/OverView.cpp
@@ -119,7 +119,7 @@
};
SkView* create_overview(int count, const SkViewFactory* factories[]) {
- return SkNEW_ARGS(OverView, (count, factories));
+ return new OverView(count, factories);
}
bool is_overview(SkView* view) {
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 1d4bd1e..d2f10b3 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -1275,9 +1275,8 @@
fSubpixelState != SkOSMenu::kMixedState ||
fHintingState > 0 ||
fFilterQualityIndex > 0) {
-
- canvas = SkNEW_ARGS(FlagsFilterCanvas, (canvas, fLCDState, fAAState, fSubpixelState,
- fHintingState, fFilterQualityIndex));
+ canvas = new FlagsFilterCanvas(canvas, fLCDState, fAAState, fSubpixelState, fHintingState,
+ fFilterQualityIndex);
fFlagsFilterCanvas.reset(canvas);
}
@@ -1671,10 +1670,10 @@
}
break;
case 'B':
- post_event_to_sink(SkNEW_ARGS(SkEvent, ("PictFileView::toggleBBox")), curr_view(this));
+ post_event_to_sink(new SkEvent("PictFileView::toggleBBox"), curr_view(this));
// Cannot call updateTitle() synchronously, because the toggleBBox event is still in
// the queue.
- post_event_to_sink(SkNEW_ARGS(SkEvent, (gUpdateWindowTitleEvtName)), this);
+ post_event_to_sink(new SkEvent(gUpdateWindowTitleEvtName), this);
this->inval(NULL);
break;
case 'D':
diff --git a/samplecode/SampleArc.cpp b/samplecode/SampleArc.cpp
index 842e7a0..90fbb78 100644
--- a/samplecode/SampleArc.cpp
+++ b/samplecode/SampleArc.cpp
@@ -92,7 +92,7 @@
fRect.set(0, 0, SkIntToScalar(200), SkIntToScalar(200));
fRect.offset(SkIntToScalar(20), SkIntToScalar(20));
- fAnimatingDrawable = SkNEW_ARGS(MyDrawable, (fRect));
+ fAnimatingDrawable = new MyDrawable(fRect);
SkPictureRecorder recorder;
this->drawRoot(recorder.beginRecording(SkRect::MakeWH(800, 500)));
diff --git a/samplecode/SampleHT.cpp b/samplecode/SampleHT.cpp
index 20648cc..7b45250 100644
--- a/samplecode/SampleHT.cpp
+++ b/samplecode/SampleHT.cpp
@@ -61,8 +61,8 @@
void spawnAnimation(SkMSec now) {
this->setTime(now);
- SkDELETE(fInterp);
- fInterp = SkNEW_ARGS(SkInterpolator, (5, 3));
+ delete fInterp;
+ fInterp = new SkInterpolator(5, 3);
SkScalar values[5];
color_to_floats(fColor, values); values[4] = 0;
fInterp->setKeyFrame(0, now, values);
@@ -101,7 +101,7 @@
switch (res) {
case SkInterpolator::kFreezeEnd_Result:
- SkDELETE(fInterp);
+ delete fInterp;
fInterp = NULL;
break;
default:
diff --git a/samplecode/SampleIdentityScale.cpp b/samplecode/SampleIdentityScale.cpp
index 3302d27..7a329de 100644
--- a/samplecode/SampleIdentityScale.cpp
+++ b/samplecode/SampleIdentityScale.cpp
@@ -33,7 +33,7 @@
if (codec) {
stream.rewind();
codec->decode(&stream, &fBM, kN32_SkColorType, SkImageDecoder::kDecodePixels_Mode);
- SkDELETE(codec);
+ delete codec;
} else {
fBM.allocN32Pixels(1, 1);
*(fBM.getAddr32(0,0)) = 0xFF0000FF; // red == bad
diff --git a/samplecode/SampleLua.cpp b/samplecode/SampleLua.cpp
index 8865f1a..5fc9ab0 100644
--- a/samplecode/SampleLua.cpp
+++ b/samplecode/SampleLua.cpp
@@ -41,9 +41,7 @@
public:
LuaView() : fLua(NULL) {}
- virtual ~LuaView() {
- SkDELETE(fLua);
- }
+ virtual ~LuaView() { delete fLua; }
void setImageFilename(lua_State* L) {
SkString str = GetResourcePath("mandrill_256.png");
@@ -59,7 +57,7 @@
lua_State* ensureLua() {
if (NULL == fLua) {
- fLua = SkNEW(SkLua);
+ fLua = new SkLua;
SkString str = GetResourcePath(LUA_FILENAME);
SkData* data = SkData::NewFromFileName(str.c_str());
diff --git a/samplecode/SamplePdfFileViewer.cpp b/samplecode/SamplePdfFileViewer.cpp
index 6faea55..747f729 100644
--- a/samplecode/SamplePdfFileViewer.cpp
+++ b/samplecode/SamplePdfFileViewer.cpp
@@ -5,6 +5,8 @@
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+
#ifdef SAMPLE_PDF_FILE_VIEWER
#include "SampleCode.h"
@@ -40,7 +42,7 @@
return NULL;
}
- SkPicture* pic = SkNEW(SkPicture);
+ SkPicture* pic = new SkPicture;
SkCanvas* canvas = pic->beginRecording((int) renderer->MediaBox(0).width(),
(int) renderer->MediaBox(0).height());
renderer->renderPage(0, canvas, renderer->MediaBox(0));
diff --git a/samplecode/SamplePictFile.cpp b/samplecode/SamplePictFile.cpp
index c0973a5..dd315f8 100644
--- a/samplecode/SamplePictFile.cpp
+++ b/samplecode/SamplePictFile.cpp
@@ -194,7 +194,7 @@
// no bbox playback necessary
return pic.detach();
case kRTree_BBoxType:
- factory.reset(SkNEW(SkRTreeFactory));
+ factory.reset(new SkRTreeFactory);
break;
default:
SkASSERT(false);
diff --git a/samplecode/SampleSubpixelTranslate.cpp b/samplecode/SampleSubpixelTranslate.cpp
index 0299363..0f7639e 100644
--- a/samplecode/SampleSubpixelTranslate.cpp
+++ b/samplecode/SampleSubpixelTranslate.cpp
@@ -35,7 +35,7 @@
if (codec) {
stream.rewind();
codec->decode(&stream, &fBM, kN32_SkColorType, SkImageDecoder::kDecodePixels_Mode);
- SkDELETE(codec);
+ delete codec;
} else {
fBM.allocN32Pixels(1, 1);
*(fBM.getAddr32(0,0)) = 0xFF0000FF; // red == bad
diff --git a/site/dev/contrib/style.md b/site/dev/contrib/style.md
index 177a58b..ec556d9 100644
--- a/site/dev/contrib/style.md
+++ b/site/dev/contrib/style.md
@@ -385,23 +385,6 @@
<!--?prettify?-->
~~~~
this->method();
-Memory Management
-~~~~
-
-All memory allocation should be routed through SkNEW and its variants. These are
-#defined in SkPostConfig.h, but the correct way to get access to the config
-system is to #include SkTypes.h, which will allow external users of the library
-to provide a custom memory manager or other adaptations.
-
-<!--?prettify?-->
-~~~~
-SkNEW(type_name)
-SkNEW_ARGS(type_name, args)
-SkNEW_ARRAY(type_name, count)
-SkNEW_PLACEMENT(buf, type_name)
-SkNEW_PLACEMENT_ARGS(buf, type_name, args)
-SkDELETE(obj)
-SkDELETE_ARRAY(array)
~~~~
Comparisons
diff --git a/site/user/api/canvas.md b/site/user/api/canvas.md
index eacd1cc..bb29652 100644
--- a/site/user/api/canvas.md
+++ b/site/user/api/canvas.md
@@ -202,7 +202,7 @@
void(*draw)(SkCanvas*),
const char* path) {
SkFILEWStream svgStream(path);
- SkAutoTDelete<SkXMLWriter> xmlWriter(SkNEW_ARGS(SkXMLStreamWriter, (&svgStream)));
+ SkAutoTDelete<SkXMLWriter> xmlWriter(new SkXMLStreamWriter(&svgStream));
SkAutoTUnref<SkCanvas> svgCanvas(SkSVGCanvas::Create(
SkRect::MakeWH(SkIntToScalar(src.size().width()),
SkIntToScalar(src.size().height())),
diff --git a/src/animator/SkAnimateActive.cpp b/src/animator/SkAnimateActive.cpp
index 697c077..8d8c268 100644
--- a/src/animator/SkAnimateActive.cpp
+++ b/src/animator/SkAnimateActive.cpp
@@ -31,7 +31,7 @@
fState.setCount(animators);
int index;
for (index = 0; index < animators; index++)
- fInterpolators[index] = SkNEW(SkOperandInterpolator);
+ fInterpolators[index] = new SkOperandInterpolator;
initState(&fApply, 0);
// for (index = 0; index < animators; index++)
// fState[index].bumpSave();
@@ -65,7 +65,7 @@
fInterpolators.setCount(total);
memset(&fInterpolators.begin()[oldCount], 0, newCount * sizeof(SkOperandInterpolator*));
for (index = oldCount; index < total; index++)
- fInterpolators[index] = SkNEW(SkOperandInterpolator);
+ fInterpolators[index] = new SkOperandInterpolator;
fAnimators.setCount(total);
memcpy(&fAnimators[oldCount], animates.begin(), sizeof(fAnimators[0]) *
newCount);
diff --git a/src/animator/SkAnimateSet.cpp b/src/animator/SkAnimateSet.cpp
index ec06a9e..6679a92 100644
--- a/src/animator/SkAnimateSet.cpp
+++ b/src/animator/SkAnimateSet.cpp
@@ -67,7 +67,7 @@
fValues.setType(outType);
fValues.setCount(comps);
if (outType == SkType_String || outType == SkType_DynamicString)
- fValues[0].fString = SkNEW(SkString);
+ fValues[0].fString = new SkString;
else
memset(fValues.begin(), 0, fValues.count() * sizeof(fValues.begin()[0]));
} else {
diff --git a/src/animator/SkAnimator.cpp b/src/animator/SkAnimator.cpp
index f2b7780..97f55af 100644
--- a/src/animator/SkAnimator.cpp
+++ b/src/animator/SkAnimator.cpp
@@ -46,9 +46,7 @@
initialize();
}
-SkAnimator::~SkAnimator() {
- SkDELETE(fMaker);
-}
+SkAnimator::~SkAnimator() { delete fMaker; }
void SkAnimator::addExtras(SkExtras* extras) {
*fMaker->fExtras.append() = extras;
@@ -386,8 +384,8 @@
}
void SkAnimator::initialize() {
- SkDELETE(fMaker);
- fMaker = SkNEW_ARGS(SkAnimateMaker, (this, NULL, NULL));
+ delete fMaker;
+ fMaker = new SkAnimateMaker(this, NULL, NULL);
decodeMemory(gMathPrimer, sizeof(gMathPrimer)-1);
#ifdef SK_BUILD_FOR_ANDROID
InitializeSkExtraPathEffects(this);
diff --git a/src/animator/SkAnimatorScript.cpp b/src/animator/SkAnimatorScript.cpp
index f4ea518..051dc0d 100644
--- a/src/animator/SkAnimatorScript.cpp
+++ b/src/animator/SkAnimatorScript.cpp
@@ -462,13 +462,13 @@
} break;
case SkType_String: {
SkDisplayString* boxedValue = (SkDisplayString*) displayable;
- scriptValue->fOperand.fString = SkNEW_ARGS(SkString, (boxedValue->value));
+ scriptValue->fOperand.fString = new SkString(boxedValue->value);
} break;
default: {
const char* id = NULL;
SkDEBUGCODE(bool success = ) maker->findKey(displayable, &id);
SkASSERT(success);
- scriptValue->fOperand.fString = SkNEW_ARGS(SkString, (id));
+ scriptValue->fOperand.fString = new SkString(id);
type = SkType_String;
}
}
diff --git a/src/animator/SkAnimatorScript2.cpp b/src/animator/SkAnimatorScript2.cpp
index 28912fb..700027a 100644
--- a/src/animator/SkAnimatorScript2.cpp
+++ b/src/animator/SkAnimatorScript2.cpp
@@ -329,13 +329,13 @@
} break;
case SkType_String: {
SkDisplayString* boxedValue = (SkDisplayString*) displayable;
- operand->fString = SkNEW_ARGS(SkString, (boxedValue->value));
+ operand->fString = new SkString(boxedValue->value);
} break;
default: {
const char* id;
bool success = fEngine->getMaker().findKey(displayable, &id);
SkASSERT(success);
- operand->fString = SkNEW_ARGS(SkString, (id));
+ operand->fString = new SkString(id);
}
}
return true;
diff --git a/src/animator/SkScript.cpp b/src/animator/SkScript.cpp
index c430695..0694fc4 100644
--- a/src/animator/SkScript.cpp
+++ b/src/animator/SkScript.cpp
@@ -1356,7 +1356,7 @@
break;
case kAddString:
if (fTrackString.find(operand1.fString) < 0) {
- operand1.fString = SkNEW_ARGS(SkString, (*operand1.fString));
+ operand1.fString = new SkString(*operand1.fString);
track(operand1.fString);
}
operand1.fString->append(*operand2.fString);
diff --git a/src/animator/SkScriptRuntime.cpp b/src/animator/SkScriptRuntime.cpp
index 07bd4c9..5517b51 100644
--- a/src/animator/SkScriptRuntime.cpp
+++ b/src/animator/SkScriptRuntime.cpp
@@ -221,9 +221,9 @@
break;
case SkScriptEngine2::kAddString:
// if (fTrackString.find(operand[1].fString) < 0) {
-// operand[1].fString = SkNEW_ARGS(SkString, (*operand[1].fString));
-// track(operand[1].fString);
-// }
+ // operand[1].fString = new SkString (*operand[1].fString);
+ // track(operand[1].fString);
+ // }
operand[0].fString->append(*operand[1].fString);
break;
case SkScriptEngine2::kBitAndInt:
diff --git a/src/c/sk_paint.cpp b/src/c/sk_paint.cpp
index 330c796..dcf2683 100644
--- a/src/c/sk_paint.cpp
+++ b/src/c/sk_paint.cpp
@@ -42,13 +42,9 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
-sk_paint_t* sk_paint_new() {
- return (sk_paint_t*)SkNEW(SkPaint);
-}
+sk_paint_t* sk_paint_new() { return (sk_paint_t*)new SkPaint; }
-void sk_paint_delete(sk_paint_t* cpaint) {
- SkDELETE(AsPaint(cpaint));
-}
+void sk_paint_delete(sk_paint_t* cpaint) { delete AsPaint(cpaint); }
bool sk_paint_is_antialias(const sk_paint_t* cpaint) {
return AsPaint(*cpaint).isAntiAlias();
diff --git a/src/c/sk_surface.cpp b/src/c/sk_surface.cpp
index ccab9df..722ca46 100644
--- a/src/c/sk_surface.cpp
+++ b/src/c/sk_surface.cpp
@@ -258,13 +258,9 @@
///////////////////////////////////////////////////////////////////////////////////////////
-sk_path_t* sk_path_new() {
- return (sk_path_t*)SkNEW(SkPath);
-}
+sk_path_t* sk_path_new() { return (sk_path_t*)new SkPath; }
-void sk_path_delete(sk_path_t* cpath) {
- SkDELETE(as_path(cpath));
-}
+void sk_path_delete(sk_path_t* cpath) { delete as_path(cpath); }
void sk_path_move_to(sk_path_t* cpath, float x, float y) {
as_path(cpath)->moveTo(x, y);
diff --git a/src/codec/SkBmpCodec.cpp b/src/codec/SkBmpCodec.cpp
index 20af2da..b88c892 100644
--- a/src/codec/SkBmpCodec.cpp
+++ b/src/codec/SkBmpCodec.cpp
@@ -113,8 +113,7 @@
// Bmps embedded in Icos skip the first Bmp header
if (!inIco) {
// Read the first header and the size of the second header
- SkAutoTDeleteArray<uint8_t> hBuffer(
- SkNEW_ARRAY(uint8_t, kBmpHeaderBytesPlusFour));
+ SkAutoTDeleteArray<uint8_t> hBuffer(new uint8_t[kBmpHeaderBytesPlusFour]);
if (stream->read(hBuffer.get(), kBmpHeaderBytesPlusFour) !=
kBmpHeaderBytesPlusFour) {
SkCodecPrintf("Error: unable to read first bitmap header.\n");
@@ -148,8 +147,7 @@
offset = 0;
// Read the size of the second header
- SkAutoTDeleteArray<uint8_t> hBuffer(
- SkNEW_ARRAY(uint8_t, 4));
+ SkAutoTDeleteArray<uint8_t> hBuffer(new uint8_t[4]);
if (stream->read(hBuffer.get(), 4) != 4) {
SkCodecPrintf("Error: unable to read size of second bitmap header.\n");
return false;
@@ -165,8 +163,7 @@
const uint32_t infoBytesRemaining = infoBytes - 4;
// Read the second header
- SkAutoTDeleteArray<uint8_t> iBuffer(
- SkNEW_ARRAY(uint8_t, infoBytesRemaining));
+ SkAutoTDeleteArray<uint8_t> iBuffer(new uint8_t[infoBytesRemaining]);
if (stream->read(iBuffer.get(), infoBytesRemaining) != infoBytesRemaining) {
SkCodecPrintf("Error: unable to read second bitmap header.\n");
return false;
@@ -313,8 +310,7 @@
switch (headerType) {
case kInfoV1_BmpHeaderType: {
// The V1 header stores the bit masks after the header
- SkAutoTDeleteArray<uint8_t> mBuffer(
- SkNEW_ARRAY(uint8_t, kBmpMaskBytes));
+ SkAutoTDeleteArray<uint8_t> mBuffer(new uint8_t[kBmpMaskBytes]);
if (stream->read(mBuffer.get(), kBmpMaskBytes) !=
kBmpMaskBytes) {
SkCodecPrintf("Error: unable to read bit inputMasks.\n");
@@ -472,9 +468,9 @@
// Return the codec
switch (inputFormat) {
case kStandard_BmpInputFormat:
- *codecOut = SkNEW_ARGS(SkBmpStandardCodec, (imageInfo, stream,
- bitsPerPixel, numColors, bytesPerColor,
- offset - bytesRead, rowOrder, inIco));
+ *codecOut =
+ new SkBmpStandardCodec(imageInfo, stream, bitsPerPixel, numColors,
+ bytesPerColor, offset - bytesRead, rowOrder, inIco);
return true;
case kBitMask_BmpInputFormat:
// Bmp-in-Ico must be standard mode
@@ -490,8 +486,8 @@
return false;
}
- *codecOut = SkNEW_ARGS(SkBmpMaskCodec, (imageInfo, stream,
- bitsPerPixel, masks.detach(), rowOrder));
+ *codecOut = new SkBmpMaskCodec(imageInfo, stream, bitsPerPixel, masks.detach(),
+ rowOrder);
return true;
case kRLE_BmpInputFormat:
// Bmp-in-Ico must be standard mode
@@ -499,9 +495,9 @@
// require that RLE Bmps have a valid number of totalBytes, and
// Icos skip the header that contains totalBytes.
SkASSERT(!inIco);
- *codecOut = SkNEW_ARGS(SkBmpRLECodec, (
- imageInfo, stream, bitsPerPixel, numColors,
- bytesPerColor, offset - bytesRead, rowOrder, RLEBytes));
+ *codecOut =
+ new SkBmpRLECodec(imageInfo, stream, bitsPerPixel, numColors, bytesPerColor,
+ offset - bytesRead, rowOrder, RLEBytes);
return true;
default:
SkASSERT(false);
diff --git a/src/codec/SkBmpMaskCodec.cpp b/src/codec/SkBmpMaskCodec.cpp
index 1c89ba1..90457b2 100644
--- a/src/codec/SkBmpMaskCodec.cpp
+++ b/src/codec/SkBmpMaskCodec.cpp
@@ -58,7 +58,7 @@
bool SkBmpMaskCodec::initializeSwizzler(const SkImageInfo& dstInfo) {
// Allocate space for a row buffer
const size_t rowBytes = SkAlign4(compute_row_bytes(dstInfo.width(), this->bitsPerPixel()));
- fSrcBuffer.reset(SkNEW_ARRAY(uint8_t, rowBytes));
+ fSrcBuffer.reset(new uint8_t[rowBytes]);
// Create the swizzler
fMaskSwizzler.reset(SkMaskSwizzler::CreateMaskSwizzler(
diff --git a/src/codec/SkBmpRLECodec.cpp b/src/codec/SkBmpRLECodec.cpp
index 14a5b01..ed0617f 100644
--- a/src/codec/SkBmpRLECodec.cpp
+++ b/src/codec/SkBmpRLECodec.cpp
@@ -15,19 +15,22 @@
* Creates an instance of the decoder
* Called only by NewFromStream
*/
-SkBmpRLECodec::SkBmpRLECodec(const SkImageInfo& info, SkStream* stream,
- uint16_t bitsPerPixel, uint32_t numColors,
- uint32_t bytesPerColor, uint32_t offset,
- SkBmpCodec::RowOrder rowOrder, size_t RLEBytes)
+SkBmpRLECodec::SkBmpRLECodec(const SkImageInfo& info,
+ SkStream* stream,
+ uint16_t bitsPerPixel,
+ uint32_t numColors,
+ uint32_t bytesPerColor,
+ uint32_t offset,
+ SkBmpCodec::RowOrder rowOrder,
+ size_t RLEBytes)
: INHERITED(info, stream, bitsPerPixel, rowOrder)
, fColorTable(NULL)
, fNumColors(this->computeNumColors(numColors))
, fBytesPerColor(bytesPerColor)
, fOffset(offset)
- , fStreamBuffer(SkNEW_ARRAY(uint8_t, RLEBytes))
+ , fStreamBuffer(new uint8_t[RLEBytes])
, fRLEBytes(RLEBytes)
- , fCurrRLEByte(0)
-{}
+ , fCurrRLEByte(0) {}
/*
* Initiates the bitmap decode
@@ -92,7 +95,7 @@
// Read the color table from the stream
colorBytes = fNumColors * fBytesPerColor;
- SkAutoTDeleteArray<uint8_t> cBuffer(SkNEW_ARRAY(uint8_t, colorBytes));
+ SkAutoTDeleteArray<uint8_t> cBuffer(new uint8_t[colorBytes]);
if (stream()->read(cBuffer.get(), colorBytes) != colorBytes) {
SkCodecPrintf("Error: unable to read color table.\n");
return false;
@@ -115,7 +118,7 @@
}
// Set the color table
- fColorTable.reset(SkNEW_ARGS(SkColorTable, (colorTable, maxColors)));
+ fColorTable.reset(new SkColorTable(colorTable, maxColors));
}
// Check that we have not read past the pixel array offset
diff --git a/src/codec/SkBmpStandardCodec.cpp b/src/codec/SkBmpStandardCodec.cpp
index 27cea4e..8404aa6 100644
--- a/src/codec/SkBmpStandardCodec.cpp
+++ b/src/codec/SkBmpStandardCodec.cpp
@@ -91,7 +91,7 @@
// Read the color table from the stream
colorBytes = fNumColors * fBytesPerColor;
- SkAutoTDeleteArray<uint8_t> cBuffer(SkNEW_ARRAY(uint8_t, colorBytes));
+ SkAutoTDeleteArray<uint8_t> cBuffer(new uint8_t[colorBytes]);
if (stream()->read(cBuffer.get(), colorBytes) != colorBytes) {
SkCodecPrintf("Error: unable to read color table.\n");
return false;
@@ -139,7 +139,7 @@
}
// Set the color table
- fColorTable.reset(SkNEW_ARGS(SkColorTable, (colorTable, maxColors)));
+ fColorTable.reset(new SkColorTable(colorTable, maxColors));
}
// Bmp-in-Ico files do not use an offset to indicate where the pixel data
@@ -171,7 +171,7 @@
const Options& opts) {
// Allocate space for a row buffer
const size_t rowBytes = SkAlign4(compute_row_bytes(dstInfo.width(), this->bitsPerPixel()));
- fSrcBuffer.reset(SkNEW_ARRAY(uint8_t, rowBytes));
+ fSrcBuffer.reset(new uint8_t[rowBytes]);
// Get swizzler configuration
SkSwizzler::SrcConfig config;
diff --git a/src/codec/SkCodec.cpp b/src/codec/SkCodec.cpp
index 62eec27..76abcda 100644
--- a/src/codec/SkCodec.cpp
+++ b/src/codec/SkCodec.cpp
@@ -72,7 +72,7 @@
if (!data) {
return NULL;
}
- return NewFromStream(SkNEW_ARGS(SkMemoryStream, (data)));
+ return NewFromStream(new SkMemoryStream(data));
}
SkCodec::SkCodec(const SkImageInfo& info, SkStream* stream)
diff --git a/src/codec/SkCodec_libgif.cpp b/src/codec/SkCodec_libgif.cpp
index 1d6164e..40d159a 100644
--- a/src/codec/SkCodec_libgif.cpp
+++ b/src/codec/SkCodec_libgif.cpp
@@ -170,7 +170,7 @@
// use kPremul directly even when kUnpremul is supported.
const SkImageInfo& imageInfo = SkImageInfo::Make(width, height,
kIndex_8_SkColorType, kPremul_SkAlphaType);
- *codecOut = SkNEW_ARGS(SkGifCodec, (imageInfo, streamDeleter.detach(), gif.detach()));
+ *codecOut = new SkGifCodec(imageInfo, streamDeleter.detach(), gif.detach());
} else {
SkASSERT(NULL != gifOut);
streamDeleter.detach();
@@ -415,8 +415,7 @@
}
// Stores output from dgiflib and input to the swizzler
- SkAutoTDeleteArray<uint8_t>
- buffer(SkNEW_ARRAY(uint8_t, innerWidth));
+ SkAutoTDeleteArray<uint8_t> buffer(new uint8_t[innerWidth]);
// Check the interlace flag and iterate over rows of the input
if (fGif->Image.Interlace) {
diff --git a/src/codec/SkCodec_libico.cpp b/src/codec/SkCodec_libico.cpp
index 2f1543e..e8e6531 100644
--- a/src/codec/SkCodec_libico.cpp
+++ b/src/codec/SkCodec_libico.cpp
@@ -41,8 +41,7 @@
static const uint32_t kIcoDirEntryBytes = 16;
// Read the directory header
- SkAutoTDeleteArray<uint8_t> dirBuffer(
- SkNEW_ARRAY(uint8_t, kIcoDirectoryBytes));
+ SkAutoTDeleteArray<uint8_t> dirBuffer(new uint8_t[kIcoDirectoryBytes]);
if (inputStream.get()->read(dirBuffer.get(), kIcoDirectoryBytes) !=
kIcoDirectoryBytes) {
SkCodecPrintf("Error: unable to read ico directory header.\n");
@@ -57,8 +56,7 @@
}
// Ensure that we can read all of indicated directory entries
- SkAutoTDeleteArray<uint8_t> entryBuffer(
- SkNEW_ARRAY(uint8_t, numImages*kIcoDirEntryBytes));
+ SkAutoTDeleteArray<uint8_t> entryBuffer(new uint8_t[numImages * kIcoDirEntryBytes]);
if (inputStream.get()->read(entryBuffer.get(), numImages*kIcoDirEntryBytes) !=
numImages*kIcoDirEntryBytes) {
SkCodecPrintf("Error: unable to read ico directory entries.\n");
@@ -72,7 +70,7 @@
uint32_t offset;
uint32_t size;
};
- SkAutoTDeleteArray<Entry> directoryEntries(SkNEW_ARRAY(Entry, numImages));
+ SkAutoTDeleteArray<Entry> directoryEntries(new Entry[numImages]);
// Iterate over directory entries
for (uint32_t i = 0; i < numImages; i++) {
@@ -111,7 +109,7 @@
// Now will construct a candidate codec for each of the embedded images
uint32_t bytesRead = kIcoDirectoryBytes + numImages * kIcoDirEntryBytes;
SkAutoTDelete<SkTArray<SkAutoTDelete<SkCodec>, true>> codecs(
- SkNEW_ARGS((SkTArray<SkAutoTDelete<SkCodec>, true>), (numImages)));
+ new (SkTArray<SkAutoTDelete<SkCodec>, true>)(numImages));
for (uint32_t i = 0; i < numImages; i++) {
uint32_t offset = directoryEntries.get()[i].offset;
uint32_t size = directoryEntries.get()[i].size;
@@ -137,8 +135,7 @@
SkCodecPrintf("Warning: could not create embedded stream.\n");
break;
}
- SkAutoTDelete<SkMemoryStream>
- embeddedStream(SkNEW_ARGS(SkMemoryStream, (data.get())));
+ SkAutoTDelete<SkMemoryStream> embeddedStream(new SkMemoryStream(data.get()));
bytesRead += size;
// Check if the embedded codec is bmp or png and create the codec
@@ -189,7 +186,7 @@
// Note that stream is owned by the embedded codec, the ico does not need
// direct access to the stream.
- return SkNEW_ARGS(SkIcoCodec, (info, codecs.detach()));
+ return new SkIcoCodec(info, codecs.detach());
}
/*
diff --git a/src/codec/SkCodec_libpng.cpp b/src/codec/SkCodec_libpng.cpp
index 2fa3e68..31a4d2e 100644
--- a/src/codec/SkCodec_libpng.cpp
+++ b/src/codec/SkCodec_libpng.cpp
@@ -189,7 +189,7 @@
*ctableCount = colorCount;
}
- fColorTable.reset(SkNEW_ARGS(SkColorTable, (colorStorage, colorCount)));
+ fColorTable.reset(new SkColorTable(colorStorage, colorCount));
return true;
}
@@ -356,8 +356,7 @@
SkImageInfo imageInfo;
int bitDepth;
if (read_header(stream, &png_ptr, &info_ptr, &imageInfo, &bitDepth)) {
- return SkNEW_ARGS(SkPngCodec, (imageInfo, streamDeleter.detach(),
- png_ptr, info_ptr, bitDepth));
+ return new SkPngCodec(imageInfo, streamDeleter.detach(), png_ptr, info_ptr, bitDepth);
}
return NULL;
}
@@ -781,9 +780,9 @@
const SkImageInfo& srcInfo = codec->getInfo();
if (codec->fNumberPasses > 1) {
// interlaced image
- return SkNEW_ARGS(SkPngInterlacedScanlineDecoder, (srcInfo, codec.detach()));
+ return new SkPngInterlacedScanlineDecoder(srcInfo, codec.detach());
}
- return SkNEW_ARGS(SkPngScanlineDecoder, (srcInfo, codec.detach()));
+ return new SkPngScanlineDecoder(srcInfo, codec.detach());
}
diff --git a/src/codec/SkCodec_wbmp.cpp b/src/codec/SkCodec_wbmp.cpp
index 9e38155..16cdbea 100644
--- a/src/codec/SkCodec_wbmp.cpp
+++ b/src/codec/SkCodec_wbmp.cpp
@@ -160,7 +160,7 @@
}
SkImageInfo info = SkImageInfo::Make(size.width(), size.height(),
kGray_8_SkColorType, kOpaque_SkAlphaType);
- return SkNEW_ARGS(SkWbmpCodec, (info, streamDeleter.detach()));
+ return new SkWbmpCodec(info, streamDeleter.detach());
}
class SkWbmpScanlineDecoder : public SkScanlineDecoder {
@@ -214,7 +214,7 @@
// Copy the color table to a pointer that can be owned by the scanline decoder
if (kIndex_8_SkColorType == dstInfo.colorType()) {
- fColorTable.reset(SkNEW_ARGS(SkColorTable, (inputColorTable, 2)));
+ fColorTable.reset(new SkColorTable(inputColorTable, 2));
}
// Initialize the swizzler
@@ -248,5 +248,5 @@
}
// Return the new scanline decoder
- return SkNEW_ARGS(SkWbmpScanlineDecoder, (codec.detach()));
+ return new SkWbmpScanlineDecoder(codec.detach());
}
diff --git a/src/codec/SkJpegCodec.cpp b/src/codec/SkJpegCodec.cpp
index c094d50..4988dca 100644
--- a/src/codec/SkJpegCodec.cpp
+++ b/src/codec/SkJpegCodec.cpp
@@ -101,7 +101,7 @@
JpegDecoderMgr** decoderMgrOut) {
// Create a JpegDecoderMgr to own all of the decompress information
- SkAutoTDelete<JpegDecoderMgr> decoderMgr(SkNEW_ARGS(JpegDecoderMgr, (stream)));
+ SkAutoTDelete<JpegDecoderMgr> decoderMgr(new JpegDecoderMgr(stream));
// libjpeg errors will be caught and reported here
if (setjmp(decoderMgr->getJmpBuf())) {
@@ -123,7 +123,7 @@
// Create image info object and the codec
const SkImageInfo& imageInfo = SkImageInfo::Make(decoderMgr->dinfo()->image_width,
decoderMgr->dinfo()->image_height, colorType, kOpaque_SkAlphaType);
- *codecOut = SkNEW_ARGS(SkJpegCodec, (imageInfo, stream, decoderMgr.detach()));
+ *codecOut = new SkJpegCodec(imageInfo, stream, decoderMgr.detach());
} else {
SkASSERT(NULL != decoderMgrOut);
*decoderMgrOut = decoderMgr.detach();
@@ -586,5 +586,5 @@
const SkImageInfo& srcInfo = codec->getInfo();
// Return the new scanline decoder
- return SkNEW_ARGS(SkJpegScanlineDecoder, (srcInfo, codec.detach()));
+ return new SkJpegScanlineDecoder(srcInfo, codec.detach());
}
diff --git a/src/codec/SkMaskSwizzler.cpp b/src/codec/SkMaskSwizzler.cpp
index 31fd2cf..95f3627 100644
--- a/src/codec/SkMaskSwizzler.cpp
+++ b/src/codec/SkMaskSwizzler.cpp
@@ -321,7 +321,7 @@
SkASSERT(false);
return NULL;
}
- return SkNEW_ARGS(SkMaskSwizzler, (info, masks, proc));
+ return new SkMaskSwizzler(info, masks, proc);
}
/*
diff --git a/src/codec/SkMasks.cpp b/src/codec/SkMasks.cpp
index 4b32c61..b136c59 100644
--- a/src/codec/SkMasks.cpp
+++ b/src/codec/SkMasks.cpp
@@ -148,7 +148,7 @@
const MaskInfo blue = process_mask(masks.blue, bitsPerPixel);
const MaskInfo alpha = process_mask(masks.alpha, bitsPerPixel);
- return SkNEW_ARGS(SkMasks, (red, green, blue, alpha));
+ return new SkMasks(red, green, blue, alpha);
}
diff --git a/src/codec/SkScaledCodec.cpp b/src/codec/SkScaledCodec.cpp
index 0f0d129..bf09b4b 100644
--- a/src/codec/SkScaledCodec.cpp
+++ b/src/codec/SkScaledCodec.cpp
@@ -27,14 +27,14 @@
}
// wrap in new SkScaledCodec
- return SkNEW_ARGS(SkScaledCodec, (scanlineDecoder.detach()));
+ return new SkScaledCodec(scanlineDecoder.detach());
}
SkCodec* SkScaledCodec::NewFromData(SkData* data) {
if (!data) {
return NULL;
}
- return NewFromStream(SkNEW_ARGS(SkMemoryStream, (data)));
+ return NewFromStream(new SkMemoryStream(data));
}
SkScaledCodec::SkScaledCodec(SkScanlineDecoder* scanlineDecoder)
diff --git a/src/codec/SkScanlineDecoder.cpp b/src/codec/SkScanlineDecoder.cpp
index 851e7e7..5c94a6d 100644
--- a/src/codec/SkScanlineDecoder.cpp
+++ b/src/codec/SkScanlineDecoder.cpp
@@ -62,7 +62,7 @@
if (!data) {
return NULL;
}
- return NewFromStream(SkNEW_ARGS(SkMemoryStream, (data)));
+ return NewFromStream(new SkMemoryStream(data));
}
diff --git a/src/codec/SkSwizzler.cpp b/src/codec/SkSwizzler.cpp
index 8315cc7..db49fb1 100644
--- a/src/codec/SkSwizzler.cpp
+++ b/src/codec/SkSwizzler.cpp
@@ -689,8 +689,8 @@
// get sampleX based on srcInfo and dstInfo dimensions
int sampleX;
SkScaledCodec::ComputeSampleSize(dstInfo, srcInfo, &sampleX, NULL);
-
- return SkNEW_ARGS(SkSwizzler, (proc, ctable, deltaSrc, dstInfo, sampleX));
+
+ return new SkSwizzler(proc, ctable, deltaSrc, dstInfo, sampleX);
}
SkSwizzler::SkSwizzler(RowProc proc, const SkPMColor* ctable,
diff --git a/src/codec/SkWebpCodec.cpp b/src/codec/SkWebpCodec.cpp
index 1f69b4f..e17aa7e 100644
--- a/src/codec/SkWebpCodec.cpp
+++ b/src/codec/SkWebpCodec.cpp
@@ -77,7 +77,7 @@
SkAutoTDelete<SkStream> streamDeleter(stream);
SkImageInfo info;
if (webp_parse_header(stream, &info)) {
- return SkNEW_ARGS(SkWebpCodec, (info, streamDeleter.detach()));
+ return new SkWebpCodec(info, streamDeleter.detach());
}
return NULL;
}
diff --git a/src/core/SkBBHFactory.cpp b/src/core/SkBBHFactory.cpp
index a4c7f4f..e8534ca 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 bbe9882..f7d6bd4 100644
--- a/src/core/SkBigPicture.cpp
+++ b/src/core/SkBigPicture.cpp
@@ -57,7 +57,7 @@
}
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 97b0db6..03d1f42 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -1145,7 +1145,7 @@
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 08e3fdc..66075d4 100644
--- a/src/core/SkBitmapCache.cpp
+++ b/src/core/SkBitmapCache.cpp
@@ -115,8 +115,8 @@
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 @@
|| 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 @@
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 @@
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 dfe1756..d4445fa 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -103,7 +103,7 @@
}
}
- 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 8c44e9f..4c1e9c6 100644
--- a/src/core/SkBitmapFilter.cpp
+++ b/src/core/SkBitmapFilter.cpp
@@ -20,17 +20,17 @@
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 e1d3cae..5b16d21 100644
--- a/src/core/SkBitmapHeap.cpp
+++ b/src/core/SkBitmapHeap.cpp
@@ -227,7 +227,7 @@
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 @@
// 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 @@
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 @@
// 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 678a201..ef9cfd4 100644
--- a/src/core/SkBitmapProcShader.cpp
+++ b/src/core/SkBitmapProcShader.cpp
@@ -79,7 +79,7 @@
}
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 @@
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 @@
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 6e25302..be79857 100644
--- a/src/core/SkBitmapScaler.cpp
+++ b/src/core/SkBitmapScaler.cpp
@@ -25,9 +25,7 @@
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 @@
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 a932ba9..62cd73e 100644
--- a/src/core/SkBlitter.cpp
+++ b/src/core/SkBlitter.cpp
@@ -597,7 +597,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 16c4eea..439c2ff 100644
--- a/src/core/SkCachedData.cpp
+++ b/src/core/SkCachedData.cpp
@@ -57,7 +57,7 @@
sk_free(fStorage.fMalloc);
break;
case kDiscardableMemory_StorageType:
- SkDELETE(fStorage.fDM);
+ delete fStorage.fDM;
break;
}
dec();
@@ -88,7 +88,7 @@
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 daf8425..03c5173 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -203,7 +203,7 @@
device->onAttachToCanvas(canvas);
}
fDevice = device;
- fPaint = paint ? SkNEW_ARGS(SkPaint, (*paint)) : NULL;
+ fPaint = paint ? new SkPaint(*paint) : NULL;
}
~DeviceCM() {
@@ -211,7 +211,7 @@
fDevice->onDetachFromCanvas();
fDevice->unref();
}
- SkDELETE(fPaint);
+ delete fPaint;
}
void reset(const SkIRect& bounds) {
@@ -304,7 +304,7 @@
}
~MCRec() {
SkSafeUnref(fFilter);
- SkDELETE(fLayer);
+ delete fLayer;
dec_rec();
}
@@ -604,7 +604,7 @@
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 @@
{
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 @@
{
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 @@
{
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 @@
{
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 @@
this->internalRestore(); // restore the last, since we're going away
- SkDELETE(fMetaData);
+ delete fMetaData;
dec_canvas();
}
@@ -1135,8 +1135,8 @@
}
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 @@
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 @@
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 c359e87..9541cc6 100644
--- a/src/core/SkClipStack.cpp
+++ b/src/core/SkClipStack.cpp
@@ -711,7 +711,7 @@
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 9cbcc64..e1670b8 100644
--- a/src/core/SkColorFilter.cpp
+++ b/src/core/SkColorFilter.cpp
@@ -132,7 +132,7 @@
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 c16d7ff..094dfdb 100644
--- a/src/core/SkComposeShader.cpp
+++ b/src/core/SkComposeShader.cpp
@@ -60,7 +60,7 @@
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 @@
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 e2644a0..20bc430 100644
--- a/src/core/SkDataTable.cpp
+++ b/src/core/SkDataTable.cpp
@@ -79,7 +79,7 @@
SkDataTable* SkDataTable::NewEmpty() {
static SkDataTable* gEmpty;
if (NULL == gEmpty) {
- gEmpty = SkNEW(SkDataTable);
+ gEmpty = new SkDataTable;
}
gEmpty->ref();
return gEmpty;
@@ -108,7 +108,7 @@
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 @@
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 @@
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 @@
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 @@
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 b2cc0dd..f8275fa 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -30,9 +30,7 @@
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 188e12b..11d5c85 100644
--- a/src/core/SkDeviceProfile.cpp
+++ b/src/core/SkDeviceProfile.cpp
@@ -41,7 +41,7 @@
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 2bd9abb..6464d4a 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -1919,7 +1919,7 @@
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 @@
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 9e8ff2d..23db8ac 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 a10a7c9..d972489 100644
--- a/src/core/SkFilterShader.cpp
+++ b/src/core/SkFilterShader.cpp
@@ -32,7 +32,7 @@
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 @@
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 dcc2f0b..d6895a4 100644
--- a/src/core/SkFont.cpp
+++ b/src/core/SkFont.cpp
@@ -40,7 +40,7 @@
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 cb149b9..8348d5f 100644
--- a/src/core/SkFontDescriptor.cpp
+++ b/src/core/SkFontDescriptor.cpp
@@ -98,8 +98,7 @@
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 33da1db..35ad6c3 100644
--- a/src/core/SkFontMgr.cpp
+++ b/src/core/SkFontMgr.cpp
@@ -29,9 +29,7 @@
}
};
-SkFontStyleSet* SkFontStyleSet::CreateEmpty() {
- return SkNEW(SkEmptyFontStyleSet);
-}
+SkFontStyleSet* SkFontStyleSet::CreateEmpty() { return new SkEmptyFontStyleSet; }
///////////////////////////////////////////////////////////////////////////////
@@ -70,7 +68,7 @@
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 @@
// 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
old mode 100755
new mode 100644
index e719c00..ff52004
--- 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() {
- 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 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 @@
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 @@
while (rec) {
rec->fProc(rec->fData);
AuxProcRec* next = rec->fNext;
- SkDELETE(rec);
+ delete rec;
rec = next;
}
}
@@ -387,7 +381,7 @@
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 @@
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 8e0ceb5..70d8020 100644
--- a/src/core/SkGlyphCache_Globals.h
+++ b/src/core/SkGlyphCache_Globals.h
@@ -37,7 +37,7 @@
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 863cc11..a65e8fc 100644
--- a/src/core/SkImageCacherator.cpp
+++ b/src/core/SkImageCacherator.cpp
@@ -45,10 +45,8 @@
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 @@
, 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 5157db2..0a46cb3 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -204,7 +204,7 @@
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 @@
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 @@
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 @@
} // 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 e55f43d..5d018bc 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 54c4f7b..5d598ef 100644
--- a/src/core/SkLayerInfo.h
+++ b/src/core/SkLayerInfo.h
@@ -19,7 +19,11 @@
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 3b2e062..0e20db4 100644
--- a/src/core/SkLightingShader.cpp
+++ b/src/core/SkLightingShader.cpp
@@ -291,7 +291,7 @@
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 @@
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 @@
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 @@
}
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 @@
}
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 @@
return NULL;
}
- return SkNEW_PLACEMENT_ARGS(storage, LightingShaderContext, (*this, rec,
- diffuseState, normalState));
+ return new (storage) LightingShaderContext(*this, rec, diffuseState, normalState);
}
///////////////////////////////////////////////////////////////////////////////
@@ -725,8 +721,8 @@
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 499e358..d286487 100644
--- a/src/core/SkLightingShader.h
+++ b/src/core/SkLightingShader.h
@@ -25,11 +25,10 @@
class Builder {
public:
Builder(const SkLight lights[], int numLights)
- : fLights(SkNEW_ARGS(Lights, (lights, numLights))) {
- }
+ : fLights(new Lights(lights, numLights)) {}
- Builder() : fLights(SkNEW(Lights)) { }
-
+ Builder() : fLights(new 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 544ad2f..b9a0960 100644
--- a/src/core/SkLocalMatrixShader.cpp
+++ b/src/core/SkLocalMatrixShader.cpp
@@ -66,5 +66,5 @@
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 12aa1f6..4916510 100644
--- a/src/core/SkMallocPixelRef.cpp
+++ b/src/core/SkMallocPixelRef.cpp
@@ -44,8 +44,7 @@
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 @@
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 @@
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 @@
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 7dc4e4e..cc729c3 100644
--- a/src/core/SkMaskCache.cpp
+++ b/src/core/SkMaskCache.cpp
@@ -91,7 +91,7 @@
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 @@
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 a61867e..b6f6fc8 100644
--- a/src/core/SkMatrixImageFilter.cpp
+++ b/src/core/SkMatrixImageFilter.cpp
@@ -26,7 +26,7 @@
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 df40fa4..5161c64 100644
--- a/src/core/SkMiniRecorder.cpp
+++ b/src/core/SkMiniRecorder.cpp
@@ -62,7 +62,7 @@
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 @@
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 032a60d..8a62f88 100644
--- a/src/core/SkMipMap.cpp
+++ b/src/core/SkMipMap.cpp
@@ -250,9 +250,9 @@
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 286d3b6..8cbb9ca 100644
--- a/src/core/SkMultiPictureDraw.cpp
+++ b/src/core/SkMultiPictureDraw.cpp
@@ -35,7 +35,7 @@
fMatrix.setIdentity();
}
if (paint) {
- fPaint = SkNEW_ARGS(SkPaint, (*paint));
+ fPaint = new SkPaint(*paint);
} else {
fPaint = NULL;
}
@@ -45,7 +45,7 @@
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 4400994..7fd0b9d 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -1511,13 +1511,13 @@
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 38b4e71..e3317a6 100644
--- a/src/core/SkPathRef.cpp
+++ b/src/core/SkPathRef.cpp
@@ -18,7 +18,7 @@
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 @@
// 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 @@
}
if (!(*dst)->unique()) {
- dst->reset(SkNEW(SkPathRef));
+ dst->reset(new SkPathRef);
}
if (*dst != &src) {
@@ -123,13 +123,13 @@
}
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 @@
!buffer->readS32(&verbCount) ||
!buffer->readS32(&pointCount) ||
!buffer->readS32(&conicCount)) {
- SkDELETE(ref);
+ delete ref;
return NULL;
}
@@ -155,7 +155,7 @@
!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 @@
} 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 @@
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 26ec761..8247336 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -169,7 +169,7 @@
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 6ae03a3..e70cd66 100644
--- a/src/core/SkPictureData.cpp
+++ b/src/core/SkPictureData.cpp
@@ -52,7 +52,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
} 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 @@
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 @@
(*array)[j]->unref();
}
// Delete the array
- SkDELETE_ARRAY(*array);
+ delete[] * array;
*array = NULL;
*outCount = 0;
return false;
@@ -565,7 +565,7 @@
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::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 7b2e67f..3556004 100644
--- a/src/core/SkPictureFlat.cpp
+++ b/src/core/SkPictureFlat.cpp
@@ -29,11 +29,11 @@
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 @@
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 64e51b7..176f486 100644
--- a/src/core/SkPictureFlat.h
+++ b/src/core/SkPictureFlat.h
@@ -135,13 +135,9 @@
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 acff84c..13d3cc8 100644
--- a/src/core/SkPictureImageGenerator.cpp
+++ b/src/core/SkPictureImageGenerator.cpp
@@ -41,7 +41,7 @@
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 0c50dd9..8612aa7 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 @@
}
if (!fRecord) {
- fRecord.reset(SkNEW(SkRecord));
+ fRecord.reset(new SkRecord);
}
SkRecorder::DrawPictureMode dpm = (recordFlags & kPlaybackDrawPicture_RecordFlag)
? SkRecorder::Playback_DrawPictureMode
@@ -64,7 +64,7 @@
SkAutoTUnref<SkLayerInfo> saveLayerData;
if (fBBH && (fFlags & kComputeSaveLayerInfo_RecordFlag)) {
- saveLayerData.reset(SkNEW(SkLayerInfo));
+ saveLayerData.reset(new SkLayerInfo);
}
SkDrawableList* drawableList = fRecorder->getDrawableList();
@@ -87,12 +87,8 @@
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 @@
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 @@
}
// 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 @@
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 b843339..569ef3d 100644
--- a/src/core/SkPictureShader.cpp
+++ b/src/core/SkPictureShader.cpp
@@ -124,7 +124,7 @@
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 @@
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::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 47f958d..7bcaffe 100644
--- a/src/core/SkPixelRef.cpp
+++ b/src/core/SkPixelRef.cpp
@@ -243,7 +243,7 @@
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 6669471..7c77513 100644
--- a/src/core/SkRWBuffer.cpp
+++ b/src/core/SkRWBuffer.cpp
@@ -229,9 +229,7 @@
}
#endif
-SkROBuffer* SkRWBuffer::newRBufferSnapshot() const {
- return SkNEW_ARGS(SkROBuffer, (fHead, fTotalUsed));
-}
+SkROBuffer* SkRWBuffer::newRBufferSnapshot() const { return new SkROBuffer(fHead, fTotalUsed); }
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -305,9 +303,7 @@
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 @@
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 890a0bf..fe8f5f4 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -687,7 +687,7 @@
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 @@
// 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 @@
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 @@
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 b12b1eb..0fe9e28 100644
--- a/src/core/SkRecorder.cpp
+++ b/src/core/SkRecorder.cpp
@@ -27,7 +27,7 @@
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 @@
}
// 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 @@
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* 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::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 922fc7e..911a090 100644
--- a/src/core/SkResourceCache.cpp
+++ b/src/core/SkResourceCache.cpp
@@ -105,9 +105,7 @@
fFirstTime = true;
}
-SkOneShotDiscardablePixelRef::~SkOneShotDiscardablePixelRef() {
- SkDELETE(fDM);
-}
+SkOneShotDiscardablePixelRef::~SkOneShotDiscardablePixelRef() { delete fDM; }
bool SkOneShotDiscardablePixelRef::onNewLockPixels(LockRec* rec) {
if (fFirstTime) {
@@ -176,8 +174,7 @@
}
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 @@
this->init();
fDiscardableFactory = factory;
- fAllocator = SkNEW_ARGS(SkResourceCacheDiscardableAllocator, (factory));
+ fAllocator = new SkResourceCacheDiscardableAllocator(factory);
}
SkResourceCache::SkResourceCache(size_t byteLimit) {
@@ -200,7 +197,7 @@
Rec* rec = fHead;
while (rec) {
Rec* next = rec->fNext;
- SkDELETE(rec);
+ delete rec;
rec = next;
}
delete fHash;
@@ -243,7 +240,7 @@
// 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 @@
bytesStr.c_str(), rec, rec->getHash(), totalStr.c_str(), fCount);
}
- SkDELETE(rec);
+ delete rec;
}
void SkResourceCache::purgeAsNeeded(bool forcePurge) {
@@ -374,9 +371,9 @@
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 @@
// 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 @@
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 b765aad..5f0f653 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -870,8 +870,7 @@
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 ac62930..29d0e01 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 41724d9..6da73fc 100644
--- a/src/core/SkShader.cpp
+++ b/src/core/SkShader.cpp
@@ -224,13 +224,9 @@
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 @@
}
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 @@
}
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 018705f..a2c132a 100644
--- a/src/core/SkSmallAllocator.h
+++ b/src/core/SkSmallAllocator.h
@@ -63,7 +63,7 @@
if (NULL == buf) {
return NULL;
}
- SkNEW_PLACEMENT(buf, T);
+ new (buf) T;
return static_cast<T*>(buf);
}
@@ -72,7 +72,7 @@
if (NULL == buf) {
return NULL;
}
- SkNEW_PLACEMENT_ARGS(buf, T, (a1));
+ new (buf) T(a1);
return static_cast<T*>(buf);
}
@@ -82,7 +82,7 @@
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 @@
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 @@
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 f32f68a..8b2e8ab 100644
--- a/src/core/SkStream.cpp
+++ b/src/core/SkStream.cpp
@@ -390,9 +390,7 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 3543529..3a91efe 100644
--- a/src/core/SkTLList.h
+++ b/src/core/SkTLList.h
@@ -70,7 +70,7 @@
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 @@
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 @@
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 @@
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 @@
/** 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 @@
} 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 346fed8..b22446b 100755
--- a/src/core/SkTLS.cpp
+++ b/src/core/SkTLS.cpp
@@ -50,7 +50,7 @@
SkTLSRec* rec = (SkTLSRec*)ptr;
do {
SkTLSRec* next = rec->fNext;
- SkDELETE(rec);
+ delete rec;
rec = next;
} while (rec);
}
@@ -121,7 +121,7 @@
// 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 1168ed6..5f8589d 100644
--- a/src/core/SkTMultiMap.h
+++ b/src/core/SkTMultiMap.h
@@ -40,14 +40,14 @@
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 @@
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 e809f57..9462903 100644
--- a/src/core/SkTaskGroup.cpp
+++ b/src/core/SkTaskGroup.cpp
@@ -111,7 +111,7 @@
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 @@
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 c94e22f..7da1118 100644
--- a/src/core/SkTypeface.cpp
+++ b/src/core/SkTypeface.cpp
@@ -27,9 +27,7 @@
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 @@
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 @@
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 c9a8122..17ce215 100644
--- a/src/core/SkXfermode.cpp
+++ b/src/core/SkXfermode.cpp
@@ -1006,7 +1006,7 @@
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 b113c07..f013599 100644
--- a/src/core/SkYUVPlanesCache.cpp
+++ b/src/core/SkYUVPlanesCache.cpp
@@ -85,5 +85,5 @@
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));
}
diff --git a/src/doc/SkDocument_PDF.cpp b/src/doc/SkDocument_PDF.cpp
index c1d5f0f..1741239 100644
--- a/src/doc/SkDocument_PDF.cpp
+++ b/src/doc/SkDocument_PDF.cpp
@@ -63,11 +63,11 @@
static SkPDFObject* create_pdf_page_content(const SkPDFDevice* pageDevice) {
SkAutoTDelete<SkStreamAsset> content(pageDevice->content());
- return SkNEW_ARGS(SkPDFStream, (content.get()));
+ return new SkPDFStream(content.get());
}
static SkPDFDict* create_pdf_page(const SkPDFDevice* pageDevice) {
- SkAutoTUnref<SkPDFDict> page(SkNEW_ARGS(SkPDFDict, ("Page")));
+ SkAutoTUnref<SkPDFDict> page(new SkPDFDict("Page"));
page->insertObject("Resources", pageDevice->createResourceDict());
page->insertObject("MediaBox", pageDevice->copyMediaBox());
if (SkPDFArray* annots = pageDevice->getAnnotations()) {
@@ -162,7 +162,7 @@
}
SkTDArray<SkPDFDict*> pages;
- SkAutoTUnref<SkPDFDict> dests(SkNEW(SkPDFDict));
+ SkAutoTUnref<SkPDFDict> dests(new SkPDFDict);
for (int i = 0; i < pageDevices.count(); i++) {
SkASSERT(pageDevices[i]);
@@ -174,7 +174,7 @@
}
SkTDArray<SkPDFDict*> pageTree;
- SkAutoTUnref<SkPDFDict> docCatalog(SkNEW_ARGS(SkPDFDict, ("Catalog")));
+ SkAutoTUnref<SkPDFDict> docCatalog(new SkPDFDict("Catalog"));
SkPDFDict* pageTreeRoot;
generate_page_tree(pages, &pageTree, &pageTreeRoot);
@@ -308,7 +308,7 @@
SkScalarRoundToInt(width), SkScalarRoundToInt(height));
SkAutoTUnref<SkPDFDevice> device(
SkPDFDevice::Create(pageSize, fRasterDpi, &fCanon));
- fCanvas.reset(SkNEW_ARGS(SkCanvas, (device.get())));
+ fCanvas.reset(new SkCanvas(device.get()));
fPageDevices.push(device.detach());
fCanvas->clipRect(trimBox);
fCanvas->translate(trimBox.x(), trimBox.y());
@@ -345,15 +345,15 @@
///////////////////////////////////////////////////////////////////////////////
SkDocument* SkDocument::CreatePDF(SkWStream* stream, SkScalar dpi) {
- return stream ? SkNEW_ARGS(SkDocument_PDF, (stream, NULL, dpi)) : NULL;
+ return stream ? new SkDocument_PDF(stream, NULL, dpi) : NULL;
}
SkDocument* SkDocument::CreatePDF(const char path[], SkScalar dpi) {
- SkFILEWStream* stream = SkNEW_ARGS(SkFILEWStream, (path));
+ SkFILEWStream* stream = new SkFILEWStream(path);
if (!stream->isValid()) {
- SkDELETE(stream);
+ delete stream;
return NULL;
}
- auto delete_wstream = [](SkWStream* stream, bool) { SkDELETE(stream); };
- return SkNEW_ARGS(SkDocument_PDF, (stream, delete_wstream, dpi));
+ auto delete_wstream = [](SkWStream* stream, bool) { delete stream; };
+ return new SkDocument_PDF(stream, delete_wstream, dpi);
}
diff --git a/src/doc/SkDocument_XPS.cpp b/src/doc/SkDocument_XPS.cpp
index 884d9a5..943d0a8 100644
--- a/src/doc/SkDocument_XPS.cpp
+++ b/src/doc/SkDocument_XPS.cpp
@@ -33,7 +33,7 @@
const SkRect& trimBox) override {
fDevice.beginSheet(fUnitsPerMeter, fPixelsPerMeter,
SkSize::Make(width, height));
- fCanvas.reset(SkNEW_ARGS(SkCanvas, (&fDevice)));
+ fCanvas.reset(new SkCanvas(&fDevice));
fCanvas->clipRect(trimBox);
fCanvas->translate(trimBox.x(), trimBox.y());
return fCanvas.get();
@@ -63,17 +63,15 @@
///////////////////////////////////////////////////////////////////////////////
SkDocument* SkDocument::CreateXPS(SkWStream* stream, SkScalar dpi) {
- return stream ? SkNEW_ARGS(SkDocument_XPS, (stream, NULL, dpi)) : NULL;
+ return stream ? new SkDocument_XPS(stream, NULL, dpi) : NULL;
}
-static void delete_wstream(SkWStream* stream, bool aborted) {
- SkDELETE(stream);
-}
+static void delete_wstream(SkWStream* stream, bool aborted) { delete stream; }
SkDocument* SkDocument::CreateXPS(const char path[], SkScalar dpi) {
- SkAutoTDelete<SkFILEWStream> stream(SkNEW_ARGS(SkFILEWStream, (path)));
+ SkAutoTDelete<SkFILEWStream> stream(new SkFILEWStream(path));
if (!stream->isValid()) {
return NULL;
}
- return SkNEW_ARGS(SkDocument_XPS, (stream.detach(), delete_wstream, dpi));
+ return new SkDocument_XPS(stream.detach(), delete_wstream, dpi);
}
diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp
index e55376d..f6d1461 100644
--- a/src/effects/SkAlphaThresholdFilter.cpp
+++ b/src/effects/SkAlphaThresholdFilter.cpp
@@ -43,7 +43,7 @@
SkScalar innerThreshold,
SkScalar outerThreshold,
SkImageFilter* input) {
- return SkNEW_ARGS(SkAlphaThresholdFilterImpl, (region, innerThreshold, outerThreshold, input));
+ return new SkAlphaThresholdFilterImpl(region, innerThreshold, outerThreshold, input);
}
#if SK_SUPPORT_GPU
@@ -67,11 +67,8 @@
GrTexture* maskTexture,
float innerThreshold,
float outerThreshold) {
- return SkNEW_ARGS(AlphaThresholdEffect, (procDataManager,
- texture,
- maskTexture,
- innerThreshold,
- outerThreshold));
+ return new AlphaThresholdEffect(procDataManager, texture, maskTexture, innerThreshold,
+ outerThreshold);
}
virtual ~AlphaThresholdEffect() {};
@@ -215,7 +212,7 @@
}
GrGLFragmentProcessor* AlphaThresholdEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GrGLAlphaThresholdEffect, (*this));
+ return new GrGLAlphaThresholdEffect(*this);
}
bool AlphaThresholdEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
diff --git a/src/effects/SkArithmeticMode.cpp b/src/effects/SkArithmeticMode.cpp
index bd5bf46..b8959dd 100644
--- a/src/effects/SkArithmeticMode.cpp
+++ b/src/effects/SkArithmeticMode.cpp
@@ -21,7 +21,7 @@
public:
static SkArithmeticMode_scalar* Create(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4,
bool enforcePMColor) {
- return SkNEW_ARGS(SkArithmeticMode_scalar, (k1, k2, k3, k4, enforcePMColor));
+ return new SkArithmeticMode_scalar(k1, k2, k3, k4, enforcePMColor);
}
virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count,
@@ -217,15 +217,15 @@
int32_t i3 = toDot8(k3);
int32_t i4 = toDot8(k4);
if (i1) {
- return SkNEW_ARGS(SkArithmeticMode_quad, (i1, i2, i3, i4));
+ return new SkArithmeticMode_quad (i1, i2, i3, i4);
}
if (0 == i2) {
- return SkNEW_ARGS(SkArithmeticMode_dst, (i3, i4));
+ return new SkArithmeticMode_dst (i3, i4);
}
if (0 == i3) {
- return SkNEW_ARGS(SkArithmeticMode_src, (i2, i4));
+ return new SkArithmeticMode_src (i2, i4);
}
- return SkNEW_ARGS(SkArithmeticMode_linear, (i2, i3, i4));
+ return new SkArithmeticMode_linear (i2, i3, i4);
#endif
}
return SkArithmeticMode_scalar::Create(k1, k2, k3, k4, enforcePMColor);
diff --git a/src/effects/SkArithmeticMode_gpu.cpp b/src/effects/SkArithmeticMode_gpu.cpp
index 39814e2..279e36d 100644
--- a/src/effects/SkArithmeticMode_gpu.cpp
+++ b/src/effects/SkArithmeticMode_gpu.cpp
@@ -118,7 +118,7 @@
}
GrGLFragmentProcessor* GrArithmeticFP::onCreateGLInstance() const {
- return SkNEW_ARGS(GLArithmeticFP, (*this));
+ return new GLArithmeticFP(*this);
}
bool GrArithmeticFP::onIsEqual(const GrFragmentProcessor& fpBase) const {
@@ -144,8 +144,7 @@
float k4 = d->fRandom->nextF();
bool enforcePMColor = d->fRandom->nextBool();
- return SkNEW_ARGS(GrArithmeticFP, (d->fProcDataManager, k1, k2, k3, k4, enforcePMColor,
- d->fTextures[0]));
+ return new GrArithmeticFP(d->fProcDataManager, k1, k2, k3, k4, enforcePMColor, d->fTextures[0]);
}
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrArithmeticFP);
@@ -256,9 +255,7 @@
GLArithmeticXP::GenKey(*this, caps, b);
}
-GrGLXferProcessor* ArithmeticXP::createGLInstance() const {
- return SkNEW_ARGS(GLArithmeticXP, (*this));
-}
+GrGLXferProcessor* ArithmeticXP::createGLInstance() const { return new GLArithmeticXP(*this); }
GrXferProcessor::OptFlags ArithmeticXP::onGetOptimizations(const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
@@ -282,8 +279,7 @@
const GrProcOptInfo& coveragePOI,
bool hasMixedSamples,
const DstTexture* dstTexture) const {
- return SkNEW_ARGS(ArithmeticXP, (dstTexture, hasMixedSamples, fK1, fK2, fK3, fK4,
- fEnforcePMColor));
+ return new ArithmeticXP(dstTexture, hasMixedSamples, fK1, fK2, fK3, fK4, fEnforcePMColor);
}
diff --git a/src/effects/SkArithmeticMode_gpu.h b/src/effects/SkArithmeticMode_gpu.h
index 4f780cf..7b343ee 100644
--- a/src/effects/SkArithmeticMode_gpu.h
+++ b/src/effects/SkArithmeticMode_gpu.h
@@ -34,8 +34,7 @@
static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager, float k1, float k2,
float k3, float k4, bool enforcePMColor,
GrTexture* background) {
- return SkNEW_ARGS(GrArithmeticFP, (procDataManager, k1, k2, k3, k4, enforcePMColor,
- background));
+ return new GrArithmeticFP(procDataManager, k1, k2, k3, k4, enforcePMColor, background);
}
~GrArithmeticFP() override {};
@@ -76,7 +75,7 @@
class GrArithmeticXPFactory : public GrXPFactory {
public:
static GrXPFactory* Create(float k1, float k2, float k3, float k4, bool enforcePMColor) {
- return SkNEW_ARGS(GrArithmeticXPFactory, (k1, k2, k3, k4, enforcePMColor));
+ return new GrArithmeticXPFactory(k1, k2, k3, k4, enforcePMColor);
}
bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const override {
diff --git a/src/effects/SkBlurDrawLooper.cpp b/src/effects/SkBlurDrawLooper.cpp
index b3094d6..ceb210d 100644
--- a/src/effects/SkBlurDrawLooper.cpp
+++ b/src/effects/SkBlurDrawLooper.cpp
@@ -103,7 +103,7 @@
////////////////////////////////////////////////////////////////////////////////////////
SkDrawLooper::Context* SkBlurDrawLooper::createContext(SkCanvas*, void* storage) const {
- return SkNEW_PLACEMENT_ARGS(storage, BlurDrawLooperContext, (this));
+ return new (storage) BlurDrawLooperContext(this);
}
SkBlurDrawLooper::BlurDrawLooperContext::BlurDrawLooperContext(
diff --git a/src/effects/SkBlurMask.cpp b/src/effects/SkBlurMask.cpp
index bf50845..4d366fe 100644
--- a/src/effects/SkBlurMask.cpp
+++ b/src/effects/SkBlurMask.cpp
@@ -682,7 +682,7 @@
int size = SkScalarCeilToInt(6*sigma);
int center = size >> 1;
- uint8_t *profile = SkNEW_ARRAY(uint8_t, size);
+ uint8_t* profile = new uint8_t[size];
float invr = 1.f/(2*sigma);
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp
index 96789c2..852d29b 100644
--- a/src/effects/SkBlurMaskFilter.cpp
+++ b/src/effects/SkBlurMaskFilter.cpp
@@ -133,7 +133,7 @@
if (flags > SkBlurMaskFilter::kAll_BlurFlag) {
return NULL;
}
- return SkNEW_ARGS(SkBlurMaskFilterImpl, (sigma, style, flags));
+ return new SkBlurMaskFilterImpl(sigma, style, flags);
}
///////////////////////////////////////////////////////////////////////////////
@@ -632,7 +632,7 @@
if (!createdBlurProfileTexture) {
return NULL;
}
- return SkNEW_ARGS(GrRectBlurEffect, (rect, sigma, blurProfileTexture));
+ return new GrRectBlurEffect(rect, sigma, blurProfileTexture);
}
const SkRect& getRect() const { return fRect; }
@@ -802,7 +802,7 @@
}
GrGLFragmentProcessor* GrRectBlurEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GrGLRectBlurEffect, (*this));
+ return new GrGLRectBlurEffect(*this);
}
bool GrRectBlurEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
@@ -972,7 +972,7 @@
}
texProvider->assignUniqueKeyToTexture(key, blurNinePatchTexture);
}
- return SkNEW_ARGS(GrRRectBlurEffect, (sigma, rrect, blurNinePatchTexture));
+ return new GrRRectBlurEffect(sigma, rrect, blurNinePatchTexture);
}
void GrRRectBlurEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
@@ -1102,7 +1102,7 @@
}
GrGLFragmentProcessor* GrRRectBlurEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GrGLRRectBlurEffect, (*this));
+ return new GrGLRRectBlurEffect(*this);
}
bool SkBlurMaskFilterImpl::directFilterRRectMaskGPU(GrTextureProvider* texProvider,
diff --git a/src/effects/SkColorCubeFilter.cpp b/src/effects/SkColorCubeFilter.cpp
index 5e9dfde..d1857f9 100644
--- a/src/effects/SkColorCubeFilter.cpp
+++ b/src/effects/SkColorCubeFilter.cpp
@@ -51,7 +51,7 @@
return NULL;
}
- return SkNEW_ARGS(SkColorCubeFilter, (cubeData, cubeDimension));
+ return new SkColorCubeFilter(cubeData, cubeDimension);
}
SkColorCubeFilter::SkColorCubeFilter(SkData* cubeData, int cubeDimension)
@@ -161,7 +161,7 @@
class GrColorCubeEffect : public GrFragmentProcessor {
public:
static GrFragmentProcessor* Create(GrTexture* colorCube) {
- return (NULL != colorCube) ? SkNEW_ARGS(GrColorCubeEffect, (colorCube)) : NULL;
+ return (NULL != colorCube) ? new GrColorCubeEffect(colorCube) : NULL;
}
virtual ~GrColorCubeEffect();
@@ -223,7 +223,7 @@
}
GrGLFragmentProcessor* GrColorCubeEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GLProcessor, (*this));
+ return new GLProcessor(*this);
}
void GrColorCubeEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
diff --git a/src/effects/SkColorFilterImageFilter.cpp b/src/effects/SkColorFilterImageFilter.cpp
old mode 100755
new mode 100644
index 94b530d..20dee8e
--- a/src/effects/SkColorFilterImageFilter.cpp
+++ b/src/effects/SkColorFilterImageFilter.cpp
@@ -28,11 +28,11 @@
SkAutoUnref autoUnref(inputCF);
SkAutoTUnref<SkColorFilter> newCF(SkColorFilter::CreateComposeFilter(cf, inputCF));
if (newCF) {
- return SkNEW_ARGS(SkColorFilterImageFilter, (newCF, input->getInput(0), cropRect));
+ return new SkColorFilterImageFilter(newCF, input->getInput(0), cropRect);
}
}
- return SkNEW_ARGS(SkColorFilterImageFilter, (cf, input, cropRect));
+ return new SkColorFilterImageFilter(cf, input, cropRect);
}
SkColorFilterImageFilter::SkColorFilterImageFilter(SkColorFilter* cf,
diff --git a/src/effects/SkColorFilters.cpp b/src/effects/SkColorFilters.cpp
index af3e38b..5560183 100644
--- a/src/effects/SkColorFilters.cpp
+++ b/src/effects/SkColorFilters.cpp
@@ -134,7 +134,7 @@
// SkDebugf("Failing to create color filter for mode %d\n", mode);
return NULL;
}
- return SkNEW_ARGS(ModeColorFilterEffect, (c, mode));
+ return new ModeColorFilterEffect(c, mode);
}
bool willUseFilterColor() const {
@@ -212,9 +212,7 @@
this->initClassID<ModeColorFilterEffect>();
}
- GrGLFragmentProcessor* onCreateGLInstance() const override {
- return SkNEW_ARGS(GLProcessor, (*this));
- }
+ GrGLFragmentProcessor* onCreateGLInstance() const override { return new GLProcessor(*this); }
virtual void onGetGLProcessorKey(const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const override {
@@ -438,11 +436,11 @@
switch (mode) {
case SkXfermode::kSrc_Mode:
- return SkNEW_ARGS(Src_SkModeColorFilter, (color));
+ return new Src_SkModeColorFilter(color);
case SkXfermode::kSrcOver_Mode:
- return SkNEW_ARGS(SrcOver_SkModeColorFilter, (color));
+ return new SrcOver_SkModeColorFilter(color);
default:
- return SkNEW_ARGS(SkModeColorFilter, (color, mode));
+ return new SkModeColorFilter(color, mode);
}
}
diff --git a/src/effects/SkColorMatrixFilter.cpp b/src/effects/SkColorMatrixFilter.cpp
index 5845bc9..46c9b26 100644
--- a/src/effects/SkColorMatrixFilter.cpp
+++ b/src/effects/SkColorMatrixFilter.cpp
@@ -389,7 +389,7 @@
class ColorMatrixEffect : public GrFragmentProcessor {
public:
static GrFragmentProcessor* Create(const SkColorMatrix& matrix) {
- return SkNEW_ARGS(ColorMatrixEffect, (matrix));
+ return new ColorMatrixEffect(matrix);
}
const char* name() const override { return "Color Matrix"; }
@@ -462,9 +462,7 @@
this->initClassID<ColorMatrixEffect>();
}
- GrGLFragmentProcessor* onCreateGLInstance() const override {
- return SkNEW_ARGS(GLProcessor, (*this));
- }
+ GrGLFragmentProcessor* onCreateGLInstance() const override { return new GLProcessor(*this); }
virtual void onGetGLProcessorKey(const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const override {
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index f360fe1..0c2cb8a 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -173,8 +173,7 @@
}
SkImageFilter* inputs[2] = { displacement, color };
- return SkNEW_ARGS(SkDisplacementMapEffect, (xChannelSelector, yChannelSelector, scale,
- inputs, cropRect));
+ return new SkDisplacementMapEffect(xChannelSelector, yChannelSelector, scale, inputs, cropRect);
}
SkDisplacementMapEffect::SkDisplacementMapEffect(ChannelSelectorType xChannelSelector,
@@ -334,14 +333,9 @@
SkDisplacementMapEffect::ChannelSelectorType yChannelSelector, SkVector scale,
GrTexture* displacement, const SkMatrix& offsetMatrix, GrTexture* color,
const SkISize& colorDimensions) {
- return SkNEW_ARGS(GrDisplacementMapEffect, (procDataManager,
- xChannelSelector,
- yChannelSelector,
- scale,
- displacement,
- offsetMatrix,
- color,
- colorDimensions));
+ return new GrDisplacementMapEffect(procDataManager, xChannelSelector, yChannelSelector,
+ scale, displacement, offsetMatrix, color,
+ colorDimensions);
}
virtual ~GrDisplacementMapEffect();
@@ -357,7 +351,7 @@
private:
GrGLFragmentProcessor* onCreateGLInstance() const override {
- return SkNEW_ARGS(GrGLDisplacementMapEffect, (*this));
+ return new GrGLDisplacementMapEffect(*this);
}
virtual void onGetGLProcessorKey(const GrGLSLCaps& caps,
diff --git a/src/effects/SkEmbossMaskFilter.cpp b/src/effects/SkEmbossMaskFilter.cpp
index 59d2978..fcb6a2a 100644
--- a/src/effects/SkEmbossMaskFilter.cpp
+++ b/src/effects/SkEmbossMaskFilter.cpp
@@ -14,7 +14,7 @@
#include "SkString.h"
SkEmbossMaskFilter* SkEmbossMaskFilter::Create(SkScalar blurSigma, const Light& light) {
- return SkNEW_ARGS(SkEmbossMaskFilter, (blurSigma, light));
+ return new SkEmbossMaskFilter(blurSigma, light);
}
static inline int pin2byte(int n) {
diff --git a/src/effects/SkLayerDrawLooper.cpp b/src/effects/SkLayerDrawLooper.cpp
index 30709c4..622088f 100644
--- a/src/effects/SkLayerDrawLooper.cpp
+++ b/src/effects/SkLayerDrawLooper.cpp
@@ -31,14 +31,14 @@
Rec* rec = fRecs;
while (rec) {
Rec* next = rec->fNext;
- SkDELETE(rec);
+ delete rec;
rec = next;
}
}
SkLayerDrawLooper::Context* SkLayerDrawLooper::createContext(SkCanvas* canvas, void* storage) const {
canvas->save();
- return SkNEW_PLACEMENT_ARGS(storage, LayerDrawLooperContext, (this));
+ return new (storage) LayerDrawLooperContext(this);
}
static SkColor xferColor(SkColor src, SkColor dst, SkXfermode::Mode mode) {
@@ -302,7 +302,7 @@
Rec* rec = fRecs;
while (rec) {
Rec* next = rec->fNext;
- SkDELETE(rec);
+ delete rec;
rec = next;
}
}
@@ -310,7 +310,7 @@
SkPaint* SkLayerDrawLooper::Builder::addLayer(const LayerInfo& info) {
fCount += 1;
- Rec* rec = SkNEW(Rec);
+ Rec* rec = new Rec;
rec->fNext = fRecs;
rec->fInfo = info;
fRecs = rec;
@@ -331,7 +331,7 @@
SkPaint* SkLayerDrawLooper::Builder::addLayerOnTop(const LayerInfo& info) {
fCount += 1;
- Rec* rec = SkNEW(Rec);
+ Rec* rec = new Rec;
rec->fNext = NULL;
rec->fInfo = info;
if (NULL == fRecs) {
@@ -346,7 +346,7 @@
}
SkLayerDrawLooper* SkLayerDrawLooper::Builder::detachLooper() {
- SkLayerDrawLooper* looper = SkNEW(SkLayerDrawLooper);
+ SkLayerDrawLooper* looper = new SkLayerDrawLooper;
looper->fCount = fCount;
looper->fRecs = fRecs;
diff --git a/src/effects/SkLayerRasterizer.cpp b/src/effects/SkLayerRasterizer.cpp
index 8403d06..d5ebb24 100644
--- a/src/effects/SkLayerRasterizer.cpp
+++ b/src/effects/SkLayerRasterizer.cpp
@@ -25,10 +25,7 @@
SkVector fOffset;
};
-SkLayerRasterizer::SkLayerRasterizer()
- : fLayers(SkNEW_ARGS(SkDeque, (sizeof(SkLayerRasterizer_Rec))))
-{
-}
+SkLayerRasterizer::SkLayerRasterizer() : fLayers(new SkDeque(sizeof(SkLayerRasterizer_Rec))) {}
SkLayerRasterizer::SkLayerRasterizer(SkDeque* layers) : fLayers(layers)
{
@@ -42,7 +39,7 @@
while ((rec = (SkLayerRasterizer_Rec*)iter.next()) != NULL)
rec->fPaint.~SkPaint();
- SkDELETE(layers);
+ delete layers;
}
SkLayerRasterizer::~SkLayerRasterizer() {
@@ -149,17 +146,17 @@
}
SkFlattenable* SkLayerRasterizer::CreateProc(SkReadBuffer& buffer) {
- return SkNEW_ARGS(SkLayerRasterizer, (ReadLayers(buffer)));
+ return new SkLayerRasterizer(ReadLayers(buffer));
}
SkDeque* SkLayerRasterizer::ReadLayers(SkReadBuffer& buffer) {
int count = buffer.readInt();
- SkDeque* layers = SkNEW_ARGS(SkDeque, (sizeof(SkLayerRasterizer_Rec)));
+ SkDeque* layers = new SkDeque(sizeof(SkLayerRasterizer_Rec));
for (int i = 0; i < count; i++) {
SkLayerRasterizer_Rec* rec = (SkLayerRasterizer_Rec*)layers->push_back();
- SkNEW_PLACEMENT(&rec->fPaint, SkPaint);
+ new (&rec->fPaint) SkPaint;
buffer.readPaint(&rec->fPaint);
buffer.readPoint(&rec->fOffset);
}
@@ -181,10 +178,7 @@
}
}
-SkLayerRasterizer::Builder::Builder()
- : fLayers(SkNEW_ARGS(SkDeque, (sizeof(SkLayerRasterizer_Rec))))
-{
-}
+SkLayerRasterizer::Builder::Builder() : fLayers(new SkDeque(sizeof(SkLayerRasterizer_Rec))) {}
SkLayerRasterizer::Builder::~Builder()
{
@@ -198,7 +192,7 @@
SkASSERT(fLayers);
SkLayerRasterizer_Rec* rec = (SkLayerRasterizer_Rec*)fLayers->push_back();
- SkNEW_PLACEMENT_ARGS(&rec->fPaint, SkPaint, (paint));
+ new (&rec->fPaint) SkPaint(paint);
rec->fOffset.set(dx, dy);
}
@@ -206,9 +200,9 @@
SkLayerRasterizer* rasterizer;
if (0 == fLayers->count()) {
rasterizer = NULL;
- SkDELETE(fLayers);
+ delete fLayers;
} else {
- rasterizer = SkNEW_ARGS(SkLayerRasterizer, (fLayers));
+ rasterizer = new SkLayerRasterizer(fLayers);
}
fLayers = NULL;
return rasterizer;
@@ -218,18 +212,18 @@
if (0 == fLayers->count()) {
return NULL;
}
- SkDeque* layers = SkNEW_ARGS(SkDeque, (sizeof(SkLayerRasterizer_Rec), fLayers->count()));
+ SkDeque* layers = new SkDeque(sizeof(SkLayerRasterizer_Rec), fLayers->count());
SkDeque::F2BIter iter(*fLayers);
const SkLayerRasterizer_Rec* recOrig;
SkDEBUGCODE(int count = 0;)
while ((recOrig = static_cast<SkLayerRasterizer_Rec*>(iter.next())) != NULL) {
SkDEBUGCODE(count++);
SkLayerRasterizer_Rec* recCopy = static_cast<SkLayerRasterizer_Rec*>(layers->push_back());
- SkNEW_PLACEMENT_ARGS(&recCopy->fPaint, SkPaint, (recOrig->fPaint));
+ new (&recCopy->fPaint) SkPaint(recOrig->fPaint);
recCopy->fOffset = recOrig->fOffset;
}
SkASSERT(fLayers->count() == count);
SkASSERT(layers->count() == count);
- SkLayerRasterizer* rasterizer = SkNEW_ARGS(SkLayerRasterizer, (layers));
+ SkLayerRasterizer* rasterizer = new SkLayerRasterizer(layers);
return rasterizer;
}
diff --git a/src/effects/SkLerpXfermode.cpp b/src/effects/SkLerpXfermode.cpp
index 76c97ef..a9b0d9e 100644
--- a/src/effects/SkLerpXfermode.cpp
+++ b/src/effects/SkLerpXfermode.cpp
@@ -18,7 +18,7 @@
} else if (scale256 <= 0) {
return SkXfermode::Create(SkXfermode::kDst_Mode);
}
- return SkNEW_ARGS(SkLerpXfermode, (scale256));
+ return new SkLerpXfermode(scale256);
}
SkLerpXfermode::SkLerpXfermode(unsigned scale256) : fScale256(scale256) {}
@@ -28,7 +28,7 @@
}
SkFlattenable* SkLerpXfermode::CreateProc(SkReadBuffer& buffer) {
- return SkNEW_ARGS(SkLerpXfermode, (buffer.readUInt()));
+ return new SkLerpXfermode(buffer.readUInt());
}
void SkLerpXfermode::xfer32(SkPMColor dst[], const SkPMColor src[], int count,
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index c63b2eb..2e25cbf 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -527,13 +527,8 @@
const SkMatrix& matrix,
SkScalar kd,
BoundaryMode boundaryMode) {
- return SkNEW_ARGS(GrDiffuseLightingEffect, (procDataManager,
- texture,
- light,
- surfaceScale,
- matrix,
- kd,
- boundaryMode));
+ return new GrDiffuseLightingEffect(procDataManager, texture, light, surfaceScale, matrix,
+ kd, boundaryMode);
}
const char* name() const override { return "DiffuseLighting"; }
@@ -570,14 +565,8 @@
SkScalar ks,
SkScalar shininess,
BoundaryMode boundaryMode) {
- return SkNEW_ARGS(GrSpecularLightingEffect, (procDataManager,
- texture,
- light,
- surfaceScale,
- matrix,
- ks,
- shininess,
- boundaryMode));
+ return new GrSpecularLightingEffect(procDataManager, texture, light, surfaceScale, matrix,
+ ks, shininess, boundaryMode);
}
const char* name() const override { return "SpecularLighting"; }
@@ -762,7 +751,7 @@
const SkPoint3& direction() const { return fDirection; }
GrGLLight* createGLLight() const override {
#if SK_SUPPORT_GPU
- return SkNEW(GrGLDistantLight);
+ return new GrGLDistantLight;
#else
SkDEBUGFAIL("Should not call in GPU-less build");
return NULL;
@@ -821,7 +810,7 @@
const SkPoint3& location() const { return fLocation; }
GrGLLight* createGLLight() const override {
#if SK_SUPPORT_GPU
- return SkNEW(GrGLPointLight);
+ return new GrGLPointLight;
#else
SkDEBUGFAIL("Should not call in GPU-less build");
return NULL;
@@ -935,7 +924,7 @@
}
GrGLLight* createGLLight() const override {
#if SK_SUPPORT_GPU
- return SkNEW(GrGLSpotLight);
+ return new GrGLSpotLight;
#else
SkDEBUGFAIL("Should not call in GPU-less build");
return NULL;
@@ -1041,9 +1030,12 @@
switch (type) {
// Each of these constructors must first call SkLight's, so we'll read the baseclass
// then subclass, same order as flattenLight.
- case SkImageFilterLight::kDistant_LightType: return SkNEW_ARGS(SkDistantLight, (buffer));
- case SkImageFilterLight::kPoint_LightType: return SkNEW_ARGS(SkPointLight, (buffer));
- case SkImageFilterLight::kSpot_LightType: return SkNEW_ARGS(SkSpotLight, (buffer));
+ case SkImageFilterLight::kDistant_LightType:
+ return new SkDistantLight(buffer);
+ case SkImageFilterLight::kPoint_LightType:
+ return new SkPointLight(buffer);
+ case SkImageFilterLight::kSpot_LightType:
+ return new SkSpotLight(buffer);
default:
SkDEBUGFAIL("Unknown LightType.");
buffer.validate(false);
@@ -1065,7 +1057,7 @@
SkScalar kd,
SkImageFilter* input,
const CropRect* cropRect) {
- SkAutoTUnref<SkImageFilterLight> light(SkNEW_ARGS(SkDistantLight, (direction, lightColor)));
+ SkAutoTUnref<SkImageFilterLight> light(new SkDistantLight(direction, lightColor));
return SkDiffuseLightingImageFilter::Create(light, surfaceScale, kd, input, cropRect);
}
@@ -1075,7 +1067,7 @@
SkScalar kd,
SkImageFilter* input,
const CropRect* cropRect) {
- SkAutoTUnref<SkImageFilterLight> light(SkNEW_ARGS(SkPointLight, (location, lightColor)));
+ SkAutoTUnref<SkImageFilterLight> light(new SkPointLight(location, lightColor));
return SkDiffuseLightingImageFilter::Create(light, surfaceScale, kd, input, cropRect);
}
@@ -1088,9 +1080,8 @@
SkScalar kd,
SkImageFilter* input,
const CropRect* cropRect) {
- SkAutoTUnref<SkImageFilterLight> light(SkNEW_ARGS(SkSpotLight, (location, target,
- specularExponent,
- cutoffAngle, lightColor)));
+ SkAutoTUnref<SkImageFilterLight> light(
+ new SkSpotLight(location, target, specularExponent, cutoffAngle, lightColor));
return SkDiffuseLightingImageFilter::Create(light, surfaceScale, kd, input, cropRect);
}
@@ -1101,7 +1092,7 @@
SkScalar shine,
SkImageFilter* input,
const CropRect* cropRect) {
- SkAutoTUnref<SkImageFilterLight> light(SkNEW_ARGS(SkDistantLight, (direction, lightColor)));
+ SkAutoTUnref<SkImageFilterLight> light(new SkDistantLight(direction, lightColor));
return SkSpecularLightingImageFilter::Create(light, surfaceScale, ks, shine, input, cropRect);
}
@@ -1112,7 +1103,7 @@
SkScalar shine,
SkImageFilter* input,
const CropRect* cropRect) {
- SkAutoTUnref<SkImageFilterLight> light(SkNEW_ARGS(SkPointLight, (location, lightColor)));
+ SkAutoTUnref<SkImageFilterLight> light(new SkPointLight(location, lightColor));
return SkSpecularLightingImageFilter::Create(light, surfaceScale, ks, shine, input, cropRect);
}
@@ -1126,9 +1117,8 @@
SkScalar shine,
SkImageFilter* input,
const CropRect* cropRect) {
- SkAutoTUnref<SkImageFilterLight> light(SkNEW_ARGS(SkSpotLight, (location, target,
- specularExponent,
- cutoffAngle, lightColor)));
+ SkAutoTUnref<SkImageFilterLight> light(
+ new SkSpotLight(location, target, specularExponent, cutoffAngle, lightColor));
return SkSpecularLightingImageFilter::Create(light, surfaceScale, ks, shine, input, cropRect);
}
@@ -1158,7 +1148,7 @@
if (kd < 0) {
return NULL;
}
- return SkNEW_ARGS(SkDiffuseLightingImageFilter, (light, surfaceScale, kd, input, cropRect));
+ return new SkDiffuseLightingImageFilter(light, surfaceScale, kd, input, cropRect);
}
SkDiffuseLightingImageFilter::SkDiffuseLightingImageFilter(SkImageFilterLight* light,
@@ -1294,8 +1284,7 @@
if (ks < 0) {
return NULL;
}
- return SkNEW_ARGS(SkSpecularLightingImageFilter,
- (light, surfaceScale, ks, shininess, input, cropRect));
+ return new SkSpecularLightingImageFilter(light, surfaceScale, ks, shininess, input, cropRect);
}
SkSpecularLightingImageFilter::SkSpecularLightingImageFilter(SkImageFilterLight* light,
@@ -1429,17 +1418,14 @@
int type = random->nextULessThan(3);
switch (type) {
case 0: {
- return SkNEW_ARGS(SkDistantLight, (random_point3(random), random->nextU()));
+ return new SkDistantLight(random_point3(random), random->nextU());
}
case 1: {
- return SkNEW_ARGS(SkPointLight, (random_point3(random), random->nextU()));
+ return new SkPointLight(random_point3(random), random->nextU());
}
case 2: {
- return SkNEW_ARGS(SkSpotLight, (random_point3(random),
- random_point3(random),
- random->nextUScalar1(),
- random->nextUScalar1(),
- random->nextU()));
+ return new SkSpotLight(random_point3(random), random_point3(random),
+ random->nextUScalar1(), random->nextUScalar1(), random->nextU());
}
default:
SkFAIL("Unexpected value.");
@@ -1638,7 +1624,7 @@
}
GrGLFragmentProcessor* GrDiffuseLightingEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GrGLDiffuseLightingEffect, (*this));
+ return new GrGLDiffuseLightingEffect(*this);
}
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrDiffuseLightingEffect);
@@ -1841,7 +1827,7 @@
}
GrGLFragmentProcessor* GrSpecularLightingEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GrGLSpecularLightingEffect, (*this));
+ return new GrGLSpecularLightingEffect(*this);
}
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSpecularLightingEffect);
diff --git a/src/effects/SkLumaColorFilter.cpp b/src/effects/SkLumaColorFilter.cpp
index 8d5181a..caa2a20 100644
--- a/src/effects/SkLumaColorFilter.cpp
+++ b/src/effects/SkLumaColorFilter.cpp
@@ -37,15 +37,11 @@
}
}
-SkColorFilter* SkLumaColorFilter::Create() {
- return SkNEW(SkLumaColorFilter);
-}
+SkColorFilter* SkLumaColorFilter::Create() { return new SkLumaColorFilter; }
SkLumaColorFilter::SkLumaColorFilter() : INHERITED() {}
-SkFlattenable* SkLumaColorFilter::CreateProc(SkReadBuffer&) {
- return SkNEW(SkLumaColorFilter);
-}
+SkFlattenable* SkLumaColorFilter::CreateProc(SkReadBuffer&) { return new SkLumaColorFilter; }
void SkLumaColorFilter::flatten(SkWriteBuffer&) const {}
@@ -96,9 +92,7 @@
this->initClassID<LumaColorFilterEffect>();
}
- GrGLFragmentProcessor* onCreateGLInstance() const override {
- return SkNEW_ARGS(GLProcessor, (*this));
- }
+ GrGLFragmentProcessor* onCreateGLInstance() const override { return new GLProcessor(*this); }
virtual void onGetGLProcessorKey(const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const override {
diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp
index baa1926..8bebd20 100644
--- a/src/effects/SkMagnifierImageFilter.cpp
+++ b/src/effects/SkMagnifierImageFilter.cpp
@@ -32,15 +32,8 @@
float yInvZoom,
float xInvInset,
float yInvInset) {
- return SkNEW_ARGS(GrMagnifierEffect, (procDataManager,
- texture,
- bounds,
- xOffset,
- yOffset,
- xInvZoom,
- yInvZoom,
- xInvInset,
- yInvInset));
+ return new GrMagnifierEffect(procDataManager, texture, bounds, xOffset, yOffset, xInvZoom,
+ yInvZoom, xInvInset, yInvInset);
}
virtual ~GrMagnifierEffect() {};
@@ -197,7 +190,7 @@
}
GrGLFragmentProcessor* GrMagnifierEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GrGLMagnifierEffect, (*this));
+ return new GrGLMagnifierEffect(*this);
}
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMagnifierEffect);
@@ -258,7 +251,7 @@
if (srcRect.fLeft < 0 || srcRect.fTop < 0) {
return NULL;
}
- return SkNEW_ARGS(SkMagnifierImageFilter, (srcRect, inset, input));
+ return new SkMagnifierImageFilter(srcRect, inset, input);
}
diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp
index 92ac934..1c44fed 100644
--- a/src/effects/SkMatrixConvolutionImageFilter.cpp
+++ b/src/effects/SkMatrixConvolutionImageFilter.cpp
@@ -39,7 +39,7 @@
fTileMode(tileMode),
fConvolveAlpha(convolveAlpha) {
size_t size = (size_t) sk_64_mul(fKernelSize.width(), fKernelSize.height());
- fKernel = SkNEW_ARRAY(SkScalar, size);
+ fKernel = new SkScalar[size];
memcpy(fKernel, kernel, size * sizeof(SkScalar));
SkASSERT(kernelSize.fWidth >= 1 && kernelSize.fHeight >= 1);
SkASSERT(kernelOffset.fX >= 0 && kernelOffset.fX < kernelSize.fWidth);
@@ -69,9 +69,8 @@
(kernelOffset.fY < 0) || (kernelOffset.fY >= kernelSize.fHeight)) {
return NULL;
}
- return SkNEW_ARGS(SkMatrixConvolutionImageFilter, (kernelSize, kernel, gain, bias,
- kernelOffset, tileMode, convolveAlpha,
- input, cropRect));
+ return new SkMatrixConvolutionImageFilter(kernelSize, kernel, gain, bias, kernelOffset,
+ tileMode, convolveAlpha, input, cropRect);
}
SkFlattenable* SkMatrixConvolutionImageFilter::CreateProc(SkReadBuffer& buffer) {
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index 01e978e..7d6bfff 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -207,13 +207,13 @@
static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager, GrTexture* tex,
Direction dir, int radius, MorphologyType type) {
- return SkNEW_ARGS(GrMorphologyEffect, (procDataManager, tex, dir, radius, type));
+ return new GrMorphologyEffect(procDataManager, tex, dir, radius, type);
}
static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager, GrTexture* tex,
Direction dir, int radius, MorphologyType type,
float bounds[2]) {
- return SkNEW_ARGS(GrMorphologyEffect, (procDataManager, tex, dir, radius, type, bounds));
+ return new GrMorphologyEffect(procDataManager, tex, dir, radius, type, bounds);
}
virtual ~GrMorphologyEffect();
@@ -425,7 +425,7 @@
}
GrGLFragmentProcessor* GrMorphologyEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GrGLMorphologyEffect, (*this));
+ return new GrGLMorphologyEffect(*this);
}
bool GrMorphologyEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
const GrMorphologyEffect& s = sBase.cast<GrMorphologyEffect>();
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index 501e636..2ca86c7 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -250,15 +250,15 @@
SkShader* SkPerlinNoiseShader::CreateFractalNoise(SkScalar baseFrequencyX, SkScalar baseFrequencyY,
int numOctaves, SkScalar seed,
const SkISize* tileSize) {
- return SkNEW_ARGS(SkPerlinNoiseShader, (kFractalNoise_Type, baseFrequencyX, baseFrequencyY,
- numOctaves, seed, tileSize));
+ return new SkPerlinNoiseShader(kFractalNoise_Type, baseFrequencyX, baseFrequencyY, numOctaves,
+ seed, tileSize);
}
SkShader* SkPerlinNoiseShader::CreateTurbulence(SkScalar baseFrequencyX, SkScalar baseFrequencyY,
int numOctaves, SkScalar seed,
const SkISize* tileSize) {
- return SkNEW_ARGS(SkPerlinNoiseShader, (kTurbulence_Type, baseFrequencyX, baseFrequencyY,
- numOctaves, seed, tileSize));
+ return new SkPerlinNoiseShader(kTurbulence_Type, baseFrequencyX, baseFrequencyY, numOctaves,
+ seed, tileSize);
}
SkPerlinNoiseShader::SkPerlinNoiseShader(SkPerlinNoiseShader::Type type,
@@ -429,7 +429,7 @@
SkShader::Context* SkPerlinNoiseShader::onCreateContext(const ContextRec& rec,
void* storage) const {
- return SkNEW_PLACEMENT_ARGS(storage, PerlinNoiseShaderContext, (*this, rec));
+ return new (storage) PerlinNoiseShaderContext(*this, rec);
}
size_t SkPerlinNoiseShader::contextSize() const {
@@ -448,12 +448,11 @@
// This (1,1) translation is due to WebKit's 1 based coordinates for the noise
// (as opposed to 0 based, usually). The same adjustment is in the setData() function.
fMatrix.setTranslate(-newMatrix.getTranslateX() + SK_Scalar1, -newMatrix.getTranslateY() + SK_Scalar1);
- fPaintingData = SkNEW_ARGS(PaintingData, (shader.fTileSize, shader.fSeed, shader.fBaseFrequencyX, shader.fBaseFrequencyY, newMatrix));
+ fPaintingData = new PaintingData(shader.fTileSize, shader.fSeed, shader.fBaseFrequencyX,
+ shader.fBaseFrequencyY, newMatrix);
}
-SkPerlinNoiseShader::PerlinNoiseShaderContext::~PerlinNoiseShaderContext() {
- SkDELETE(fPaintingData);
-}
+SkPerlinNoiseShader::PerlinNoiseShaderContext::~PerlinNoiseShaderContext() { delete fPaintingData; }
void SkPerlinNoiseShader::PerlinNoiseShaderContext::shadeSpan(
int x, int y, SkPMColor result[], int count) {
@@ -517,14 +516,11 @@
SkPerlinNoiseShader::PaintingData* paintingData,
GrTexture* permutationsTexture, GrTexture* noiseTexture,
const SkMatrix& matrix, uint8_t alpha) {
- return SkNEW_ARGS(GrPerlinNoiseEffect, (procDataManager, type, numOctaves, stitchTiles,
- paintingData, permutationsTexture, noiseTexture,
- matrix, alpha));
+ return new GrPerlinNoiseEffect(procDataManager, type, numOctaves, stitchTiles, paintingData,
+ permutationsTexture, noiseTexture, matrix, alpha);
}
- virtual ~GrPerlinNoiseEffect() {
- SkDELETE(fPaintingData);
- }
+ virtual ~GrPerlinNoiseEffect() { delete fPaintingData; }
const char* name() const override { return "PerlinNoise"; }
@@ -539,7 +535,7 @@
private:
GrGLFragmentProcessor* onCreateGLInstance() const override {
- return SkNEW_ARGS(GrGLPerlinNoise, (*this));
+ return new GrGLPerlinNoise(*this);
}
virtual void onGetGLProcessorKey(const GrGLSLCaps& caps,
@@ -624,7 +620,7 @@
&paintColor, grPaint.getProcessorDataManager(),
&effect));
- SkDELETE(shader);
+ delete shader;
return effect;
}
@@ -968,7 +964,7 @@
SkASSERT(!fStitchTiles || !fTileSize.isEmpty());
SkPerlinNoiseShader::PaintingData* paintingData =
- SkNEW_ARGS(PaintingData, (fTileSize, fSeed, fBaseFrequencyX, fBaseFrequencyY, matrix));
+ new PaintingData(fTileSize, fSeed, fBaseFrequencyX, fBaseFrequencyY, matrix);
SkAutoTUnref<GrTexture> permutationsTexture(
GrRefCachedBitmapTexture(context, paintingData->getPermutationsBitmap(), NULL));
SkAutoTUnref<GrTexture> noiseTexture(
@@ -986,7 +982,7 @@
permutationsTexture, noiseTexture,
m, paint.getAlpha());
} else {
- SkDELETE(paintingData);
+ delete paintingData;
*fp = NULL;
}
return true;
diff --git a/src/effects/SkRectShaderImageFilter.cpp b/src/effects/SkRectShaderImageFilter.cpp
index 4596253..6309d35 100644
--- a/src/effects/SkRectShaderImageFilter.cpp
+++ b/src/effects/SkRectShaderImageFilter.cpp
@@ -20,12 +20,12 @@
flags = 0x0;
}
CropRect cropRect(rect, flags);
- return s ? SkNEW_ARGS(SkRectShaderImageFilter, (s, &cropRect)) : NULL;
+ return s ? new SkRectShaderImageFilter(s, &cropRect) : NULL;
}
SkRectShaderImageFilter* SkRectShaderImageFilter::Create(SkShader* s, const CropRect* cropRect) {
SkASSERT(s);
- return s ? SkNEW_ARGS(SkRectShaderImageFilter, (s, cropRect)) : NULL;
+ return s ? new SkRectShaderImageFilter(s, cropRect) : NULL;
}
SkRectShaderImageFilter::SkRectShaderImageFilter(SkShader* s, const CropRect* cropRect)
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index f39e88a..e20f922 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -42,9 +42,7 @@
}
}
- virtual ~SkTable_ColorFilter() {
- SkDELETE(fBitmap);
- }
+ virtual ~SkTable_ColorFilter() { delete fBitmap; }
bool asComponentTable(SkBitmap* table) const override;
SkColorFilter* newComposed(const SkColorFilter* inner) const override;
@@ -259,7 +257,7 @@
bool SkTable_ColorFilter::asComponentTable(SkBitmap* table) const {
if (table) {
if (NULL == fBitmap) {
- SkBitmap* bmp = SkNEW(SkBitmap);
+ SkBitmap* bmp = new SkBitmap;
bmp->allocPixels(SkImageInfo::MakeA8(256, 4));
uint8_t* bitmapPixels = bmp->getAddr8(0, 0);
int offset = 0;
@@ -482,7 +480,7 @@
texture.reset(SkRef(atlas->getTexture()));
}
- return SkNEW_ARGS(ColorTableEffect, (texture, atlas, row, flags));
+ return new ColorTableEffect(texture, atlas, row, flags);
}
ColorTableEffect::ColorTableEffect(GrTexture* texture, GrTextureStripAtlas* atlas, int row,
@@ -507,7 +505,7 @@
}
GrGLFragmentProcessor* ColorTableEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GLColorTableEffect, (*this));
+ return new GLColorTableEffect(*this);
}
bool ColorTableEffect::onIsEqual(const GrFragmentProcessor& other) const {
@@ -607,14 +605,14 @@
///////////////////////////////////////////////////////////////////////////////
SkColorFilter* SkTableColorFilter::Create(const uint8_t table[256]) {
- return SkNEW_ARGS(SkTable_ColorFilter, (table, table, table, table));
+ return new SkTable_ColorFilter(table, table, table, table);
}
SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256],
const uint8_t tableR[256],
const uint8_t tableG[256],
const uint8_t tableB[256]) {
- return SkNEW_ARGS(SkTable_ColorFilter, (tableA, tableR, tableG, tableB));
+ return new SkTable_ColorFilter(tableA, tableR, tableG, tableB);
}
SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter)
diff --git a/src/effects/SkTileImageFilter.cpp b/src/effects/SkTileImageFilter.cpp
index 2b7ed94..9292b26 100644
--- a/src/effects/SkTileImageFilter.cpp
+++ b/src/effects/SkTileImageFilter.cpp
@@ -21,7 +21,7 @@
if (!SkIsValidRect(srcRect) || !SkIsValidRect(dstRect)) {
return NULL;
}
- return SkNEW_ARGS(SkTileImageFilter, (srcRect, dstRect, input));
+ return new SkTileImageFilter(srcRect, dstRect, input);
}
bool SkTileImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
diff --git a/src/effects/gradients/SkGradientBitmapCache.cpp b/src/effects/gradients/SkGradientBitmapCache.cpp
index 63d708b..90fa3d5 100644
--- a/src/effects/gradients/SkGradientBitmapCache.cpp
+++ b/src/effects/gradients/SkGradientBitmapCache.cpp
@@ -108,7 +108,7 @@
fEntryCount -= 1;
}
- Entry* entry = SkNEW_ARGS(Entry, (buffer, len, bm));
+ Entry* entry = new Entry(buffer, len, bm);
this->attachToHead(entry);
fEntryCount += 1;
}
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index ebfa75f..8bef3e3 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -597,7 +597,7 @@
SkGradientShaderBase::GradientShaderCache* SkGradientShaderBase::refCache(U8CPU alpha) const {
SkAutoMutexAcquire ama(fCacheMutex);
if (!fCache || fCache->getAlpha() != alpha) {
- fCache.reset(SkNEW_ARGS(GradientShaderCache, (alpha, *this)));
+ fCache.reset(new GradientShaderCache(alpha, *this));
}
// Increment the ref counter inside the mutex to ensure the returned pointer is still valid.
// Otherwise, the pointer may have been overwritten on a different thread before the object's
@@ -648,7 +648,7 @@
SkAutoMutexAcquire ama(gGradientCacheMutex);
if (NULL == gCache) {
- gCache = SkNEW_ARGS(SkGradientBitmapCache, (MAX_NUM_CACHED_GRADIENT_BITMAPS));
+ gCache = new SkGradientBitmapCache(MAX_NUM_CACHED_GRADIENT_BITMAPS);
}
size_t size = count * sizeof(int32_t);
@@ -779,7 +779,7 @@
SkGradientShaderBase::Descriptor desc;
desc_init(&desc, colors, pos, colorCount, mode, flags, localMatrix);
- return SkNEW_ARGS(SkLinearGradient, (pts, desc));
+ return new SkLinearGradient(pts, desc);
}
SkShader* SkGradientShader::CreateRadial(const SkPoint& center, SkScalar radius,
@@ -798,7 +798,7 @@
SkGradientShaderBase::Descriptor desc;
desc_init(&desc, colors, pos, colorCount, mode, flags, localMatrix);
- return SkNEW_ARGS(SkRadialGradient, (center, radius, desc));
+ return new SkRadialGradient(center, radius, desc);
}
SkShader* SkGradientShader::CreateTwoPointConical(const SkPoint& start,
@@ -829,8 +829,8 @@
if (!flipGradient) {
desc_init(&desc, colors, pos, colorCount, mode, flags, localMatrix);
- return SkNEW_ARGS(SkTwoPointConicalGradient,
- (start, startRadius, end, endRadius, flipGradient, desc));
+ return new SkTwoPointConicalGradient(start, startRadius, end, endRadius, flipGradient,
+ desc);
} else {
SkAutoSTArray<8, SkColor> colorsNew(colorCount);
SkAutoSTArray<8, SkScalar> posNew(colorCount);
@@ -847,8 +847,8 @@
desc_init(&desc, colorsNew.get(), NULL, colorCount, mode, flags, localMatrix);
}
- return SkNEW_ARGS(SkTwoPointConicalGradient,
- (end, endRadius, start, startRadius, flipGradient, desc));
+ return new SkTwoPointConicalGradient(end, endRadius, start, startRadius, flipGradient,
+ desc);
}
}
@@ -865,7 +865,7 @@
SkGradientShaderBase::Descriptor desc;
desc_init(&desc, colors, pos, colorCount, SkShader::kClamp_TileMode, flags, localMatrix);
- return SkNEW_ARGS(SkSweepGradient, (cx, cy, desc));
+ return new SkSweepGradient(cx, cy, desc);
}
SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkGradientShader)
diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp
index d9b4a5c..a5be417 100644
--- a/src/effects/gradients/SkLinearGradient.cpp
+++ b/src/effects/gradients/SkLinearGradient.cpp
@@ -83,7 +83,7 @@
}
SkShader::Context* SkLinearGradient::onCreateContext(const ContextRec& rec, void* storage) const {
- return SkNEW_PLACEMENT_ARGS(storage, LinearGradientContext, (*this, rec));
+ return new (storage) LinearGradientContext(*this, rec);
}
SkLinearGradient::LinearGradientContext::LinearGradientContext(
@@ -472,7 +472,7 @@
const SkLinearGradient& shader,
const SkMatrix& matrix,
SkShader::TileMode tm) {
- return SkNEW_ARGS(GrLinearGradient, (ctx, procDataManager, shader, matrix, tm));
+ return new GrLinearGradient(ctx, procDataManager, shader, matrix, tm);
}
virtual ~GrLinearGradient() { }
@@ -490,7 +490,7 @@
}
GrGLFragmentProcessor* onCreateGLInstance() const override {
- return SkNEW_ARGS(GrGLLinearGradient, (*this));
+ return new GrGLLinearGradient(*this);
}
virtual void onGetGLProcessorKey(const GrGLSLCaps& caps,
diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp
index 1b995cb..7e24949 100644
--- a/src/effects/gradients/SkRadialGradient.cpp
+++ b/src/effects/gradients/SkRadialGradient.cpp
@@ -160,7 +160,7 @@
}
SkShader::Context* SkRadialGradient::onCreateContext(const ContextRec& rec, void* storage) const {
- return SkNEW_PLACEMENT_ARGS(storage, RadialGradientContext, (*this, rec));
+ return new (storage) RadialGradientContext(*this, rec);
}
SkRadialGradient::RadialGradientContext::RadialGradientContext(
@@ -444,7 +444,7 @@
const SkRadialGradient& shader,
const SkMatrix& matrix,
SkShader::TileMode tm) {
- return SkNEW_ARGS(GrRadialGradient, (ctx, procDataManager, shader, matrix, tm));
+ return new GrRadialGradient(ctx, procDataManager, shader, matrix, tm);
}
virtual ~GrRadialGradient() { }
@@ -462,7 +462,7 @@
}
GrGLFragmentProcessor* onCreateGLInstance() const override {
- return SkNEW_ARGS(GrGLRadialGradient, (*this));
+ return new GrGLRadialGradient(*this);
}
virtual void onGetGLProcessorKey(const GrGLSLCaps& caps,
diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp
index 22bf68e..9e44b70 100644
--- a/src/effects/gradients/SkSweepGradient.cpp
+++ b/src/effects/gradients/SkSweepGradient.cpp
@@ -50,7 +50,7 @@
}
SkShader::Context* SkSweepGradient::onCreateContext(const ContextRec& rec, void* storage) const {
- return SkNEW_PLACEMENT_ARGS(storage, SweepGradientContext, (*this, rec));
+ return new (storage) SweepGradientContext(*this, rec);
}
SkSweepGradient::SweepGradientContext::SweepGradientContext(
@@ -193,7 +193,7 @@
public:
static GrFragmentProcessor* Create(GrContext* ctx, GrProcessorDataManager* procDataManager,
const SkSweepGradient& shader, const SkMatrix& m) {
- return SkNEW_ARGS(GrSweepGradient, (ctx, procDataManager, shader, m));
+ return new GrSweepGradient(ctx, procDataManager, shader, m);
}
virtual ~GrSweepGradient() { }
@@ -209,7 +209,7 @@
}
GrGLFragmentProcessor* onCreateGLInstance() const override {
- return SkNEW_ARGS(GrGLSweepGradient, (*this));
+ return new GrGLSweepGradient(*this);
}
virtual void onGetGLProcessorKey(const GrGLSLCaps& caps,
diff --git a/src/effects/gradients/SkTwoPointConicalGradient.cpp b/src/effects/gradients/SkTwoPointConicalGradient.cpp
index 1cdb19e..7e5edf2 100644
--- a/src/effects/gradients/SkTwoPointConicalGradient.cpp
+++ b/src/effects/gradients/SkTwoPointConicalGradient.cpp
@@ -217,7 +217,7 @@
SkShader::Context* SkTwoPointConicalGradient::onCreateContext(const ContextRec& rec,
void* storage) const {
- return SkNEW_PLACEMENT_ARGS(storage, TwoPointConicalGradientContext, (*this, rec));
+ return new (storage) TwoPointConicalGradientContext(*this, rec);
}
SkTwoPointConicalGradient::TwoPointConicalGradientContext::TwoPointConicalGradientContext(
diff --git a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp
index 6f60482..cdc1862 100644
--- a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp
+++ b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp
@@ -63,7 +63,7 @@
const SkTwoPointConicalGradient& shader,
const SkMatrix& matrix,
SkShader::TileMode tm) {
- return SkNEW_ARGS(Edge2PtConicalEffect, (ctx, procDataManager, shader, matrix, tm));
+ return new Edge2PtConicalEffect(ctx, procDataManager, shader, matrix, tm);
}
virtual ~Edge2PtConicalEffect() {}
@@ -175,7 +175,7 @@
}
GrGLFragmentProcessor* Edge2PtConicalEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GLEdge2PtConicalEffect, (*this));
+ return new GLEdge2PtConicalEffect(*this);
}
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(Edge2PtConicalEffect);
@@ -376,8 +376,7 @@
const SkMatrix& matrix,
SkShader::TileMode tm,
SkScalar focalX) {
- return SkNEW_ARGS(FocalOutside2PtConicalEffect, (ctx, procDataManager, shader, matrix, tm,
- focalX));
+ return new FocalOutside2PtConicalEffect(ctx, procDataManager, shader, matrix, tm, focalX);
}
virtual ~FocalOutside2PtConicalEffect() { }
@@ -458,7 +457,7 @@
}
GrGLFragmentProcessor* FocalOutside2PtConicalEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GLFocalOutside2PtConicalEffect, (*this));
+ return new GLFocalOutside2PtConicalEffect(*this);
}
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(FocalOutside2PtConicalEffect);
@@ -593,8 +592,7 @@
const SkMatrix& matrix,
SkShader::TileMode tm,
SkScalar focalX) {
- return SkNEW_ARGS(FocalInside2PtConicalEffect, (ctx, procDataManager, shader, matrix, tm,
- focalX));
+ return new FocalInside2PtConicalEffect(ctx, procDataManager, shader, matrix, tm, focalX);
}
virtual ~FocalInside2PtConicalEffect() {}
@@ -670,7 +668,7 @@
}
GrGLFragmentProcessor* FocalInside2PtConicalEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GLFocalInside2PtConicalEffect, (*this));
+ return new GLFocalInside2PtConicalEffect(*this);
}
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(FocalInside2PtConicalEffect);
@@ -832,8 +830,7 @@
const SkMatrix& matrix,
SkShader::TileMode tm,
const CircleConicalInfo& info) {
- return SkNEW_ARGS(CircleInside2PtConicalEffect, (ctx, procDataManager, shader, matrix, tm,
- info));
+ return new CircleInside2PtConicalEffect(ctx, procDataManager, shader, matrix, tm, info);
}
virtual ~CircleInside2PtConicalEffect() {}
@@ -918,7 +915,7 @@
}
GrGLFragmentProcessor* CircleInside2PtConicalEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GLCircleInside2PtConicalEffect, (*this));
+ return new GLCircleInside2PtConicalEffect(*this);
}
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircleInside2PtConicalEffect);
@@ -1049,8 +1046,7 @@
const SkMatrix& matrix,
SkShader::TileMode tm,
const CircleConicalInfo& info) {
- return SkNEW_ARGS(CircleOutside2PtConicalEffect, (ctx, procDataManager, shader, matrix,
- tm, info));
+ return new CircleOutside2PtConicalEffect(ctx, procDataManager, shader, matrix, tm, info);
}
virtual ~CircleOutside2PtConicalEffect() {}
@@ -1150,7 +1146,7 @@
}
GrGLFragmentProcessor* CircleOutside2PtConicalEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GLCircleOutside2PtConicalEffect, (*this));
+ return new GLCircleOutside2PtConicalEffect(*this);
}
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircleOutside2PtConicalEffect);
diff --git a/src/fonts/SkFontMgr_fontconfig.cpp b/src/fonts/SkFontMgr_fontconfig.cpp
index 0873aa1..72a5a61 100644
--- a/src/fonts/SkFontMgr_fontconfig.cpp
+++ b/src/fonts/SkFontMgr_fontconfig.cpp
@@ -180,7 +180,7 @@
SkFontStyleSet_FC::SkFontStyleSet_FC(FcPattern** matches, int count) {
fRecCount = count;
- fRecs = SkNEW_ARRAY(Rec, count);
+ fRecs = new Rec[count];
for (int i = 0; i < count; ++i) {
fRecs[i].fStyleName.set(get_name(matches[i], FC_STYLE));
fRecs[i].fFileName.set(get_name(matches[i], FC_FILE));
@@ -188,9 +188,7 @@
}
}
-SkFontStyleSet_FC::~SkFontStyleSet_FC() {
- SkDELETE_ARRAY(fRecs);
-}
+SkFontStyleSet_FC::~SkFontStyleSet_FC() { delete[] fRecs; }
void SkFontStyleSet_FC::getStyle(int index, SkFontStyle* style,
SkString* styleName) {
@@ -277,9 +275,8 @@
}
}
- SkFontStyleSet_FC* sset = SkNEW_ARGS(SkFontStyleSet_FC,
- (trimmedMatches.begin(),
- trimmedMatches.count()));
+ SkFontStyleSet_FC* sset =
+ new SkFontStyleSet_FC(trimmedMatches.begin(), trimmedMatches.count());
return sset;
}
@@ -330,5 +327,5 @@
SkFontMgr* SkFontMgr::Factory() {
SkFontConfigInterface* fci = RefFCI();
- return fci ? SkNEW_ARGS(SkFontMgr_fontconfig, (fci)) : NULL;
+ return fci ? new SkFontMgr_fontconfig(fci) : NULL;
}
diff --git a/src/fonts/SkFontMgr_indirect.cpp b/src/fonts/SkFontMgr_indirect.cpp
index 6ad8bfb..33c79c8 100644
--- a/src/fonts/SkFontMgr_indirect.cpp
+++ b/src/fonts/SkFontMgr_indirect.cpp
@@ -178,11 +178,11 @@
if (NULL == set) {
return NULL;
}
- return SkNEW_ARGS(SkStyleSet_Indirect, (this, index, set));
+ return new SkStyleSet_Indirect(this, index, set);
}
SkFontStyleSet* SkFontMgr_Indirect::onMatchFamily(const char familyName[]) const {
- return SkNEW_ARGS(SkStyleSet_Indirect, (this, -1, fProxy->matchName(familyName)));
+ return new SkStyleSet_Indirect(this, -1, fProxy->matchName(familyName));
}
SkTypeface* SkFontMgr_Indirect::createTypefaceFromFontId(const SkFontIdentity& id) const {
diff --git a/src/fonts/SkGScalerContext.cpp b/src/fonts/SkGScalerContext.cpp
index 5787478..d2d0cac 100644
--- a/src/fonts/SkGScalerContext.cpp
+++ b/src/fonts/SkGScalerContext.cpp
@@ -63,9 +63,7 @@
fMatrix.preScale(SK_Scalar1 / STD_SIZE, SK_Scalar1 / STD_SIZE);
}
-SkGScalerContext::~SkGScalerContext() {
- SkDELETE(fProxy);
-}
+SkGScalerContext::~SkGScalerContext() { delete fProxy; }
unsigned SkGScalerContext::generateGlyphCount() {
return fProxy->getGlyphCount();
@@ -168,7 +166,7 @@
SkScalerContext* SkGTypeface::onCreateScalerContext(
const SkDescriptor* desc) const {
- return SkNEW_ARGS(SkGScalerContext, (const_cast<SkGTypeface*>(this), desc));
+ return new SkGScalerContext(const_cast<SkGTypeface*>(this), desc);
}
void SkGTypeface::onFilterRec(SkScalerContextRec* rec) const {
diff --git a/src/fonts/SkRandomScalerContext.cpp b/src/fonts/SkRandomScalerContext.cpp
index 799e51d..1f6fbe0 100644
--- a/src/fonts/SkRandomScalerContext.cpp
+++ b/src/fonts/SkRandomScalerContext.cpp
@@ -43,9 +43,7 @@
fProxy = face->proxy()->createScalerContext(desc);
}
-SkRandomScalerContext::~SkRandomScalerContext() {
- SkDELETE(fProxy);
-}
+SkRandomScalerContext::~SkRandomScalerContext() { delete fProxy; }
unsigned SkRandomScalerContext::generateGlyphCount() {
return fProxy->getGlyphCount();
@@ -201,7 +199,7 @@
SkScalerContext* SkRandomTypeface::onCreateScalerContext(
const SkDescriptor* desc) const {
- return SkNEW_ARGS(SkRandomScalerContext, (const_cast<SkRandomTypeface*>(this), desc, fFakeIt));
+ return new SkRandomScalerContext(const_cast<SkRandomTypeface*>(this), desc, fFakeIt);
}
void SkRandomTypeface::onFilterRec(SkScalerContextRec* rec) const {
diff --git a/src/fonts/SkRemotableFontMgr.cpp b/src/fonts/SkRemotableFontMgr.cpp
index 3681f2c..5299fad 100644
--- a/src/fonts/SkRemotableFontMgr.cpp
+++ b/src/fonts/SkRemotableFontMgr.cpp
@@ -18,7 +18,7 @@
// As a template argument, this must have external linkage.
SkRemotableFontIdentitySet* sk_remotable_font_identity_set_new() {
- return SkNEW(SkRemotableFontIdentitySet);
+ return new SkRemotableFontIdentitySet;
}
SK_DECLARE_STATIC_LAZY_PTR(SkRemotableFontIdentitySet, empty, sk_remotable_font_identity_set_new);
diff --git a/src/fonts/SkTestScalerContext.cpp b/src/fonts/SkTestScalerContext.cpp
index 8038b03..ee78381 100644
--- a/src/fonts/SkTestScalerContext.cpp
+++ b/src/fonts/SkTestScalerContext.cpp
@@ -35,9 +35,9 @@
SkTestFont::~SkTestFont() {
for (unsigned index = 0; index < fCharCodesCount; ++index) {
- SkDELETE(fPaths[index]);
+ delete fPaths[index];
}
- SkDELETE_ARRAY(fPaths);
+ delete[] fPaths;
}
#ifdef SK_DEBUG
@@ -78,9 +78,9 @@
}
void SkTestFont::init(const SkScalar* pts, const unsigned char* verbs) {
- fPaths = SkNEW_ARRAY(SkPath*, fCharCodesCount);
+ fPaths = new SkPath* [fCharCodesCount];
for (unsigned index = 0; index < fCharCodesCount; ++index) {
- SkPath* path = SkNEW(SkPath);
+ SkPath* path = new SkPath;
SkPath::Verb verb;
while ((verb = (SkPath::Verb) *verbs++) != SkPath::kDone_Verb) {
switch (verb) {
@@ -280,5 +280,5 @@
};
SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkDescriptor* desc) const {
- return SkNEW_ARGS(SkTestScalerContext, (const_cast<SkTestTypeface*>(this), desc));
+ return new SkTestScalerContext(const_cast<SkTestTypeface*>(this), desc);
}
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index 0eabe66..668a09a 100644
--- a/src/gpu/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/GrAAConvexPathRenderer.cpp
@@ -528,7 +528,7 @@
static GrGeometryProcessor* Create(GrColor color, const SkMatrix& localMatrix,
bool usesLocalCoords) {
- return SkNEW_ARGS(QuadEdgeEffect, (color, localMatrix, usesLocalCoords));
+ return new QuadEdgeEffect(color, localMatrix, usesLocalCoords);
}
virtual ~QuadEdgeEffect() {}
@@ -642,7 +642,7 @@
virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const override {
- return SkNEW_ARGS(GLProcessor, (*this, bt));
+ return new GLProcessor(*this, bt);
}
private:
@@ -747,9 +747,7 @@
SkPath fPath;
};
- static GrDrawBatch* Create(const Geometry& geometry) {
- return SkNEW_ARGS(AAConvexPathBatch, (geometry));
- }
+ static GrDrawBatch* Create(const Geometry& geometry) { return new AAConvexPathBatch(geometry); }
const char* name() const override { return "AAConvexBatch"; }
diff --git a/src/gpu/GrAAConvexTessellator.cpp b/src/gpu/GrAAConvexTessellator.cpp
index db10086..c111b8b 100644
--- a/src/gpu/GrAAConvexTessellator.cpp
+++ b/src/gpu/GrAAConvexTessellator.cpp
@@ -408,7 +408,7 @@
GrAAConvexTessellator::Ring* GrAAConvexTessellator::getNextRing(Ring* lastRing) {
#if GR_AA_CONVEX_TESSELLATOR_VIZ
- Ring* ring = *fRings.push() = SkNEW(Ring);
+ Ring* ring = *fRings.push() = new Ring;
ring->setReserve(fInitialRing.numPts());
ring->rewind();
return ring;
diff --git a/src/gpu/GrAADistanceFieldPathRenderer.cpp b/src/gpu/GrAADistanceFieldPathRenderer.cpp
old mode 100755
new mode 100644
index 905bde9..7a51149
--- a/src/gpu/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/GrAADistanceFieldPathRenderer.cpp
@@ -53,7 +53,7 @@
if (id == pathData->fID) {
dfpr->fPathCache.remove(pathData->fKey);
dfpr->fPathList.remove(pathData);
- SkDELETE(pathData);
+ delete pathData;
#ifdef DF_PATH_TRACKING
++g_NumFreedPaths;
#endif
@@ -71,9 +71,9 @@
while ((pathData = iter.get())) {
iter.next();
fPathList.remove(pathData);
- SkDELETE(pathData);
+ delete pathData;
}
- SkDELETE(fAtlas);
+ delete fAtlas;
#ifdef DF_PATH_TRACKING
SkDebugf("Cached paths: %d, freed paths: %d\n", g_NumCachedPaths, g_NumFreedPaths);
@@ -125,8 +125,8 @@
static GrDrawBatch* Create(const Geometry& geometry, GrColor color, const SkMatrix& viewMatrix,
GrBatchAtlas* atlas, PathCache* pathCache, PathDataList* pathList) {
- return SkNEW_ARGS(AADistanceFieldPathBatch, (geometry, color, viewMatrix,
- atlas, pathCache, pathList));
+ return new AADistanceFieldPathBatch(geometry, color, viewMatrix, atlas, pathCache,
+ pathList);
}
const char* name() const override { return "AADistanceFieldPathBatch"; }
@@ -231,10 +231,10 @@
if (args.fPathData) {
fPathCache->remove(args.fPathData->fKey);
fPathList->remove(args.fPathData);
- SkDELETE(args.fPathData);
+ delete args.fPathData;
}
SkScalar scale = desiredDimension/maxDim;
- args.fPathData = SkNEW(PathData);
+ args.fPathData = new PathData;
if (!this->addPathToAtlas(target,
dfProcessor,
this->pipeline(),
@@ -568,9 +568,9 @@
while ((pathData = iter.get())) {
iter.next();
fPathList.remove(pathData);
- SkDELETE(pathData);
+ delete pathData;
}
- SkDELETE(fAtlas);
+ delete fAtlas;
fPathCache.reset();
}
@@ -585,7 +585,7 @@
if (id == pathData->fID) {
dfpr->fPathCache.remove(pathData->fKey);
dfpr->fPathList.remove(pathData);
- SkDELETE(pathData);
+ delete pathData;
}
}
}
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp
index 02ff48e..f2f9563 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -680,9 +680,7 @@
SkIRect fDevClipBounds;
};
- static GrDrawBatch* Create(const Geometry& geometry) {
- return SkNEW_ARGS(AAHairlineBatch, (geometry));
- }
+ static GrDrawBatch* Create(const Geometry& geometry) { return new AAHairlineBatch(geometry); }
const char* name() const override { return "AAHairlineBatch"; }
diff --git a/src/gpu/GrAAHairLinePathRenderer.h b/src/gpu/GrAAHairLinePathRenderer.h
index f9fa920..61c0606 100644
--- a/src/gpu/GrAAHairLinePathRenderer.h
+++ b/src/gpu/GrAAHairLinePathRenderer.h
@@ -13,7 +13,7 @@
class GrAAHairLinePathRenderer : public GrPathRenderer {
public:
- static GrPathRenderer* Create() { return SkNEW(GrAAHairLinePathRenderer); }
+ static GrPathRenderer* Create() { return new GrAAHairLinePathRenderer; }
typedef SkTArray<SkPoint, true> PtArray;
typedef SkTArray<int, true> IntArray;
diff --git a/src/gpu/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/GrAALinearizingConvexPathRenderer.cpp
index db9e91c..d05fe4e 100644
--- a/src/gpu/GrAALinearizingConvexPathRenderer.cpp
+++ b/src/gpu/GrAALinearizingConvexPathRenderer.cpp
@@ -129,7 +129,7 @@
};
static GrDrawBatch* Create(const Geometry& geometry) {
- return SkNEW_ARGS(AAFlatteningConvexPathBatch, (geometry));
+ return new AAFlatteningConvexPathBatch(geometry);
}
const char* name() const override { return "AAConvexBatch"; }
diff --git a/src/gpu/GrAddPathRenderers_default.cpp b/src/gpu/GrAddPathRenderers_default.cpp
index 77a26d3..9ba6256 100644
--- a/src/gpu/GrAddPathRenderers_default.cpp
+++ b/src/gpu/GrAddPathRenderers_default.cpp
@@ -18,17 +18,17 @@
#include "GrTessellatingPathRenderer.h"
void GrPathRenderer::AddPathRenderers(GrContext* ctx, GrPathRendererChain* chain) {
- chain->addPathRenderer(SkNEW(GrDashLinePathRenderer))->unref();
+ chain->addPathRenderer(new GrDashLinePathRenderer)->unref();
if (GrPathRenderer* pr = GrStencilAndCoverPathRenderer::Create(ctx->resourceProvider(),
*ctx->caps())) {
chain->addPathRenderer(pr)->unref();
}
- chain->addPathRenderer(SkNEW(GrTessellatingPathRenderer))->unref();
+ chain->addPathRenderer(new GrTessellatingPathRenderer)->unref();
if (GrPathRenderer* pr = GrAAHairLinePathRenderer::Create()) {
chain->addPathRenderer(pr)->unref();
}
- chain->addPathRenderer(SkNEW(GrAAConvexPathRenderer))->unref();
- chain->addPathRenderer(SkNEW(GrAALinearizingConvexPathRenderer))->unref();
- chain->addPathRenderer(SkNEW(GrAADistanceFieldPathRenderer))->unref();
+ chain->addPathRenderer(new GrAAConvexPathRenderer)->unref();
+ chain->addPathRenderer(new GrAALinearizingConvexPathRenderer)->unref();
+ chain->addPathRenderer(new GrAADistanceFieldPathRenderer)->unref();
}
diff --git a/src/gpu/GrAllocator.h b/src/gpu/GrAllocator.h
index 861c3cb..64f6533 100644
--- a/src/gpu/GrAllocator.h
+++ b/src/gpu/GrAllocator.h
@@ -247,14 +247,14 @@
T& push_back() {
void* item = fAllocator.push_back();
SkASSERT(item);
- SkNEW_PLACEMENT(item, T);
+ new (item) T;
return *(T*)item;
}
T& push_back(const T& t) {
void* item = fAllocator.push_back();
SkASSERT(item);
- SkNEW_PLACEMENT_ARGS(item, T, (t));
+ new (item) T(t);
return *(T*)item;
}
diff --git a/src/gpu/GrAtlas.cpp b/src/gpu/GrAtlas.cpp
index 0322f70..e280302 100644
--- a/src/gpu/GrAtlas.cpp
+++ b/src/gpu/GrAtlas.cpp
@@ -33,7 +33,7 @@
}
GrPlot::~GrPlot() {
- SkDELETE_ARRAY(fPlotData);
+ delete[] fPlotData;
fPlotData = NULL;
delete fRects;
}
@@ -67,7 +67,7 @@
int plotWidth = fRects->width();
int plotHeight = fRects->height();
if (fBatchUploads && NULL == fPlotData && 0.0f == percentFull) {
- fPlotData = SkNEW_ARRAY(unsigned char, fBytesPerPixel*plotWidth*plotHeight);
+ fPlotData = new unsigned char[fBytesPerPixel * plotWidth * plotHeight];
memset(fPlotData, 0, fBytesPerPixel*plotWidth*plotHeight);
}
@@ -138,7 +138,7 @@
// set up allocated plots
size_t bpp = GrBytesPerPixel(fPixelConfig);
- fPlotArray = SkNEW_ARRAY(GrPlot, (fNumPlotsX*fNumPlotsY));
+ fPlotArray = new GrPlot[(fNumPlotsX * fNumPlotsY)];
GrPlot* currPlot = fPlotArray;
for (int y = numPlotsY-1; y >= 0; --y) {
@@ -154,7 +154,7 @@
GrAtlas::~GrAtlas() {
SkSafeUnref(fTexture);
- SkDELETE_ARRAY(fPlotArray);
+ delete[] fPlotArray;
fGpu->unref();
#if FONT_CACHE_STATS
diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp
index cbcfd65..61cd2a1 100644
--- a/src/gpu/GrAtlasTextContext.cpp
+++ b/src/gpu/GrAtlasTextContext.cpp
@@ -99,8 +99,7 @@
GrAtlasTextContext::GrAtlasTextContext(GrContext* context,
GrDrawContext* drawContext,
const SkSurfaceProps& surfaceProps)
- : INHERITED(context, drawContext, surfaceProps)
- , fDistanceAdjustTable(SkNEW(DistanceAdjustTable)) {
+ : INHERITED(context, drawContext, surfaceProps), fDistanceAdjustTable(new DistanceAdjustTable) {
// We overallocate vertices in our textblobs based on the assumption that A8 has the greatest
// vertexStride
static_assert(kGrayTextVASize >= kColorTextVASize && kGrayTextVASize >= kLCDTextVASize,
@@ -161,7 +160,7 @@
&width, &height);
SkASSERT(kExpectedDistanceAdjustTableSize == height);
- fTable = SkNEW_ARRAY(SkScalar, height);
+ fTable = new SkScalar[height];
SkAutoTArray<uint8_t> data((int)size);
SkScalerContext::GetGammaLUTData(contrast, paintGamma, deviceGamma, data.get());
@@ -194,7 +193,7 @@
GrAtlasTextContext* GrAtlasTextContext::Create(GrContext* context,
GrDrawContext* drawContext,
const SkSurfaceProps& surfaceProps) {
- return SkNEW_ARGS(GrAtlasTextContext, (context, drawContext, surfaceProps));
+ return new GrAtlasTextContext(context, drawContext, surfaceProps);
}
bool GrAtlasTextContext::canDraw(const GrRenderTarget*,
@@ -680,7 +679,7 @@
Run& run = blob->fRuns[runIndex];
// Push back a new subrun to fill and set the override descriptor
run.push_back();
- run.fOverrideDescriptor.reset(SkNEW(SkAutoDescriptor));
+ run.fOverrideDescriptor.reset(new SkAutoDescriptor);
skPaint.getScalerContextDescriptor(run.fOverrideDescriptor,
fSurfaceProps, &viewMatrix, false);
SkGlyphCache* cache = SkGlyphCache::DetachCache(run.fTypeface,
@@ -1371,7 +1370,7 @@
return;
}
- glyph->fPath = SkNEW_ARGS(SkPath, (*glyphPath));
+ glyph->fPath = new SkPath(*glyphPath);
}
blob->fBigGlyphs.push_back(GrAtlasTextBlob::BigGlyph(*glyph->fPath, x, y, scale, applyVM));
}
@@ -1456,7 +1455,7 @@
static TextBatch* CreateBitmap(GrMaskFormat maskFormat, int glyphCount,
GrBatchFontCache* fontCache) {
- TextBatch* batch = SkNEW(TextBatch);
+ TextBatch* batch = new TextBatch;
batch->initClassID<TextBatch>();
batch->fFontCache = fontCache;
@@ -1483,7 +1482,7 @@
DistanceAdjustTable* distanceAdjustTable,
SkColor filteredColor, bool isLCD,
bool useBGR) {
- TextBatch* batch = SkNEW(TextBatch);
+ TextBatch* batch = new TextBatch;
batch->initClassID<TextBatch>();
batch->fFontCache = fontCache;
batch->fMaskType = isLCD ? kLCDDistanceField_MaskType : kGrayscaleDistanceField_MaskType;
@@ -2237,7 +2236,7 @@
if (context->uniqueID() != gContextID) {
gContextID = context->uniqueID();
- SkDELETE(gTextContext);
+ delete gTextContext;
// We don't yet test the fall back to paths in the GrTextContext base class. This is mostly
// because we don't really want to have a gpu device here.
diff --git a/src/gpu/GrAtlasTextContext.h b/src/gpu/GrAtlasTextContext.h
index 4eeb42c..3bb75b8 100644
--- a/src/gpu/GrAtlasTextContext.h
+++ b/src/gpu/GrAtlasTextContext.h
@@ -167,7 +167,7 @@
// refcnted and malloced
struct DistanceAdjustTable : public SkNVRefCnt<DistanceAdjustTable> {
DistanceAdjustTable() { this->buildDistanceAdjustTable(); }
- ~DistanceAdjustTable() { SkDELETE_ARRAY(fTable); }
+ ~DistanceAdjustTable() { delete[] fTable; }
const SkScalar& operator[] (int i) const {
return fTable[i];
diff --git a/src/gpu/GrBatchAtlas.cpp b/src/gpu/GrBatchAtlas.cpp
index f75df8b..1607ed1 100644
--- a/src/gpu/GrBatchAtlas.cpp
+++ b/src/gpu/GrBatchAtlas.cpp
@@ -234,13 +234,13 @@
// set up allocated plots
fBPP = GrBytesPerPixel(texture->desc().fConfig);
- fPlotArray = SkNEW_ARRAY(SkAutoTUnref<BatchPlot>, (fNumPlotsX * fNumPlotsY));
+ fPlotArray = new SkAutoTUnref<BatchPlot>[(fNumPlotsX * fNumPlotsY)];
SkAutoTUnref<BatchPlot>* currPlot = fPlotArray;
for (int y = fNumPlotsY - 1, r = 0; y >= 0; --y, ++r) {
for (int x = fNumPlotsX - 1, c = 0; x >= 0; --x, ++c) {
uint32_t id = r * fNumPlotsX + c;
- currPlot->reset(SkNEW(BatchPlot));
+ currPlot->reset(new BatchPlot);
(*currPlot)->init(this, texture, id, 1, x, y, fPlotWidth, fPlotHeight, fBPP);
// build LRU list
@@ -252,7 +252,7 @@
GrBatchAtlas::~GrBatchAtlas() {
SkSafeUnref(fTexture);
- SkDELETE_ARRAY(fPlotArray);
+ delete[] fPlotArray;
}
void GrBatchAtlas::processEviction(AtlasID id) {
@@ -278,7 +278,7 @@
// This new update will piggy back on that previously scheduled update.
if (target->hasTokenBeenFlushed(plot->lastUploadToken())) {
plot->setLastUploadToken(target->asapToken());
- SkAutoTUnref<GrPlotUploader> uploader(SkNEW_ARGS(GrPlotUploader, (plot)));
+ SkAutoTUnref<GrPlotUploader> uploader(new GrPlotUploader(plot));
target->upload(uploader);
}
*id = plot->id();
@@ -338,14 +338,14 @@
this->processEviction(plot->id());
fPlotList.remove(plot);
SkAutoTUnref<BatchPlot>& newPlot = fPlotArray[plot->index()];
- newPlot.reset(SkNEW(BatchPlot));
+ newPlot.reset(new BatchPlot);
newPlot->init(this, fTexture, index, ++generation, x, y, fPlotWidth, fPlotHeight, fBPP);
fPlotList.addToHead(newPlot.get());
SkDEBUGCODE(bool verify = )newPlot->addSubImage(width, height, image, loc, fBPP * width);
SkASSERT(verify);
newPlot->setLastUploadToken(batchTarget->currentToken());
- SkAutoTUnref<GrPlotUploader> uploader(SkNEW_ARGS(GrPlotUploader, (newPlot)));
+ SkAutoTUnref<GrPlotUploader> uploader(new GrPlotUploader(newPlot));
batchTarget->upload(uploader);
*id = newPlot->id();
plot->unref();
diff --git a/src/gpu/GrBatchFontCache.cpp b/src/gpu/GrBatchFontCache.cpp
index 30dd0b6..e8c2183 100644
--- a/src/gpu/GrBatchFontCache.cpp
+++ b/src/gpu/GrBatchFontCache.cpp
@@ -70,7 +70,7 @@
++iter;
}
for (int i = 0; i < kMaskFormatCount; ++i) {
- SkDELETE(fAtlases[i]);
+ delete fAtlases[i];
}
}
@@ -83,7 +83,7 @@
}
fCache.rewind();
for (int i = 0; i < kMaskFormatCount; ++i) {
- SkDELETE(fAtlases[i]);
+ delete fAtlases[i];
fAtlases[i] = NULL;
}
}
@@ -130,7 +130,7 @@
// flush
for (int i = 0; i < kMaskFormatCount; i++) {
if (fAtlases[i]) {
- SkDELETE(fAtlases[i]);
+ delete fAtlases[i];
fAtlases[i] = NULL;
}
}
diff --git a/src/gpu/GrBatchFontCache.h b/src/gpu/GrBatchFontCache.h
index 32c3281..5d57221 100644
--- a/src/gpu/GrBatchFontCache.h
+++ b/src/gpu/GrBatchFontCache.h
@@ -200,7 +200,7 @@
bool initAtlas(GrMaskFormat);
GrBatchTextStrike* generateStrike(GrFontScaler* scaler) {
- GrBatchTextStrike* strike = SkNEW_ARGS(GrBatchTextStrike, (this, scaler->getKey()));
+ GrBatchTextStrike* strike = new GrBatchTextStrike(this, scaler->getKey());
fCache.add(strike);
return strike;
}
diff --git a/src/gpu/GrBufferedDrawTarget.h b/src/gpu/GrBufferedDrawTarget.h
index f11a9d8..82421ab 100644
--- a/src/gpu/GrBufferedDrawTarget.h
+++ b/src/gpu/GrBufferedDrawTarget.h
@@ -62,7 +62,7 @@
StateForPathDraw* allocState(const GrPrimitiveProcessor* primProc = NULL) {
void* allocation = fPipelineBuffer.alloc(sizeof(StateForPathDraw),
SkChunkAlloc::kThrow_AllocFailType);
- return SkNEW_PLACEMENT_ARGS(allocation, StateForPathDraw, (primProc));
+ return new (allocation) StateForPathDraw(primProc);
}
void unallocState(StateForPathDraw* state) {
diff --git a/src/gpu/GrClipMaskCache.cpp b/src/gpu/GrClipMaskCache.cpp
index a21eab7..42a5d46 100644
--- a/src/gpu/GrClipMaskCache.cpp
+++ b/src/gpu/GrClipMaskCache.cpp
@@ -13,9 +13,7 @@
, fResourceProvider(resourceProvider) {
// We need an initial frame to capture the clip state prior to
// any pushes
- SkNEW_PLACEMENT(fStack.push_back(), GrClipStackFrame);
+ new (fStack.push_back()) GrClipStackFrame;
}
-void GrClipMaskCache::push() {
- SkNEW_PLACEMENT(fStack.push_back(), GrClipStackFrame);
-}
+void GrClipMaskCache::push() { new (fStack.push_back()) GrClipStackFrame; }
diff --git a/src/gpu/GrCommandBuilder.cpp b/src/gpu/GrCommandBuilder.cpp
index 3a88ceb..abc6954 100644
--- a/src/gpu/GrCommandBuilder.cpp
+++ b/src/gpu/GrCommandBuilder.cpp
@@ -12,8 +12,8 @@
GrCommandBuilder* GrCommandBuilder::Create(GrGpu* gpu, bool reorder) {
if (reorder) {
- return SkNEW(GrReorderCommandBuilder);
+ return new GrReorderCommandBuilder;
} else {
- return SkNEW(GrInOrderCommandBuilder);
+ return new GrInOrderCommandBuilder;
}
}
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
old mode 100755
new mode 100644
index 2f334c6..3a1ca13
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -64,9 +64,9 @@
fContext = context;
#ifdef IMMEDIATE_MODE
- fDrawTarget = SkNEW_ARGS(GrImmediateDrawTarget, (context));
+ fDrawTarget = new GrImmediateDrawTarget(context);
#else
- fDrawTarget = SkNEW_ARGS(GrBufferedDrawTarget, (context));
+ fDrawTarget = new GrBufferedDrawTarget(context);
#endif
}
@@ -122,7 +122,7 @@
SkASSERT(props.pixelGeometry() < kNumPixelGeometries);
if (!fDrawContext[props.pixelGeometry()][props.isUseDistanceFieldFonts()]) {
fDrawContext[props.pixelGeometry()][props.isUseDistanceFieldFonts()] =
- SkNEW_ARGS(GrDrawContext, (fContext, fDrawTarget, props));
+ new GrDrawContext(fContext, fDrawTarget, props);
}
return fDrawContext[props.pixelGeometry()][props.isUseDistanceFieldFonts()];
@@ -138,7 +138,7 @@
GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext,
const GrContextOptions& options) {
- GrContext* context = SkNEW(GrContext);
+ GrContext* context = new GrContext;
if (context->init(backend, backendContext, options)) {
return context;
@@ -182,20 +182,20 @@
void GrContext::initCommon() {
fCaps = SkRef(fGpu->caps());
- fResourceCache = SkNEW_ARGS(GrResourceCache, (fCaps));
+ fResourceCache = new GrResourceCache(fCaps);
fResourceCache->setOverBudgetCallback(OverBudgetCB, this);
- fResourceProvider = SkNEW_ARGS(GrResourceProvider, (fGpu, fResourceCache));
+ fResourceProvider = new GrResourceProvider(fGpu, fResourceCache);
- fLayerCache.reset(SkNEW_ARGS(GrLayerCache, (this)));
+ fLayerCache.reset(new GrLayerCache(this));
fDidTestPMConversions = false;
fDrawingMgr.init(this);
// GrBatchFontCache will eventually replace GrFontCache
- fBatchFontCache = SkNEW_ARGS(GrBatchFontCache, (this));
+ fBatchFontCache = new GrBatchFontCache(this);
- fTextBlobCache.reset(SkNEW_ARGS(GrTextBlobCache, (TextBlobCacheOverBudgetCB, this)));
+ fTextBlobCache.reset(new GrTextBlobCache(TextBlobCacheOverBudgetCB, this));
}
GrContext::~GrContext() {
@@ -212,9 +212,9 @@
(*fCleanUpData[i].fFunc)(this, fCleanUpData[i].fInfo);
}
- SkDELETE(fResourceProvider);
- SkDELETE(fResourceCache);
- SkDELETE(fBatchFontCache);
+ delete fResourceProvider;
+ delete fResourceCache;
+ delete fBatchFontCache;
fGpu->unref();
fCaps->unref();
@@ -645,7 +645,7 @@
GrPathRendererChain::StencilSupport* stencilSupport) {
if (!fPathRendererChain) {
- fPathRendererChain = SkNEW_ARGS(GrPathRendererChain, (this));
+ fPathRendererChain = new GrPathRendererChain(this);
}
GrPathRenderer* pr = fPathRendererChain->getPathRenderer(target,
@@ -658,7 +658,7 @@
if (!pr && allowSW) {
if (!fSoftwarePathRenderer) {
- fSoftwarePathRenderer = SkNEW_ARGS(GrSoftwarePathRenderer, (this));
+ fSoftwarePathRenderer = new GrSoftwarePathRenderer(this);
}
pr = fSoftwarePathRenderer;
}
diff --git a/src/gpu/GrDefaultGeoProcFactory.cpp b/src/gpu/GrDefaultGeoProcFactory.cpp
index f8d30f8..d3363ef 100644
--- a/src/gpu/GrDefaultGeoProcFactory.cpp
+++ b/src/gpu/GrDefaultGeoProcFactory.cpp
@@ -33,13 +33,8 @@
bool localCoordsWillBeRead,
bool coverageWillBeIgnored,
uint8_t coverage) {
- return SkNEW_ARGS(DefaultGeoProc, (gpTypeFlags,
- color,
- viewMatrix,
- localMatrix,
- coverage,
- localCoordsWillBeRead,
- coverageWillBeIgnored));
+ return new DefaultGeoProc(gpTypeFlags, color, viewMatrix, localMatrix, coverage,
+ localCoordsWillBeRead, coverageWillBeIgnored);
}
const char* name() const override { return "DefaultGeometryProcessor"; }
@@ -188,7 +183,7 @@
virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const override {
- return SkNEW_ARGS(GLProcessor, (*this, bt));
+ return new GLProcessor(*this, bt);
}
private:
diff --git a/src/gpu/GrDefaultPathRenderer.cpp b/src/gpu/GrDefaultPathRenderer.cpp
index 8112232..cf3f0d3 100644
--- a/src/gpu/GrDefaultPathRenderer.cpp
+++ b/src/gpu/GrDefaultPathRenderer.cpp
@@ -220,8 +220,7 @@
static GrDrawBatch* Create(const Geometry& geometry, uint8_t coverage,
const SkMatrix& viewMatrix, bool isHairline,
const SkRect& devBounds) {
- return SkNEW_ARGS(DefaultPathBatch, (geometry, coverage, viewMatrix, isHairline,
- devBounds));
+ return new DefaultPathBatch(geometry, coverage, viewMatrix, isHairline, devBounds);
}
const char* name() const override { return "DefaultPathBatch"; }
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp
index 445a661..7a508c7 100644
--- a/src/gpu/GrDrawContext.cpp
+++ b/src/gpu/GrDrawContext.cpp
@@ -46,7 +46,7 @@
GrDrawContext::~GrDrawContext() {
SkSafeUnref(fDrawTarget);
- SkDELETE(fTextContext);
+ delete fTextContext;
}
void GrDrawContext::copySurface(GrRenderTarget* dst, GrSurface* src,
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 98c7587..805cfaf 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -380,7 +380,7 @@
this->drawNonAARect(pipelineBuilder, color, SkMatrix::I(), *rect);
} else {
- GrBatch* batch = SkNEW_ARGS(GrClearBatch, (*rect, color, renderTarget));
+ GrBatch* batch = new GrClearBatch(*rect, color, renderTarget);
this->onDrawBatch(batch);
batch->unref();
}
@@ -388,7 +388,7 @@
void GrDrawTarget::discard(GrRenderTarget* renderTarget) {
if (this->caps()->discardRenderTargetSupport()) {
- GrBatch* batch = SkNEW_ARGS(GrDiscardBatch, (renderTarget));
+ GrBatch* batch = new GrDiscardBatch(renderTarget);
this->onDrawBatch(batch);
batch->unref();
}
@@ -484,7 +484,7 @@
GrClipTarget::GrClipTarget(GrContext* context)
: INHERITED(context->getGpu(), context->resourceProvider())
, fContext(context) {
- fClipMaskManager.reset(SkNEW_ARGS(GrClipMaskManager, (this)));
+ fClipMaskManager.reset(new GrClipMaskManager(this));
}
@@ -507,7 +507,7 @@
};
void GrClipTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTarget* rt) {
- GrBatch* batch = SkNEW_ARGS(GrClearStencilClipBatch, (rect, insideClip, rt));
+ GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt);
this->onDrawBatch(batch);
batch->unref();
}
diff --git a/src/gpu/GrFontScaler.cpp b/src/gpu/GrFontScaler.cpp
index 8c0e0e6..d923c7d 100644
--- a/src/gpu/GrFontScaler.cpp
+++ b/src/gpu/GrFontScaler.cpp
@@ -41,7 +41,7 @@
const GrFontDescKey* GrFontScaler::getKey() {
if (NULL == fKey) {
- fKey = SkNEW_ARGS(GrFontDescKey, (fStrike->getDescriptor()));
+ fKey = new GrFontDescKey(fStrike->getDescriptor());
}
return fKey;
}
diff --git a/src/gpu/GrGpuResource.cpp b/src/gpu/GrGpuResource.cpp
index 49212df..53782a7 100644
--- a/src/gpu/GrGpuResource.cpp
+++ b/src/gpu/GrGpuResource.cpp
@@ -109,7 +109,7 @@
void GrGpuResource::notifyAllCntsAreZero(CntType lastCntTypeToReachZero) const {
if (this->wasDestroyed()) {
// We've already been removed from the cache. Goodbye cruel world!
- SkDELETE(this);
+ delete this;
return;
}
diff --git a/src/gpu/GrGpuResourceCacheAccess.h b/src/gpu/GrGpuResourceCacheAccess.h
index 611d43b..8c27242 100644
--- a/src/gpu/GrGpuResourceCacheAccess.h
+++ b/src/gpu/GrGpuResourceCacheAccess.h
@@ -52,8 +52,8 @@
*/
void release() {
fResource->release();
- if (fResource->isPurgeable()) {
- SkDELETE(fResource);
+ if (fResource->isPurgeable()) {
+ delete fResource;
}
}
@@ -62,8 +62,8 @@
*/
void abandon() {
fResource->abandon();
- if (fResource->isPurgeable()) {
- SkDELETE(fResource);
+ if (fResource->isPurgeable()) {
+ delete fResource;
}
}
diff --git a/src/gpu/GrLayerCache.cpp b/src/gpu/GrLayerCache.cpp
index 4a20607..e894c30 100644
--- a/src/gpu/GrLayerCache.cpp
+++ b/src/gpu/GrLayerCache.cpp
@@ -90,7 +90,7 @@
GrCachedLayer* layer = &(*iter);
SkASSERT(0 == layer->uses());
this->unlock(layer);
- SkDELETE(layer);
+ delete layer;
}
SkASSERT(0 == fPictureHash.count());
@@ -104,9 +104,9 @@
GR_STATIC_ASSERT(kNumPlotsX*kNumPlotsX == GrPictureInfo::kNumPlots);
SkISize textureSize = SkISize::Make(kAtlasTextureWidth, kAtlasTextureHeight);
- fAtlas.reset(SkNEW_ARGS(GrAtlas, (fContext->getGpu(), kSkia8888_GrPixelConfig,
- kRenderTarget_GrSurfaceFlag,
- textureSize, kNumPlotsX, kNumPlotsY, false)));
+ fAtlas.reset(new GrAtlas(fContext->getGpu(), kSkia8888_GrPixelConfig,
+ kRenderTarget_GrSurfaceFlag, textureSize, kNumPlotsX, kNumPlotsY,
+ false));
}
void GrLayerCache::freeAll() {
@@ -115,7 +115,7 @@
for (; !iter.done(); ++iter) {
GrCachedLayer* layer = &(*iter);
this->unlock(layer);
- SkDELETE(layer);
+ delete layer;
}
fLayerHash.rewind();
@@ -133,9 +133,8 @@
const SkPaint* paint) {
SkASSERT(pictureID != SK_InvalidGenID && start >= 0 && stop > 0);
- GrCachedLayer* layer = SkNEW_ARGS(GrCachedLayer, (pictureID, start, stop,
- srcIR, dstIR, initialMat,
- key, keySize, paint));
+ GrCachedLayer* layer = new GrCachedLayer(pictureID, start, stop, srcIR, dstIR, initialMat, key,
+ keySize, paint);
fLayerHash.add(layer);
return layer;
}
@@ -200,7 +199,7 @@
// Not in the atlas - will it fit?
GrPictureInfo* pictInfo = fPictureHash.find(layer->pictureID());
if (NULL == pictInfo) {
- pictInfo = SkNEW_ARGS(GrPictureInfo, (layer->pictureID()));
+ pictInfo = new GrPictureInfo(layer->pictureID());
fPictureHash.add(pictInfo);
}
@@ -235,7 +234,7 @@
if (pictInfo->fPlotUsage.isEmpty()) {
fPictureHash.remove(pictInfo->fPictureID);
- SkDELETE(pictInfo);
+ delete pictInfo;
}
}
@@ -295,7 +294,7 @@
if (pictInfo->fPlotUsage.isEmpty()) {
fPictureHash.remove(pictInfo->fPictureID);
- SkDELETE(pictInfo);
+ delete pictInfo;
}
}
@@ -380,13 +379,13 @@
SkASSERT(0 == toBeRemoved[i]->uses());
this->unlock(toBeRemoved[i]);
fLayerHash.remove(GrCachedLayer::GetKey(*toBeRemoved[i]));
- SkDELETE(toBeRemoved[i]);
+ delete toBeRemoved[i];
}
GrPictureInfo* pictInfo = fPictureHash.find(pictureID);
if (pictInfo) {
fPictureHash.remove(pictureID);
- SkDELETE(pictInfo);
+ delete pictInfo;
}
}
@@ -431,7 +430,7 @@
// Aggressively remove layers and, if it becomes totally uncached, delete the picture info
fLayerHash.remove(GrCachedLayer::GetKey(*toBeRemoved[i]));
- SkDELETE(toBeRemoved[i]);
+ delete toBeRemoved[i];
GrPictureInfo* pictInfo = fPictureHash.find(pictureIDToRemove);
if (pictInfo) {
@@ -442,7 +441,7 @@
if (pictInfo->fPlotUsage.isEmpty()) {
fPictureHash.remove(pictInfo->fPictureID);
- SkDELETE(pictInfo);
+ delete pictInfo;
}
}
}
diff --git a/src/gpu/GrLayerCache.h b/src/gpu/GrLayerCache.h
index cf35de8..4ab0fa4 100644
--- a/src/gpu/GrLayerCache.h
+++ b/src/gpu/GrLayerCache.h
@@ -86,7 +86,7 @@
fIDMatrix.fInitialMat.getType(); // force initialization of type so hashes match
if (copyKey) {
- int* tempKey = SkNEW_ARRAY(int, keySize);
+ int* tempKey = new int[keySize];
memcpy(tempKey, key, keySize*sizeof(int));
fKey = tempKey;
} else {
@@ -100,7 +100,7 @@
~Key() {
if (fFreeKey) {
- SkDELETE_ARRAY(fKey);
+ delete[] fKey;
}
}
@@ -143,10 +143,14 @@
static uint32_t Hash(const Key& key) { return key.hash(); }
// GrCachedLayer proper
- GrCachedLayer(uint32_t pictureID, int start, int stop,
- const SkIRect& srcIR, const SkIRect& dstIR,
+ GrCachedLayer(uint32_t pictureID,
+ int start,
+ int stop,
+ const SkIRect& srcIR,
+ const SkIRect& dstIR,
const SkMatrix& ctm,
- const int* key, int keySize,
+ const int* key,
+ int keySize,
const SkPaint* paint)
: fKey(pictureID, ctm, key, keySize, true)
, fStart(start)
@@ -154,7 +158,7 @@
, fSrcIR(srcIR)
, fDstIR(dstIR)
, fOffset(SkIPoint::Make(0, 0))
- , fPaint(paint ? SkNEW_ARGS(SkPaint, (*paint)) : NULL)
+ , fPaint(paint ? new SkPaint(*paint) : NULL)
, fFilter(NULL)
, fTexture(NULL)
, fRect(SkIRect::MakeEmpty())
@@ -174,7 +178,7 @@
~GrCachedLayer() {
SkSafeUnref(fTexture);
SkSafeUnref(fFilter);
- SkDELETE(fPaint);
+ delete fPaint;
}
uint32_t pictureID() const { return fKey.pictureID(); }
diff --git a/src/gpu/GrLayerHoister.cpp b/src/gpu/GrLayerHoister.cpp
index e1aa72c..59a4da1 100644
--- a/src/gpu/GrLayerHoister.cpp
+++ b/src/gpu/GrLayerHoister.cpp
@@ -282,7 +282,7 @@
SkBitmap result;
result.setInfo(texture->surfacePriv().info(kPremul_SkAlphaType));
- result.setPixelRef(SkNEW_ARGS(SkGrPixelRef, (result.info(), texture)))->unref();
+ result.setPixelRef(new SkGrPixelRef(result.info(), texture))->unref();
return result;
}
diff --git a/src/gpu/GrNonAtomicRef.h b/src/gpu/GrNonAtomicRef.h
index 026e11d..efa2881 100644
--- a/src/gpu/GrNonAtomicRef.h
+++ b/src/gpu/GrNonAtomicRef.h
@@ -35,7 +35,7 @@
SkASSERT(fRefCnt > 0);
--fRefCnt;
if (0 == fRefCnt) {
- SkDELETE(this);
+ delete this;
return;
}
}
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index 2ad7e72..829f0ed 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -72,7 +72,7 @@
public:
static GrGeometryProcessor* Create(GrColor color, bool stroke, const SkMatrix& localMatrix,
bool usesLocalCoords) {
- return SkNEW_ARGS(CircleEdgeEffect, (color, stroke, localMatrix, usesLocalCoords));
+ return new CircleEdgeEffect(color, stroke, localMatrix, usesLocalCoords);
}
const Attribute* inPosition() const { return fInPosition; }
@@ -173,7 +173,7 @@
virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const override {
- return SkNEW_ARGS(GLProcessor, (*this, bt));
+ return new GLProcessor(*this, bt);
}
private:
@@ -224,7 +224,7 @@
public:
static GrGeometryProcessor* Create(GrColor color, bool stroke, const SkMatrix& localMatrix,
bool usesLocalCoords) {
- return SkNEW_ARGS(EllipseEdgeEffect, (color, stroke, localMatrix, usesLocalCoords));
+ return new EllipseEdgeEffect(color, stroke, localMatrix, usesLocalCoords);
}
virtual ~EllipseEdgeEffect() {}
@@ -349,7 +349,7 @@
virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const override {
- return SkNEW_ARGS(GLProcessor, (*this, bt));
+ return new GLProcessor(*this, bt);
}
private:
@@ -406,7 +406,7 @@
static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix, Mode mode,
bool usesLocalCoords) {
- return SkNEW_ARGS(DIEllipseEdgeEffect, (color, viewMatrix, mode, usesLocalCoords));
+ return new DIEllipseEdgeEffect(color, viewMatrix, mode, usesLocalCoords);
}
virtual ~DIEllipseEdgeEffect() {}
@@ -549,7 +549,7 @@
virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const override {
- return SkNEW_ARGS(GLProcessor, (*this, bt));
+ return new GLProcessor(*this, bt);
}
private:
@@ -636,9 +636,7 @@
SkRect fDevBounds;
};
- static GrDrawBatch* Create(const Geometry& geometry) {
- return SkNEW_ARGS(CircleBatch, (geometry));
- }
+ static GrDrawBatch* Create(const Geometry& geometry) { return new CircleBatch(geometry); }
const char* name() const override { return "CircleBatch"; }
@@ -855,9 +853,7 @@
SkRect fDevBounds;
};
- static GrDrawBatch* Create(const Geometry& geometry) {
- return SkNEW_ARGS(EllipseBatch, (geometry));
- }
+ static GrDrawBatch* Create(const Geometry& geometry) { return new EllipseBatch(geometry); }
const char* name() const override { return "EllipseBatch"; }
@@ -1124,7 +1120,7 @@
};
static GrDrawBatch* Create(const Geometry& geometry, const SkRect& bounds) {
- return SkNEW_ARGS(DIEllipseBatch, (geometry, bounds));
+ return new DIEllipseBatch(geometry, bounds);
}
const char* name() const override { return "DIEllipseBatch"; }
@@ -1476,7 +1472,7 @@
};
static GrDrawBatch* Create(const Geometry& geometry) {
- return SkNEW_ARGS(RRectCircleRendererBatch, (geometry));
+ return new RRectCircleRendererBatch(geometry);
}
const char* name() const override { return "RRectCircleBatch"; }
@@ -1652,7 +1648,7 @@
};
static GrDrawBatch* Create(const Geometry& geometry) {
- return SkNEW_ARGS(RRectEllipseRendererBatch, (geometry));
+ return new RRectEllipseRendererBatch(geometry);
}
const char* name() const override { return "RRectEllipseRendererBatch"; }
diff --git a/src/gpu/GrPaint.cpp b/src/gpu/GrPaint.cpp
index 7427785..1e57525 100644
--- a/src/gpu/GrPaint.cpp
+++ b/src/gpu/GrPaint.cpp
@@ -17,8 +17,7 @@
: fAntiAlias(false)
, fDither(false)
, fColor(GrColor_WHITE)
- , fProcDataManager(SkNEW(GrProcessorDataManager)) {
-}
+ , fProcDataManager(new GrProcessorDataManager) {}
void GrPaint::setCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage) {
fXPFactory.reset(GrCoverageSetOpXPFactory::Create(regionOp, invertCoverage));
diff --git a/src/gpu/GrPathProcessor.cpp b/src/gpu/GrPathProcessor.cpp
index b372adc..3a5ab44 100644
--- a/src/gpu/GrPathProcessor.cpp
+++ b/src/gpu/GrPathProcessor.cpp
@@ -84,5 +84,5 @@
GrGLPrimitiveProcessor* GrPathProcessor::createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps& caps) const {
SkASSERT(caps.pathRenderingSupport());
- return SkNEW_ARGS(GrGLPathProcessor, (*this, bt));
+ return new GrGLPathProcessor(*this, bt);
}
diff --git a/src/gpu/GrPathProcessor.h b/src/gpu/GrPathProcessor.h
index 13b178f..57c5a8b 100644
--- a/src/gpu/GrPathProcessor.h
+++ b/src/gpu/GrPathProcessor.h
@@ -26,7 +26,7 @@
static GrPathProcessor* Create(GrColor color,
const SkMatrix& viewMatrix = SkMatrix::I(),
const SkMatrix& localMatrix = SkMatrix::I()) {
- return SkNEW_ARGS(GrPathProcessor, (color, viewMatrix, localMatrix));
+ return new GrPathProcessor(color, viewMatrix, localMatrix);
}
void initBatchTracker(GrBatchTracker*, const GrPipelineOptimizations&) const override;
diff --git a/src/gpu/GrPathRendererChain.cpp b/src/gpu/GrPathRendererChain.cpp
index f578851..62193f3 100644
--- a/src/gpu/GrPathRendererChain.cpp
+++ b/src/gpu/GrPathRendererChain.cpp
@@ -89,7 +89,6 @@
bool twoSided = caps->twoSidedStencilSupport();
bool wrapOp = caps->stencilWrapOpsSupport();
GrPathRenderer::AddPathRenderers(fOwner, this);
- this->addPathRenderer(SkNEW_ARGS(GrDefaultPathRenderer,
- (twoSided, wrapOp)))->unref();
+ this->addPathRenderer(new GrDefaultPathRenderer(twoSided, wrapOp))->unref();
fInit = true;
}
diff --git a/src/gpu/GrPathRendering.cpp b/src/gpu/GrPathRendering.cpp
index e97d754..710b828 100644
--- a/src/gpu/GrPathRendering.cpp
+++ b/src/gpu/GrPathRendering.cpp
@@ -63,7 +63,7 @@
}
if (desc) {
- SkAutoTUnref<GlyphGenerator> generator(SkNEW_ARGS(GlyphGenerator, (*typeface, *desc)));
+ SkAutoTUnref<GlyphGenerator> generator(new GlyphGenerator(*typeface, *desc));
return this->createPathRange(generator, stroke);
}
@@ -81,6 +81,6 @@
genericDesc->addEntry(kRec_SkDescriptorTag, sizeof(rec), &rec);
genericDesc->computeChecksum();
- SkAutoTUnref<GlyphGenerator> generator(SkNEW_ARGS(GlyphGenerator, (*typeface, *genericDesc)));
+ SkAutoTUnref<GlyphGenerator> generator(new GlyphGenerator(*typeface, *genericDesc));
return this->createPathRange(generator, stroke);
}
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index 8f149f5..148ebb4 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -53,7 +53,7 @@
overrideColor = GrColor_ILLEGAL;
}
- GrPipeline* pipeline = SkNEW_PLACEMENT(memory, GrPipeline);
+ GrPipeline* pipeline = new (memory) GrPipeline;
pipeline->fXferProcessor.reset(xferProcessor.get());
pipeline->fRenderTarget.reset(builder.fRenderTarget.get());
diff --git a/src/gpu/GrPipelineBuilder.cpp b/src/gpu/GrPipelineBuilder.cpp
index 64a1d0c..d7db201 100644
--- a/src/gpu/GrPipelineBuilder.cpp
+++ b/src/gpu/GrPipelineBuilder.cpp
@@ -16,14 +16,12 @@
#include "effects/GrPorterDuffXferProcessor.h"
GrPipelineBuilder::GrPipelineBuilder()
- : fProcDataManager(SkNEW(GrProcessorDataManager))
- , fFlags(0x0)
- , fDrawFace(kBoth_DrawFace) {
+ : fProcDataManager(new GrProcessorDataManager), fFlags(0x0), fDrawFace(kBoth_DrawFace) {
SkDEBUGCODE(fBlockEffectRemovalCnt = 0;)
}
GrPipelineBuilder& GrPipelineBuilder::operator=(const GrPipelineBuilder& that) {
- fProcDataManager.reset(SkNEW_ARGS(GrProcessorDataManager, (*that.processorDataManager())));
+ fProcDataManager.reset(new GrProcessorDataManager(*that.processorDataManager()));
fRenderTarget.reset(SkSafeRef(that.fRenderTarget.get()));
fFlags = that.fFlags;
fStencilSettings = that.fStencilSettings;
diff --git a/src/gpu/GrRecordReplaceDraw.cpp b/src/gpu/GrRecordReplaceDraw.cpp
index d1a8d93..5f0adb1 100644
--- a/src/gpu/GrRecordReplaceDraw.cpp
+++ b/src/gpu/GrRecordReplaceDraw.cpp
@@ -18,7 +18,7 @@
static inline void wrap_texture(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();
}
static inline void draw_replacement_bitmap(GrCachedLayer* layer, SkCanvas* canvas) {
diff --git a/src/gpu/GrRectanizer_pow2.cpp b/src/gpu/GrRectanizer_pow2.cpp
index 2d443ca..7091a57 100644
--- a/src/gpu/GrRectanizer_pow2.cpp
+++ b/src/gpu/GrRectanizer_pow2.cpp
@@ -56,5 +56,5 @@
// factory is now in GrRectanizer_skyline.cpp
//GrRectanizer* GrRectanizer::Factory(int width, int height) {
-// return SkNEW_ARGS(GrRectanizerPow2, (width, height));
+// return new GrRectanizerPow2 (width, height);
//}
diff --git a/src/gpu/GrRectanizer_skyline.cpp b/src/gpu/GrRectanizer_skyline.cpp
old mode 100755
new mode 100644
index 44da1c3..32fd410
--- a/src/gpu/GrRectanizer_skyline.cpp
+++ b/src/gpu/GrRectanizer_skyline.cpp
@@ -118,5 +118,5 @@
///////////////////////////////////////////////////////////////////////////////
GrRectanizer* GrRectanizer::Factory(int width, int height) {
- return SkNEW_ARGS(GrRectanizerSkyline, (width, height));
+ return new GrRectanizerSkyline(width, height);
}
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index e77d9ac..85a3021 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -84,7 +84,7 @@
GrResourceCache::~GrResourceCache() {
this->releaseAll();
- SkDELETE_ARRAY(fFlushTimestamps);
+ delete[] fFlushTimestamps;
}
void GrResourceCache::setLimits(int count, size_t bytes, int maxUnusedFlushes) {
@@ -96,7 +96,7 @@
}
void GrResourceCache::resetFlushTimestamps() {
- SkDELETE_ARRAY(fFlushTimestamps);
+ delete[] fFlushTimestamps;
// We assume this number is a power of two when wrapping indices into the timestamp array.
fMaxUnusedFlushes = SkNextPow2(fMaxUnusedFlushes);
@@ -110,7 +110,7 @@
return;
}
- fFlushTimestamps = SkNEW_ARRAY(uint32_t, fMaxUnusedFlushes);
+ fFlushTimestamps = new uint32_t[fMaxUnusedFlushes];
fLastFlushTimestampIndex = 0;
// Set all the historical flush timestamps to initially be at the beginning of time (timestamp
// 0).
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index 3adb0fa..e328c66 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -37,7 +37,7 @@
uint16_t* data = (uint16_t*) buffer->map();
bool useTempData = (NULL == data);
if (useTempData) {
- data = SkNEW_ARRAY(uint16_t, reps * patternSize);
+ data = new uint16_t[reps * patternSize];
}
for (int i = 0; i < reps; ++i) {
int baseIdx = i * patternSize;
@@ -51,7 +51,7 @@
buffer->unref();
return NULL;
}
- SkDELETE_ARRAY(data);
+ delete[] data;
} else {
buffer->unmap();
}
@@ -161,5 +161,5 @@
if (!texture) {
return NULL;
}
- return SkNEW_ARGS(GrBatchAtlas, (texture, numPlotsX, numPlotsY));
+ return new GrBatchAtlas(texture, numPlotsX, numPlotsY);
}
diff --git a/src/gpu/GrStencilAndCoverPathRenderer.cpp b/src/gpu/GrStencilAndCoverPathRenderer.cpp
index 60f9f64..a5e34ff 100644
--- a/src/gpu/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/GrStencilAndCoverPathRenderer.cpp
@@ -35,7 +35,7 @@
GrPathRenderer* GrStencilAndCoverPathRenderer::Create(GrResourceProvider* resourceProvider,
const GrCaps& caps) {
if (caps.shaderCaps()->pathRenderingSupport()) {
- return SkNEW_ARGS(GrStencilAndCoverPathRenderer, (resourceProvider));
+ return new GrStencilAndCoverPathRenderer(resourceProvider);
} else {
return NULL;
}
diff --git a/src/gpu/GrStencilAndCoverTextContext.cpp b/src/gpu/GrStencilAndCoverTextContext.cpp
index 554038f..d63df88 100644
--- a/src/gpu/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/GrStencilAndCoverTextContext.cpp
@@ -33,8 +33,8 @@
GrStencilAndCoverTextContext*
GrStencilAndCoverTextContext::Create(GrContext* context, GrDrawContext* drawContext,
const SkSurfaceProps& surfaceProps) {
- GrStencilAndCoverTextContext* textContext = SkNEW_ARGS(GrStencilAndCoverTextContext,
- (context, drawContext, surfaceProps));
+ GrStencilAndCoverTextContext* textContext =
+ new GrStencilAndCoverTextContext(context, drawContext, surfaceProps);
textContext->fFallbackTextContext = GrAtlasTextContext::Create(context, drawContext, surfaceProps);
return textContext;
diff --git a/src/gpu/GrTessellatingPathRenderer.cpp b/src/gpu/GrTessellatingPathRenderer.cpp
index 9fe5278..55af044 100644
--- a/src/gpu/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/GrTessellatingPathRenderer.cpp
@@ -89,8 +89,7 @@
#define LOG(...)
#endif
-#define ALLOC_NEW(Type, args, alloc) \
- SkNEW_PLACEMENT_ARGS(alloc.allocThrow(sizeof(Type)), Type, args)
+#define ALLOC_NEW(Type, args, alloc) new (alloc.allocThrow(sizeof(Type))) Type args
namespace {
@@ -1392,7 +1391,7 @@
const GrStrokeInfo& stroke,
const SkMatrix& viewMatrix,
SkRect clipBounds) {
- return SkNEW_ARGS(TessellatingPathBatch, (color, path, stroke, viewMatrix, clipBounds));
+ return new TessellatingPathBatch(color, path, stroke, viewMatrix, clipBounds);
}
const char* name() const override { return "TessellatingPathBatch"; }
@@ -1461,7 +1460,7 @@
}
LOG("got %d pts, %d contours\n", maxPts, contourCnt);
- SkAutoTDeleteArray<Vertex*> contours(SkNEW_ARRAY(Vertex *, contourCnt));
+ SkAutoTDeleteArray<Vertex*> contours(new Vertex* [contourCnt]);
// For the initial size of the chunk allocator, estimate based on the point count:
// one vertex per point for the initial passes, plus two for the vertices in the
@@ -1495,7 +1494,7 @@
if (canMapVB) {
verts = static_cast<SkPoint*>(vertexBuffer->map());
} else {
- verts = SkNEW_ARRAY(SkPoint, count);
+ verts = new SkPoint[count];
}
SkPoint* end = polys_to_triangles(polys, fillType, verts);
int actualCount = static_cast<int>(end - verts);
@@ -1505,7 +1504,7 @@
vertexBuffer->unmap();
} else {
vertexBuffer->updateData(verts, actualCount * sizeof(SkPoint));
- SkDELETE_ARRAY(verts);
+ delete[] verts;
}
@@ -1516,7 +1515,7 @@
SkAutoTUnref<SkData> data(SkData::NewWithCopy(&info, sizeof(info)));
key->setCustomData(data.get());
resourceProvider->assignUniqueKeyToResource(*key, vertexBuffer.get());
- SkPathPriv::AddGenIDChangeListener(fPath, SkNEW(PathInvalidator(*key)));
+ SkPathPriv::AddGenIDChangeListener(fPath, new PathInvalidator(*key));
}
return actualCount;
}
diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp
index a41fb06..1f5e2ce 100644
--- a/src/gpu/GrTest.cpp
+++ b/src/gpu/GrTest.cpp
@@ -179,7 +179,7 @@
class MockGpu : public GrGpu {
public:
MockGpu(GrContext* context, const GrContextOptions& options) : INHERITED(context) {
- fCaps.reset(SkNEW_ARGS(GrCaps, (options)));
+ fCaps.reset(new GrCaps(options));
}
~MockGpu() override {}
@@ -281,7 +281,7 @@
};
GrContext* GrContext::CreateMockContext() {
- GrContext* context = SkNEW(GrContext);
+ GrContext* context = new GrContext;
context->initMockContext();
return context;
@@ -291,7 +291,7 @@
GrContextOptions options;
options.fGeometryBufferMapThreshold = 0;
SkASSERT(NULL == fGpu);
- fGpu = SkNEW_ARGS(MockGpu, (this, options));
+ fGpu = new MockGpu(this, options);
SkASSERT(fGpu);
this->initCommon();
diff --git a/src/gpu/GrTestUtils.cpp b/src/gpu/GrTestUtils.cpp
index a456fbb..2212c74 100644
--- a/src/gpu/GrTestUtils.cpp
+++ b/src/gpu/GrTestUtils.cpp
@@ -244,7 +244,7 @@
randomize_stroke_rec(&strokeInfo, random);
SkPathEffect::DashInfo dashInfo;
dashInfo.fCount = random->nextRangeU(1, 50) * 2;
- dashInfo.fIntervals = SkNEW_ARRAY(SkScalar, dashInfo.fCount);
+ dashInfo.fIntervals = new SkScalar[dashInfo.fCount];
SkScalar sum = 0;
for (int i = 0; i < dashInfo.fCount; i++) {
dashInfo.fIntervals[i] = random->nextRangeScalar(SkDoubleToScalar(0.01),
@@ -253,7 +253,7 @@
}
dashInfo.fPhase = random->nextRangeScalar(0, sum);
strokeInfo.setDashInfo(dashInfo);
- SkDELETE_ARRAY(dashInfo.fIntervals);
+ delete[] dashInfo.fIntervals;
return strokeInfo;
}
diff --git a/src/gpu/GrTextBlobCache.cpp b/src/gpu/GrTextBlobCache.cpp
index dd7ddc1..f11b7c6 100644
--- a/src/gpu/GrTextBlobCache.cpp
+++ b/src/gpu/GrTextBlobCache.cpp
@@ -27,7 +27,7 @@
sk_bzero(allocation, size);
#endif
- GrAtlasTextBlob* cacheBlob = SkNEW_PLACEMENT(allocation, GrAtlasTextBlob);
+ GrAtlasTextBlob* cacheBlob = new (allocation) GrAtlasTextBlob;
#ifdef CACHE_SANITY_CHECK
cacheBlob->fSize = size;
#endif
@@ -39,7 +39,7 @@
// Initialize runs
for (int i = 0; i < runCount; i++) {
- SkNEW_PLACEMENT(&cacheBlob->fRuns[i], GrAtlasTextBlob::Run);
+ new (&cacheBlob->fRuns[i]) GrAtlasTextBlob::Run;
}
cacheBlob->fRunCount = runCount;
cacheBlob->fPool = &fPool;
diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp
index 8f348f6..387b7eb 100644
--- a/src/gpu/GrTextContext.cpp
+++ b/src/gpu/GrTextContext.cpp
@@ -28,9 +28,7 @@
, fDrawContext(drawContext) {
}
-GrTextContext::~GrTextContext() {
- SkDELETE(fFallbackTextContext);
-}
+GrTextContext::~GrTextContext() { delete fFallbackTextContext; }
void GrTextContext::drawText(GrRenderTarget* rt, const GrClip& clip, const GrPaint& paint,
const SkPaint& skPaint, const SkMatrix& viewMatrix,
@@ -236,7 +234,7 @@
}
}
-//*** change to output positions?
+// *** change to output positions?
int GrTextContext::MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc,
const char text[], size_t byteLength, SkVector* stopVector) {
SkFixed x = 0, y = 0;
@@ -274,7 +272,7 @@
scaler = (GrFontScaler*)auxData;
}
if (NULL == scaler) {
- scaler = SkNEW_ARGS(GrFontScaler, (cache));
+ scaler = new GrFontScaler(cache);
cache->setAuxProc(GlyphCacheAuxProc, scaler);
}
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 23151d4..aefa389 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -159,7 +159,7 @@
if (!CheckAlphaTypeAndGetFlags(NULL, init, &flags)) {
return NULL;
}
- return SkNEW_ARGS(SkGpuDevice, (rt, width, height, props, flags));
+ return new SkGpuDevice(rt, width, height, props, flags);
}
SkGpuDevice* SkGpuDevice::Create(GrContext* context, SkSurface::Budgeted budgeted,
@@ -175,7 +175,7 @@
return NULL;
}
- return SkNEW_ARGS(SkGpuDevice, (rt, info.width(), info.height(), props, flags));
+ return new SkGpuDevice(rt, info.width(), info.height(), props, flags);
}
SkGpuDevice::SkGpuDevice(GrRenderTarget* rt, int width, int height,
@@ -192,7 +192,7 @@
SkAlphaType at = fOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
SkImageInfo info = rt->surfacePriv().info(at).makeWH(width, height);
- SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (info, rt));
+ SkPixelRef* pr = new SkGrPixelRef(info, rt);
fLegacyBitmap.setInfo(info);
fLegacyBitmap.setPixelRef(pr)->unref();
@@ -370,7 +370,7 @@
kPremul_SkAlphaType);
SkASSERT(info == fLegacyBitmap.info());
#endif
- SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (fLegacyBitmap.info(), fRenderTarget));
+ SkPixelRef* pr = new SkGrPixelRef(fLegacyBitmap.info(), fRenderTarget);
fLegacyBitmap.setPixelRef(pr)->unref();
fDrawContext.reset(SkRef(fRenderTarget->getContext()->drawContext(&this->surfaceProps())));
@@ -668,7 +668,7 @@
static SkBitmap wrap_texture(GrTexture* texture, int width, int height) {
SkBitmap result;
result.setInfo(SkImageInfo::MakeN32Premul(width, height));
- result.setPixelRef(SkNEW_ARGS(SkGrPixelRef, (result.info(), texture)))->unref();
+ result.setPixelRef(new SkGrPixelRef(result.info(), texture))->unref();
return result;
}
@@ -1630,7 +1630,7 @@
//number of indices for lines per triangle with kLines
indexCount = triangleCount * 6;
- outAlloc.reset(SkNEW_ARRAY(uint16_t, indexCount));
+ outAlloc.reset(new uint16_t[indexCount]);
outIndices = outAlloc.get();
uint16_t* auxIndices = outAlloc.get();
int i = 0;
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 6c1ec4b..ef8460b 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -245,7 +245,7 @@
size_t rowBytes) {
GrTexture* result = ctx->textureProvider()->createTexture(desc, true, pixels, rowBytes);
if (result && optionalKey.isValid()) {
- BitmapInvalidator* listener = SkNEW_ARGS(BitmapInvalidator, (optionalKey));
+ BitmapInvalidator* listener = new BitmapInvalidator(optionalKey);
pixelRefForInvalidationNotification->addGenIDChangeListener(listener);
ctx->textureProvider()->assignUniqueKeyToTexture(optionalKey, result);
}
@@ -892,7 +892,7 @@
void GrWrapTextureInBitmap(GrTexture* src, int w, int h, bool isOpaque, SkBitmap* dst) {
const SkImageInfo info = GrMakeInfoFromTexture(src, w, h, isOpaque);
dst->setInfo(info);
- dst->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, src)))->unref();
+ dst->setPixelRef(new SkGrPixelRef(info, src))->unref();
}
GrTextureParams::FilterMode GrSkFilterQualityToGrFilterMode(SkFilterQuality paintFilterQuality,
diff --git a/src/gpu/SkGrPixelRef.cpp b/src/gpu/SkGrPixelRef.cpp
index 21b999f..50b1269 100644
--- a/src/gpu/SkGrPixelRef.cpp
+++ b/src/gpu/SkGrPixelRef.cpp
@@ -90,7 +90,7 @@
SkImageInfo info = SkImageInfo::Make(desc.fWidth, desc.fHeight, dstCT, kPremul_SkAlphaType,
dstPT);
- SkGrPixelRef* pixelRef = SkNEW_ARGS(SkGrPixelRef, (info, dst));
+ SkGrPixelRef* pixelRef = new SkGrPixelRef(info, dst);
SkSafeUnref(dst);
return pixelRef;
}
diff --git a/src/gpu/batches/GrAAStrokeRectBatch.h b/src/gpu/batches/GrAAStrokeRectBatch.h
index f74c33c..ae75348 100644
--- a/src/gpu/batches/GrAAStrokeRectBatch.h
+++ b/src/gpu/batches/GrAAStrokeRectBatch.h
@@ -28,7 +28,7 @@
};
static GrDrawBatch* Create(const Geometry& geometry, const SkMatrix& viewMatrix) {
- return SkNEW_ARGS(GrAAStrokeRectBatch, (geometry, viewMatrix));
+ return new GrAAStrokeRectBatch(geometry, viewMatrix);
}
const char* name() const override { return "AAStrokeRect"; }
diff --git a/src/gpu/batches/GrCopySurfaceBatch.cpp b/src/gpu/batches/GrCopySurfaceBatch.cpp
index 2c859f8..b4e7ce2 100644
--- a/src/gpu/batches/GrCopySurfaceBatch.cpp
+++ b/src/gpu/batches/GrCopySurfaceBatch.cpp
@@ -75,5 +75,5 @@
&clippedDstPoint)) {
return NULL;
}
- return SkNEW_ARGS(GrCopySurfaceBatch, (dst, src, clippedSrcRect, clippedDstPoint));
+ return new GrCopySurfaceBatch(dst, src, clippedSrcRect, clippedDstPoint);
}
diff --git a/src/gpu/batches/GrDrawAtlasBatch.h b/src/gpu/batches/GrDrawAtlasBatch.h
index e7dd9bf..9a864c0 100644
--- a/src/gpu/batches/GrDrawAtlasBatch.h
+++ b/src/gpu/batches/GrDrawAtlasBatch.h
@@ -22,8 +22,7 @@
static GrDrawBatch* Create(const Geometry& geometry, const SkMatrix& viewMatrix,
int spriteCount, const SkRSXform* xforms, const SkRect* rects,
const SkColor* colors) {
- return SkNEW_ARGS(GrDrawAtlasBatch, (geometry, viewMatrix, spriteCount,
- xforms, rects, colors));
+ return new GrDrawAtlasBatch(geometry, viewMatrix, spriteCount, xforms, rects, colors);
}
const char* name() const override { return "DrawAtlasBatch"; }
diff --git a/src/gpu/batches/GrDrawPathBatch.h b/src/gpu/batches/GrDrawPathBatch.h
index e8349d1..cf67cd9 100644
--- a/src/gpu/batches/GrDrawPathBatch.h
+++ b/src/gpu/batches/GrDrawPathBatch.h
@@ -18,7 +18,7 @@
public:
// This must return the concrete type because we install the stencil settings late :(
static GrDrawPathBatch* Create(const GrPathProcessor* primProc, const GrPath* path) {
- return SkNEW_ARGS(GrDrawPathBatch, (primProc, path));
+ return new GrDrawPathBatch(primProc, path);
}
const char* name() const override { return "DrawPath"; }
diff --git a/src/gpu/batches/GrDrawVerticesBatch.h b/src/gpu/batches/GrDrawVerticesBatch.h
index 18ddee0..aaa7b09 100644
--- a/src/gpu/batches/GrDrawVerticesBatch.h
+++ b/src/gpu/batches/GrDrawVerticesBatch.h
@@ -34,9 +34,8 @@
const uint16_t* indices, int indexCount,
const GrColor* colors, const SkPoint* localCoords,
const SkRect& bounds) {
- return SkNEW_ARGS(GrDrawVerticesBatch, (geometry, primitiveType, viewMatrix, positions,
- vertexCount, indices, indexCount, colors,
- localCoords, bounds));
+ return new GrDrawVerticesBatch(geometry, primitiveType, viewMatrix, positions, vertexCount,
+ indices, indexCount, colors, localCoords, bounds);
}
const char* name() const override { return "DrawVerticesBatch"; }
diff --git a/src/gpu/batches/GrStencilPathBatch.h b/src/gpu/batches/GrStencilPathBatch.h
index d679009..6b4ddf0 100644
--- a/src/gpu/batches/GrStencilPathBatch.h
+++ b/src/gpu/batches/GrStencilPathBatch.h
@@ -23,8 +23,7 @@
const GrScissorState& scissor,
GrRenderTarget* renderTarget,
const GrPath* path) {
- return SkNEW_ARGS(GrStencilPathBatch, (viewMatrix, useHWAA, stencil, scissor, renderTarget,
- path));
+ return new GrStencilPathBatch(viewMatrix, useHWAA, stencil, scissor, renderTarget, path);
}
const char* name() const override { return "StencilPath"; }
diff --git a/src/gpu/batches/GrStrokeRectBatch.h b/src/gpu/batches/GrStrokeRectBatch.h
index ee053d7..b374ea8 100644
--- a/src/gpu/batches/GrStrokeRectBatch.h
+++ b/src/gpu/batches/GrStrokeRectBatch.h
@@ -22,7 +22,7 @@
};
static GrDrawBatch* Create(const Geometry& geometry, bool snapToPixelCenters) {
- return SkNEW_ARGS(GrStrokeRectBatch, (geometry, snapToPixelCenters));
+ return new GrStrokeRectBatch(geometry, snapToPixelCenters);
}
const char* name() const override { return "GrStrokeRectBatch"; }
diff --git a/src/gpu/batches/GrTInstanceBatch.h b/src/gpu/batches/GrTInstanceBatch.h
index 9690d55..e314959 100644
--- a/src/gpu/batches/GrTInstanceBatch.h
+++ b/src/gpu/batches/GrTInstanceBatch.h
@@ -42,9 +42,7 @@
public:
typedef typename Impl::Geometry Geometry;
- static GrTInstanceBatch* Create() {
- return SkNEW(GrTInstanceBatch);
- }
+ static GrTInstanceBatch* Create() { return new GrTInstanceBatch; }
const char* name() const override { return Impl::Name(); }
diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp
index 6a39be4..23f1899 100644
--- a/src/gpu/effects/GrBezierEffect.cpp
+++ b/src/gpu/effects/GrBezierEffect.cpp
@@ -194,7 +194,7 @@
GrGLPrimitiveProcessor* GrConicEffect::createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const {
- return SkNEW_ARGS(GrGLConicEffect, (*this, bt));
+ return new GrGLConicEffect(*this, bt);
}
GrConicEffect::GrConicEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t coverage,
@@ -402,7 +402,7 @@
GrGLPrimitiveProcessor* GrQuadEffect::createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const {
- return SkNEW_ARGS(GrGLQuadEffect, (*this, bt));
+ return new GrGLQuadEffect(*this, bt);
}
GrQuadEffect::GrQuadEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t coverage,
@@ -626,7 +626,7 @@
GrGLPrimitiveProcessor* GrCubicEffect::createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const {
- return SkNEW_ARGS(GrGLCubicEffect, (*this, bt));
+ return new GrGLCubicEffect(*this, bt);
}
GrCubicEffect::GrCubicEffect(GrColor color, const SkMatrix& viewMatrix,
diff --git a/src/gpu/effects/GrBezierEffect.h b/src/gpu/effects/GrBezierEffect.h
index 161a2eb..b78c3f3 100644
--- a/src/gpu/effects/GrBezierEffect.h
+++ b/src/gpu/effects/GrBezierEffect.h
@@ -70,20 +70,18 @@
if (!caps.shaderCaps()->shaderDerivativeSupport()) {
return NULL;
}
- return SkNEW_ARGS(GrConicEffect, (color, viewMatrix, coverage,
- kFillAA_GrProcessorEdgeType,
- localMatrix, usesLocalCoords));
+ return new GrConicEffect(color, viewMatrix, coverage, kFillAA_GrProcessorEdgeType,
+ localMatrix, usesLocalCoords);
case kHairlineAA_GrProcessorEdgeType:
if (!caps.shaderCaps()->shaderDerivativeSupport()) {
return NULL;
}
- return SkNEW_ARGS(GrConicEffect, (color, viewMatrix, coverage,
- kHairlineAA_GrProcessorEdgeType,
- localMatrix, usesLocalCoords));
+ return new GrConicEffect(color, viewMatrix, coverage,
+ kHairlineAA_GrProcessorEdgeType, localMatrix,
+ usesLocalCoords);
case kFillBW_GrProcessorEdgeType:
- return SkNEW_ARGS(GrConicEffect, (color, viewMatrix, coverage,
- kFillBW_GrProcessorEdgeType,
- localMatrix, usesLocalCoords));
+ return new GrConicEffect(color, viewMatrix, coverage, kFillBW_GrProcessorEdgeType,
+ localMatrix, usesLocalCoords);
default:
return NULL;
}
@@ -155,20 +153,18 @@
if (!caps.shaderCaps()->shaderDerivativeSupport()) {
return NULL;
}
- return SkNEW_ARGS(GrQuadEffect, (color, viewMatrix, coverage,
- kFillAA_GrProcessorEdgeType,
- localMatrix, usesLocalCoords));
+ return new GrQuadEffect(color, viewMatrix, coverage, kFillAA_GrProcessorEdgeType,
+ localMatrix, usesLocalCoords);
case kHairlineAA_GrProcessorEdgeType:
if (!caps.shaderCaps()->shaderDerivativeSupport()) {
return NULL;
}
- return SkNEW_ARGS(GrQuadEffect, (color, viewMatrix, coverage,
- kHairlineAA_GrProcessorEdgeType,
- localMatrix, usesLocalCoords));
+ return new GrQuadEffect(color, viewMatrix, coverage,
+ kHairlineAA_GrProcessorEdgeType, localMatrix,
+ usesLocalCoords);
case kFillBW_GrProcessorEdgeType:
- return SkNEW_ARGS(GrQuadEffect, (color, viewMatrix, coverage,
- kFillBW_GrProcessorEdgeType,
- localMatrix, usesLocalCoords));
+ return new GrQuadEffect(color, viewMatrix, coverage, kFillBW_GrProcessorEdgeType,
+ localMatrix, usesLocalCoords);
default:
return NULL;
}
@@ -239,16 +235,14 @@
if (!caps.shaderCaps()->shaderDerivativeSupport()) {
return NULL;
}
- return SkNEW_ARGS(GrCubicEffect, (color, viewMatrix, kFillAA_GrProcessorEdgeType));
+ return new GrCubicEffect(color, viewMatrix, kFillAA_GrProcessorEdgeType);
case kHairlineAA_GrProcessorEdgeType:
if (!caps.shaderCaps()->shaderDerivativeSupport()) {
return NULL;
}
- return SkNEW_ARGS(GrCubicEffect, (color, viewMatrix,
- kHairlineAA_GrProcessorEdgeType));
+ return new GrCubicEffect(color, viewMatrix, kHairlineAA_GrProcessorEdgeType);
case kFillBW_GrProcessorEdgeType:
- return SkNEW_ARGS(GrCubicEffect, (color, viewMatrix,
- kFillBW_GrProcessorEdgeType));
+ return new GrCubicEffect(color, viewMatrix, kFillBW_GrProcessorEdgeType);
default:
return NULL;
}
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp
index e3b959d..ad9be6b 100644
--- a/src/gpu/effects/GrBicubicEffect.cpp
+++ b/src/gpu/effects/GrBicubicEffect.cpp
@@ -159,7 +159,7 @@
}
GrGLFragmentProcessor* GrBicubicEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GrGLBicubicEffect, (*this));
+ return new GrGLBicubicEffect(*this);
}
bool GrBicubicEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
diff --git a/src/gpu/effects/GrBicubicEffect.h b/src/gpu/effects/GrBicubicEffect.h
index f95b3f9..ff2d60e 100644
--- a/src/gpu/effects/GrBicubicEffect.h
+++ b/src/gpu/effects/GrBicubicEffect.h
@@ -41,9 +41,8 @@
return Create(procDataManager, tex, coefficients,
GrCoordTransform::MakeDivByTextureWHMatrix(tex), kTileModes);
} else {
- return SkNEW_ARGS(GrBicubicEffect, (procDataManager, tex, coefficients,
- GrCoordTransform::MakeDivByTextureWHMatrix(tex),
- *domain));
+ return new GrBicubicEffect(procDataManager, tex, coefficients,
+ GrCoordTransform::MakeDivByTextureWHMatrix(tex), *domain);
}
}
@@ -63,7 +62,7 @@
static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager, GrTexture* tex,
const SkScalar coefficients[16], const SkMatrix& matrix,
const SkShader::TileMode tileModes[2]) {
- return SkNEW_ARGS(GrBicubicEffect, (procDataManager, tex, coefficients, matrix, tileModes));
+ return new GrBicubicEffect(procDataManager, tex, coefficients, matrix, tileModes);
}
/**
@@ -71,8 +70,7 @@
*/
static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager, GrTexture* tex,
const SkMatrix& matrix, const SkRect& domain) {
- return SkNEW_ARGS(GrBicubicEffect, (procDataManager, tex, gMitchellCoefficients, matrix,
- domain));
+ return new GrBicubicEffect(procDataManager, tex, gMitchellCoefficients, matrix, domain);
}
/**
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index dfced55..3b4f24c 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -152,7 +152,7 @@
GrGLPrimitiveProcessor*
GrBitmapTextGeoProc::createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps& caps) const {
- return SkNEW_ARGS(GrGLBitmapTextGeoProc, (*this, bt));
+ return new GrGLBitmapTextGeoProc(*this, bt);
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.h b/src/gpu/effects/GrBitmapTextGeoProc.h
index 2bd2726..ab7ba3f 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.h
+++ b/src/gpu/effects/GrBitmapTextGeoProc.h
@@ -24,8 +24,7 @@
static GrGeometryProcessor* Create(GrColor color, GrTexture* tex, const GrTextureParams& p,
GrMaskFormat format, const SkMatrix& localMatrix,
bool usesLocalCoords) {
- return SkNEW_ARGS(GrBitmapTextGeoProc, (color, tex, p, format, localMatrix,
- usesLocalCoords));
+ return new GrBitmapTextGeoProc(color, tex, p, format, localMatrix, usesLocalCoords);
}
virtual ~GrBitmapTextGeoProc() {}
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index 4c8813d..06b2d8d 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -136,12 +136,9 @@
} else {
swapRB = d->fRandom->nextBool();
}
- return SkNEW_ARGS(GrConfigConversionEffect,
- (d->fProcDataManager,
- d->fTextures[GrProcessorUnitTest::kSkiaPMTextureIdx],
- swapRB,
- pmConv,
- GrTest::TestMatrix(d->fRandom)));
+ return new GrConfigConversionEffect(d->fProcDataManager,
+ d->fTextures[GrProcessorUnitTest::kSkiaPMTextureIdx],
+ swapRB, pmConv, GrTest::TestMatrix(d->fRandom));
}
///////////////////////////////////////////////////////////////////////////////
@@ -152,7 +149,7 @@
}
GrGLFragmentProcessor* GrConfigConversionEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GrGLConfigConversionEffect, (*this));
+ return new GrGLConfigConversionEffect(*this);
}
@@ -219,18 +216,12 @@
GrPaint paint1;
GrPaint paint2;
GrPaint paint3;
- SkAutoTUnref<GrFragmentProcessor> pmToUPM1(
- SkNEW_ARGS(GrConfigConversionEffect,
- (paint1.getProcessorDataManager(), dataTex, false, *pmToUPMRule,
- SkMatrix::I())));
- SkAutoTUnref<GrFragmentProcessor> upmToPM(
- SkNEW_ARGS(GrConfigConversionEffect,
- (paint2.getProcessorDataManager(), readTex, false, *upmToPMRule,
- SkMatrix::I())));
- SkAutoTUnref<GrFragmentProcessor> pmToUPM2(
- SkNEW_ARGS(GrConfigConversionEffect,
- (paint3.getProcessorDataManager(), tempTex, false, *pmToUPMRule,
- SkMatrix::I())));
+ SkAutoTUnref<GrFragmentProcessor> pmToUPM1(new GrConfigConversionEffect(
+ paint1.getProcessorDataManager(), dataTex, false, *pmToUPMRule, SkMatrix::I()));
+ SkAutoTUnref<GrFragmentProcessor> upmToPM(new GrConfigConversionEffect(
+ paint2.getProcessorDataManager(), readTex, false, *upmToPMRule, SkMatrix::I()));
+ SkAutoTUnref<GrFragmentProcessor> pmToUPM2(new GrConfigConversionEffect(
+ paint3.getProcessorDataManager(), tempTex, false, *pmToUPMRule, SkMatrix::I()));
paint1.addColorProcessor(pmToUPM1);
@@ -314,10 +305,7 @@
// The PM conversions assume colors are 0..255
return NULL;
}
- return SkNEW_ARGS(GrConfigConversionEffect, (procDataManager,
- texture,
- swapRedAndBlue,
- pmConversion,
- matrix));
+ return new GrConfigConversionEffect(procDataManager, texture, swapRedAndBlue, pmConversion,
+ matrix);
}
}
diff --git a/src/gpu/effects/GrConstColorProcessor.cpp b/src/gpu/effects/GrConstColorProcessor.cpp
index 88bd82b..131d91c 100644
--- a/src/gpu/effects/GrConstColorProcessor.cpp
+++ b/src/gpu/effects/GrConstColorProcessor.cpp
@@ -91,7 +91,7 @@
}
GrGLFragmentProcessor* GrConstColorProcessor::onCreateGLInstance() const {
- return SkNEW(GLConstColorProcessor);
+ return new GLConstColorProcessor;
}
bool GrConstColorProcessor::onIsEqual(const GrFragmentProcessor& other) const {
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp
index 6c47768..92ec518 100644
--- a/src/gpu/effects/GrConvexPolyEffect.cpp
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp
@@ -17,7 +17,7 @@
const SkRect& getRect() const { return fRect; }
static GrFragmentProcessor* Create(GrPrimitiveEdgeType edgeType, const SkRect& rect) {
- return SkNEW_ARGS(AARectEffect, (edgeType, rect));
+ return new AARectEffect(edgeType, rect);
}
GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
@@ -158,7 +158,7 @@
}
GrGLFragmentProcessor* AARectEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GLAARectEffect, (*this));
+ return new GLAARectEffect(*this);
}
//////////////////////////////////////////////////////////////////////////////
@@ -310,7 +310,7 @@
}
GrGLFragmentProcessor* GrConvexPolyEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GrGLConvexPolyEffect, (*this));
+ return new GrGLConvexPolyEffect(*this);
}
GrConvexPolyEffect::GrConvexPolyEffect(GrPrimitiveEdgeType edgeType, int n, const SkScalar edges[])
diff --git a/src/gpu/effects/GrConvexPolyEffect.h b/src/gpu/effects/GrConvexPolyEffect.h
index ead7fe4..68cd9ec 100644
--- a/src/gpu/effects/GrConvexPolyEffect.h
+++ b/src/gpu/effects/GrConvexPolyEffect.h
@@ -43,7 +43,7 @@
if (n <= 0 || n > kMaxEdges || kHairlineAA_GrProcessorEdgeType == edgeType) {
return NULL;
}
- return SkNEW_ARGS(GrConvexPolyEffect, (edgeType, n, edges));
+ return new GrConvexPolyEffect(edgeType, n, edges);
}
/**
diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp
index 3ab9efb..f70b664 100644
--- a/src/gpu/effects/GrConvolutionEffect.cpp
+++ b/src/gpu/effects/GrConvolutionEffect.cpp
@@ -201,7 +201,7 @@
}
GrGLFragmentProcessor* GrConvolutionEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GrGLConvolutionEffect, (*this));
+ return new GrGLConvolutionEffect(*this);
}
bool GrConvolutionEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
diff --git a/src/gpu/effects/GrConvolutionEffect.h b/src/gpu/effects/GrConvolutionEffect.h
index 37faa08..2cf36af 100644
--- a/src/gpu/effects/GrConvolutionEffect.h
+++ b/src/gpu/effects/GrConvolutionEffect.h
@@ -28,13 +28,8 @@
const float* kernel,
bool useBounds,
float bounds[2]) {
- return SkNEW_ARGS(GrConvolutionEffect, (procDataManager,
- tex,
- dir,
- halfWidth,
- kernel,
- useBounds,
- bounds));
+ return new GrConvolutionEffect(procDataManager, tex, dir, halfWidth, kernel, useBounds,
+ bounds);
}
/// Convolve with a Gaussian kernel
@@ -45,13 +40,8 @@
float gaussianSigma,
bool useBounds,
float bounds[2]) {
- return SkNEW_ARGS(GrConvolutionEffect, (procDataManager,
- tex,
- dir,
- halfWidth,
- gaussianSigma,
- useBounds,
- bounds));
+ return new GrConvolutionEffect(procDataManager, tex, dir, halfWidth, gaussianSigma,
+ useBounds, bounds);
}
virtual ~GrConvolutionEffect();
diff --git a/src/gpu/effects/GrCoverageSetOpXP.cpp b/src/gpu/effects/GrCoverageSetOpXP.cpp
index d7f4347..8a7c83b 100644
--- a/src/gpu/effects/GrCoverageSetOpXP.cpp
+++ b/src/gpu/effects/GrCoverageSetOpXP.cpp
@@ -18,7 +18,7 @@
class CoverageSetOpXP : public GrXferProcessor {
public:
static GrXferProcessor* Create(SkRegion::Op regionOp, bool invertCoverage) {
- return SkNEW_ARGS(CoverageSetOpXP, (regionOp, invertCoverage));
+ return new CoverageSetOpXP(regionOp, invertCoverage);
}
~CoverageSetOpXP() override;
@@ -102,7 +102,7 @@
}
GrGLXferProcessor* CoverageSetOpXP::createGLInstance() const {
- return SkNEW_ARGS(GLCoverageSetOpXP, (*this));
+ return new GLCoverageSetOpXP(*this);
}
GrXferProcessor::OptFlags
diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp
index 761e177..1fcdb12 100644
--- a/src/gpu/effects/GrCustomXfermode.cpp
+++ b/src/gpu/effects/GrCustomXfermode.cpp
@@ -436,7 +436,7 @@
if (!GrCustomXfermode::IsSupportedMode(mode)) {
return NULL;
} else {
- return SkNEW_ARGS(GrCustomXferFP, (procDataManager, mode, background));
+ return new GrCustomXferFP(procDataManager, mode, background);
}
}
@@ -493,7 +493,7 @@
}
GrGLFragmentProcessor* GrCustomXferFP::onCreateGLInstance() const {
- return SkNEW_ARGS(GLCustomXferFP, (*this));
+ return new GLCustomXferFP(*this);
}
bool GrCustomXferFP::onIsEqual(const GrFragmentProcessor& other) const {
@@ -509,8 +509,8 @@
GrFragmentProcessor* GrCustomXferFP::TestCreate(GrProcessorTestData* d) {
int mode = d->fRandom->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLastSeparableMode);
- return SkNEW_ARGS(GrCustomXferFP, (d->fProcDataManager, static_cast<SkXfermode::Mode>(mode),
- d->fTextures[0]));
+ return new GrCustomXferFP(d->fProcDataManager, static_cast<SkXfermode::Mode>(mode),
+ d->fTextures[0]);
}
///////////////////////////////////////////////////////////////////////////////
@@ -571,7 +571,7 @@
if (!GrCustomXfermode::IsSupportedMode(mode)) {
return NULL;
} else {
- return SkNEW_ARGS(GrCustomXPFactory, (mode));
+ return new GrCustomXPFactory(mode);
}
}
@@ -637,7 +637,7 @@
GrGLXferProcessor* CustomXP::createGLInstance() const {
SkASSERT(this->willReadDstColor() != this->hasHWBlendEquation());
- return SkNEW_ARGS(GLCustomXP, (*this));
+ return new GLCustomXP(*this);
}
bool CustomXP::onIsEqual(const GrXferProcessor& other) const {
@@ -786,9 +786,9 @@
const DstTexture* dstTexture) const {
if (can_use_hw_blend_equation(fHWBlendEquation, coveragePOI, caps)) {
SkASSERT(!dstTexture || !dstTexture->texture());
- return SkNEW_ARGS(CustomXP, (fMode, fHWBlendEquation));
+ return new CustomXP(fMode, fHWBlendEquation);
}
- return SkNEW_ARGS(CustomXP, (dstTexture, hasMixedSamples, fMode));
+ return new CustomXP(dstTexture, hasMixedSamples, fMode);
}
bool GrCustomXPFactory::willReadDstColor(const GrCaps& caps,
@@ -809,6 +809,6 @@
int mode = d->fRandom->nextRangeU(SkXfermode::kLastCoeffMode + 1,
SkXfermode::kLastSeparableMode);
- return SkNEW_ARGS(GrCustomXPFactory, (static_cast<SkXfermode::Mode>(mode)));
+ return new GrCustomXPFactory(static_cast<SkXfermode::Mode>(mode));
}
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp
index 5fb45a3..89fa423 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -259,7 +259,7 @@
static GrDrawBatch* Create(const Geometry& geometry, SkPaint::Cap cap, DashAAMode aaMode,
bool fullDash) {
- return SkNEW_ARGS(DashBatch, (geometry, cap, aaMode, fullDash));
+ return new DashBatch(geometry, cap, aaMode, fullDash);
}
const char* name() const override { return "DashBatch"; }
@@ -929,7 +929,7 @@
DashAAMode aaMode,
const SkMatrix& localMatrix,
bool usesLocalCoords) {
- return SkNEW_ARGS(DashingCircleEffect, (color, aaMode, localMatrix, usesLocalCoords));
+ return new DashingCircleEffect(color, aaMode, localMatrix, usesLocalCoords);
}
void DashingCircleEffect::getGLProcessorKey(const GrBatchTracker& bt,
@@ -940,7 +940,7 @@
GrGLPrimitiveProcessor* DashingCircleEffect::createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const {
- return SkNEW_ARGS(GLDashingCircleEffect, (*this, bt));
+ return new GLDashingCircleEffect(*this, bt);
}
DashingCircleEffect::DashingCircleEffect(GrColor color,
@@ -1165,7 +1165,7 @@
DashAAMode aaMode,
const SkMatrix& localMatrix,
bool usesLocalCoords) {
- return SkNEW_ARGS(DashingLineEffect, (color, aaMode, localMatrix, usesLocalCoords));
+ return new DashingLineEffect(color, aaMode, localMatrix, usesLocalCoords);
}
void DashingLineEffect::getGLProcessorKey(const GrBatchTracker& bt,
@@ -1176,7 +1176,7 @@
GrGLPrimitiveProcessor* DashingLineEffect::createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const {
- return SkNEW_ARGS(GLDashingLineEffect, (*this, bt));
+ return new GLDashingLineEffect(*this, bt);
}
DashingLineEffect::DashingLineEffect(GrColor color,
diff --git a/src/gpu/effects/GrDisableColorXP.cpp b/src/gpu/effects/GrDisableColorXP.cpp
index 31d5849..caccf10 100644
--- a/src/gpu/effects/GrDisableColorXP.cpp
+++ b/src/gpu/effects/GrDisableColorXP.cpp
@@ -17,9 +17,7 @@
*/
class DisableColorXP : public GrXferProcessor {
public:
- static GrXferProcessor* Create() {
- return SkNEW(DisableColorXP);
- }
+ static GrXferProcessor* Create() { return new DisableColorXP; }
~DisableColorXP() override {};
@@ -83,9 +81,7 @@
GLDisableColorXP::GenKey(*this, caps, b);
}
-GrGLXferProcessor* DisableColorXP::createGLInstance() const {
- return SkNEW_ARGS(GLDisableColorXP, (*this));
-}
+GrGLXferProcessor* DisableColorXP::createGLInstance() const { return new GLDisableColorXP(*this); }
void DisableColorXP::onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const {
blendInfo->fWriteColor = false;
diff --git a/src/gpu/effects/GrDisableColorXP.h b/src/gpu/effects/GrDisableColorXP.h
index 2f57064..caa0eec 100644
--- a/src/gpu/effects/GrDisableColorXP.h
+++ b/src/gpu/effects/GrDisableColorXP.h
@@ -15,9 +15,7 @@
class GrDisableColorXPFactory : public GrXPFactory {
public:
- static GrXPFactory* Create() {
- return SkNEW(GrDisableColorXPFactory);
- }
+ static GrXPFactory* Create() { return new GrDisableColorXPFactory; }
bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const override {
return true;
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
old mode 100755
new mode 100644
index 8551272..5d6df72
--- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
@@ -245,7 +245,7 @@
GrGLPrimitiveProcessor*
GrDistanceFieldA8TextGeoProc::createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const {
- return SkNEW_ARGS(GrGLDistanceFieldA8TextGeoProc, (*this, bt));
+ return new GrGLDistanceFieldA8TextGeoProc(*this, bt);
}
///////////////////////////////////////////////////////////////////////////////
@@ -468,7 +468,7 @@
GrGLPrimitiveProcessor*
GrDistanceFieldPathGeoProc::createGLInstance(const GrBatchTracker& bt, const GrGLSLCaps&) const {
- return SkNEW_ARGS(GrGLDistanceFieldPathGeoProc, (*this, bt));
+ return new GrGLDistanceFieldPathGeoProc(*this, bt);
}
///////////////////////////////////////////////////////////////////////////////
@@ -741,7 +741,7 @@
GrGLPrimitiveProcessor*
GrDistanceFieldLCDTextGeoProc::createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const {
- return SkNEW_ARGS(GrGLDistanceFieldLCDTextGeoProc, (*this, bt));
+ return new GrGLDistanceFieldLCDTextGeoProc(*this, bt);
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.h b/src/gpu/effects/GrDistanceFieldGeoProc.h
index 42c397d..b0ebdb0 100644
--- a/src/gpu/effects/GrDistanceFieldGeoProc.h
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.h
@@ -50,15 +50,15 @@
static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix,
GrTexture* tex, const GrTextureParams& params,
float lum, uint32_t flags, bool usesLocalCoords) {
- return SkNEW_ARGS(GrDistanceFieldA8TextGeoProc, (color, viewMatrix, tex, params, lum,
- flags, usesLocalCoords));
+ return new GrDistanceFieldA8TextGeoProc(color, viewMatrix, tex, params, lum, flags,
+ usesLocalCoords);
}
#else
static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix,
GrTexture* tex, const GrTextureParams& params,
uint32_t flags, bool usesLocalCoords) {
- return SkNEW_ARGS(GrDistanceFieldA8TextGeoProc, (color, viewMatrix, tex, params, flags,
- usesLocalCoords));
+ return new GrDistanceFieldA8TextGeoProc(color, viewMatrix, tex, params, flags,
+ usesLocalCoords);
}
#endif
@@ -123,8 +123,8 @@
static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix, GrTexture* tex,
const GrTextureParams& params,
uint32_t flags, bool usesLocalCoords) {
- return SkNEW_ARGS(GrDistanceFieldPathGeoProc, (color, viewMatrix, tex, params, flags,
- usesLocalCoords));
+ return new GrDistanceFieldPathGeoProc(color, viewMatrix, tex, params, flags,
+ usesLocalCoords);
}
virtual ~GrDistanceFieldPathGeoProc() {}
@@ -194,8 +194,8 @@
GrTexture* tex, const GrTextureParams& params,
DistanceAdjust distanceAdjust, uint32_t flags,
bool usesLocalCoords) {
- return SkNEW_ARGS(GrDistanceFieldLCDTextGeoProc,
- (color, viewMatrix, tex, params, distanceAdjust, flags, usesLocalCoords));
+ return new GrDistanceFieldLCDTextGeoProc(color, viewMatrix, tex, params, distanceAdjust,
+ flags, usesLocalCoords);
}
virtual ~GrDistanceFieldLCDTextGeoProc() {}
diff --git a/src/gpu/effects/GrDitherEffect.cpp b/src/gpu/effects/GrDitherEffect.cpp
index 2b10ac0..33928a0 100644
--- a/src/gpu/effects/GrDitherEffect.cpp
+++ b/src/gpu/effects/GrDitherEffect.cpp
@@ -98,7 +98,7 @@
}
GrGLFragmentProcessor* DitherEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GLDitherEffect, (*this));
+ return new GLDitherEffect(*this);
}
GrFragmentProcessor* GrDitherEffect::Create() { return DitherEffect::Create(); }
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
index 3da4c54..c5a7fb7 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
@@ -162,7 +162,7 @@
}
GrGLFragmentProcessor* GrMatrixConvolutionEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GrGLMatrixConvolutionEffect, (*this));
+ return new GrGLMatrixConvolutionEffect(*this);
}
bool GrMatrixConvolutionEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
@@ -216,16 +216,8 @@
for (int i = 0; i < width * height; ++i) {
kernel[i] *= scale;
}
- return SkNEW_ARGS(GrMatrixConvolutionEffect, (procDataManager,
- texture,
- bounds,
- kernelSize,
- kernel,
- gain,
- bias,
- kernelOffset,
- tileMode,
- convolveAlpha));
+ return new GrMatrixConvolutionEffect(procDataManager, texture, bounds, kernelSize, kernel, gain,
+ bias, kernelOffset, tileMode, convolveAlpha);
}
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMatrixConvolutionEffect);
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.h b/src/gpu/effects/GrMatrixConvolutionEffect.h
index f3d6b24..0d6192d 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.h
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.h
@@ -28,16 +28,8 @@
const SkIPoint& kernelOffset,
GrTextureDomain::Mode tileMode,
bool convolveAlpha) {
- return SkNEW_ARGS(GrMatrixConvolutionEffect, (procDataManager,
- texture,
- bounds,
- kernelSize,
- kernel,
- gain,
- bias,
- kernelOffset,
- tileMode,
- convolveAlpha));
+ return new GrMatrixConvolutionEffect(procDataManager, texture, bounds, kernelSize, kernel,
+ gain, bias, kernelOffset, tileMode, convolveAlpha);
}
static GrFragmentProcessor* CreateGaussian(GrProcessorDataManager*,
diff --git a/src/gpu/effects/GrOvalEffect.cpp b/src/gpu/effects/GrOvalEffect.cpp
index 3fb7b90..dec6ae2 100644
--- a/src/gpu/effects/GrOvalEffect.cpp
+++ b/src/gpu/effects/GrOvalEffect.cpp
@@ -51,7 +51,7 @@
GrFragmentProcessor* CircleEffect::Create(GrPrimitiveEdgeType edgeType, const SkPoint& center,
SkScalar radius) {
SkASSERT(radius >= 0);
- return SkNEW_ARGS(CircleEffect, (edgeType, center, radius));
+ return new CircleEffect(edgeType, center, radius);
}
void CircleEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
@@ -177,7 +177,7 @@
}
GrGLFragmentProcessor* CircleEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GLCircleEffect, (*this));
+ return new GLCircleEffect(*this);
}
//////////////////////////////////////////////////////////////////////////////
@@ -221,7 +221,7 @@
SkScalar rx,
SkScalar ry) {
SkASSERT(rx >= 0 && ry >= 0);
- return SkNEW_ARGS(EllipseEffect, (edgeType, center, rx, ry));
+ return new EllipseEffect(edgeType, center, rx, ry);
}
void EllipseEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
@@ -353,7 +353,7 @@
}
GrGLFragmentProcessor* EllipseEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GLEllipseEffect, (*this));
+ return new GLEllipseEffect(*this);
}
//////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
index 0e1bc51..4a86aab 100644
--- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp
+++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
@@ -420,7 +420,7 @@
}
GrGLXferProcessor* PorterDuffXferProcessor::createGLInstance() const {
- return SkNEW(GLPorterDuffXferProcessor);
+ return new GLPorterDuffXferProcessor;
}
GrXferProcessor::OptFlags
@@ -518,7 +518,7 @@
}
GrGLXferProcessor* ShaderPDXferProcessor::createGLInstance() const {
- return SkNEW(GLShaderPDXferProcessor);
+ return new GLShaderPDXferProcessor;
}
///////////////////////////////////////////////////////////////////////////////
@@ -611,7 +611,7 @@
uint8_t alpha = GrColorUnpackA(blendConstant);
blendConstant |= (0xff << GrColor_SHIFT_A);
- return SkNEW_ARGS(PDLCDXferProcessor, (blendConstant, alpha));
+ return new PDLCDXferProcessor(blendConstant, alpha);
}
PDLCDXferProcessor::~PDLCDXferProcessor() {
@@ -623,7 +623,7 @@
}
GrGLXferProcessor* PDLCDXferProcessor::createGLInstance() const {
- return SkNEW_ARGS(GLPDLCDXferProcessor, (*this));
+ return new GLPDLCDXferProcessor(*this);
}
GrXferProcessor::OptFlags
@@ -691,11 +691,11 @@
BlendFormula blendFormula = get_blend_formula(colorPOI, covPOI, hasMixedSamples, fXfermode);
if (blendFormula.hasSecondaryOutput() && !caps.shaderCaps()->dualSourceBlendingSupport()) {
- return SkNEW_ARGS(ShaderPDXferProcessor, (dstTexture, hasMixedSamples, fXfermode));
+ return new ShaderPDXferProcessor(dstTexture, hasMixedSamples, fXfermode);
}
SkASSERT(!dstTexture || !dstTexture->texture());
- return SkNEW_ARGS(PorterDuffXferProcessor, (blendFormula));
+ return new PorterDuffXferProcessor(blendFormula);
}
bool GrPorterDuffXPFactory::supportsRGBCoverage(GrColor /*knownColor*/,
diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp
index 519d72c..62c6d3b 100644
--- a/src/gpu/effects/GrRRectEffect.cpp
+++ b/src/gpu/effects/GrRRectEffect.cpp
@@ -81,7 +81,7 @@
if (kFillAA_GrProcessorEdgeType != edgeType && kInverseFillAA_GrProcessorEdgeType != edgeType) {
return NULL;
}
- return SkNEW_ARGS(CircularRRectEffect, (edgeType, circularCornerFlags, rrect));
+ return new CircularRRectEffect(edgeType, circularCornerFlags, rrect);
}
void CircularRRectEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
@@ -368,7 +368,7 @@
}
GrGLFragmentProcessor* CircularRRectEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GLCircularRRectEffect, (*this));
+ return new GLCircularRRectEffect(*this);
}
//////////////////////////////////////////////////////////////////////////////
@@ -409,7 +409,7 @@
if (kFillAA_GrProcessorEdgeType != edgeType && kInverseFillAA_GrProcessorEdgeType != edgeType) {
return NULL;
}
- return SkNEW_ARGS(EllipticalRRectEffect, (edgeType, rrect));
+ return new EllipticalRRectEffect(edgeType, rrect);
}
void EllipticalRRectEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
@@ -617,7 +617,7 @@
}
GrGLFragmentProcessor* EllipticalRRectEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GLEllipticalRRectEffect, (*this));
+ return new GLEllipticalRRectEffect(*this);
}
//////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp
index 0bd1fcd..fb7c3a7 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.cpp
+++ b/src/gpu/effects/GrSimpleTextureEffect.cpp
@@ -43,7 +43,7 @@
}
GrGLFragmentProcessor* GrSimpleTextureEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GrGLSimpleTextureEffect, (*this));
+ return new GrGLSimpleTextureEffect(*this);
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/effects/GrSimpleTextureEffect.h b/src/gpu/effects/GrSimpleTextureEffect.h
index ab10ecf..7f66f90 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.h
+++ b/src/gpu/effects/GrSimpleTextureEffect.h
@@ -27,8 +27,8 @@
GrTexture* tex,
const SkMatrix& matrix,
GrCoordSet coordSet = kLocal_GrCoordSet) {
- return SkNEW_ARGS(GrSimpleTextureEffect, (procDataManager, tex, matrix,
- GrTextureParams::kNone_FilterMode, coordSet));
+ return new GrSimpleTextureEffect(procDataManager, tex, matrix,
+ GrTextureParams::kNone_FilterMode, coordSet);
}
/* clamp mode */
@@ -37,8 +37,7 @@
const SkMatrix& matrix,
GrTextureParams::FilterMode filterMode,
GrCoordSet coordSet = kLocal_GrCoordSet) {
- return SkNEW_ARGS(GrSimpleTextureEffect, (procDataManager, tex, matrix, filterMode,
- coordSet));
+ return new GrSimpleTextureEffect(procDataManager, tex, matrix, filterMode, coordSet);
}
static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager,
@@ -46,7 +45,7 @@
const SkMatrix& matrix,
const GrTextureParams& p,
GrCoordSet coordSet = kLocal_GrCoordSet) {
- return SkNEW_ARGS(GrSimpleTextureEffect, (procDataManager, tex, matrix, p, coordSet));
+ return new GrSimpleTextureEffect(procDataManager, tex, matrix, p, coordSet);
}
virtual ~GrSimpleTextureEffect() {}
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index e5ae18c..c1f9ef0 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -227,14 +227,8 @@
(GrTextureDomain::kClamp_Mode == mode && domain.contains(kFullRect))) {
return GrSimpleTextureEffect::Create(procDataManager, texture, matrix, filterMode);
} else {
-
- return SkNEW_ARGS(GrTextureDomainEffect, (procDataManager,
- texture,
- matrix,
- domain,
- mode,
- filterMode,
- coordSet));
+ return new GrTextureDomainEffect(procDataManager, texture, matrix, domain, mode, filterMode,
+ coordSet);
}
}
@@ -262,7 +256,7 @@
}
GrGLFragmentProcessor* GrTextureDomainEffect::onCreateGLInstance() const {
- return SkNEW_ARGS(GrGLTextureDomainEffect, (*this));
+ return new GrGLTextureDomainEffect(*this);
}
bool GrTextureDomainEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
diff --git a/src/gpu/effects/GrTextureStripAtlas.cpp b/src/gpu/effects/GrTextureStripAtlas.cpp
index e8de4d7..6aeaf6f 100644
--- a/src/gpu/effects/GrTextureStripAtlas.cpp
+++ b/src/gpu/effects/GrTextureStripAtlas.cpp
@@ -27,7 +27,7 @@
GrTextureStripAtlas::Hash* GrTextureStripAtlas::GetCache() {
if (NULL == gAtlasCache) {
- gAtlasCache = SkNEW(Hash);
+ gAtlasCache = new Hash;
}
return gAtlasCache;
@@ -43,10 +43,10 @@
GetCache()->remove(entry->fDesc);
// remove the actual entry
- SkDELETE(entry);
+ delete entry;
if (0 == GetCache()->count()) {
- SkDELETE(gAtlasCache);
+ delete gAtlasCache;
gAtlasCache = NULL;
}
}
@@ -54,9 +54,9 @@
GrTextureStripAtlas* GrTextureStripAtlas::GetAtlas(const GrTextureStripAtlas::Desc& desc) {
AtlasEntry* entry = GetCache()->find(desc);
if (NULL == entry) {
- entry = SkNEW(AtlasEntry);
+ entry = new AtlasEntry;
- entry->fAtlas = SkNEW_ARGS(GrTextureStripAtlas, (desc));
+ entry->fAtlas = new GrTextureStripAtlas(desc);
entry->fDesc = desc;
desc.fContext->addCleanUp(CleanUp, entry);
@@ -73,7 +73,7 @@
, fDesc(desc)
, fNumRows(desc.fHeight / desc.fRowHeight)
, fTexture(NULL)
- , fRows(SkNEW_ARRAY(AtlasRow, fNumRows))
+ , fRows(new AtlasRow[fNumRows])
, fLRUFront(NULL)
, fLRUBack(NULL) {
SkASSERT(fNumRows * fDesc.fRowHeight == fDesc.fHeight);
@@ -82,9 +82,7 @@
VALIDATE;
}
-GrTextureStripAtlas::~GrTextureStripAtlas() {
- SkDELETE_ARRAY(fRows);
-}
+GrTextureStripAtlas::~GrTextureStripAtlas() { delete[] fRows; }
int GrTextureStripAtlas::lockRow(const SkBitmap& data) {
VALIDATE;
diff --git a/src/gpu/effects/GrTextureStripAtlas.h b/src/gpu/effects/GrTextureStripAtlas.h
index 3b18706..98ac52a 100644
--- a/src/gpu/effects/GrTextureStripAtlas.h
+++ b/src/gpu/effects/GrTextureStripAtlas.h
@@ -146,7 +146,7 @@
// AtlasEntry proper
AtlasEntry() : fAtlas(NULL) {}
- ~AtlasEntry() { SkDELETE(fAtlas); }
+ ~AtlasEntry() { delete fAtlas; }
Desc fDesc;
GrTextureStripAtlas* fAtlas;
};
diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp
index 913c37e..84be8c3 100644
--- a/src/gpu/effects/GrYUVtoRGBEffect.cpp
+++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp
@@ -40,8 +40,8 @@
(sizes[2].fHeight != sizes[0].fHeight)) ?
GrTextureParams::kBilerp_FilterMode :
GrTextureParams::kNone_FilterMode;
- return SkNEW_ARGS(YUVtoRGBEffect, (procDataManager, yTexture, uTexture, vTexture, yuvMatrix,
- uvFilterMode, colorSpace));
+ return new YUVtoRGBEffect(procDataManager, yTexture, uTexture, vTexture, yuvMatrix,
+ uvFilterMode, colorSpace);
}
const char* name() const override { return "YUV to RGB"; }
@@ -123,9 +123,7 @@
this->addTextureAccess(&fVAccess);
}
- GrGLFragmentProcessor* onCreateGLInstance() const override {
- return SkNEW_ARGS(GLProcessor, (*this));
- }
+ GrGLFragmentProcessor* onCreateGLInstance() const override { return new GLProcessor(*this); }
virtual void onGetGLProcessorKey(const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const override {
diff --git a/src/gpu/gl/GrGLAssembleInterface.cpp b/src/gpu/gl/GrGLAssembleInterface.cpp
index 9b07246..adb11df 100644
--- a/src/gpu/gl/GrGLAssembleInterface.cpp
+++ b/src/gpu/gl/GrGLAssembleInterface.cpp
@@ -58,7 +58,7 @@
return NULL;
}
- GrGLInterface* interface = SkNEW(GrGLInterface());
+ GrGLInterface* interface = new GrGLInterface();
GrGLInterface::Functions* functions = &interface->fFunctions;
GET_PROC(ActiveTexture);
@@ -487,7 +487,7 @@
return NULL;
}
- GrGLInterface* interface = SkNEW(GrGLInterface);
+ GrGLInterface* interface = new GrGLInterface;
GrGLInterface::Functions* functions = &interface->fFunctions;
GET_PROC(ActiveTexture);
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index af0fa78..19d6a80 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -54,7 +54,7 @@
fReadPixelsSupportedCache.reset();
- fShaderCaps.reset(SkNEW_ARGS(GrGLSLCaps, (contextOptions)));
+ fShaderCaps.reset(new GrGLSLCaps(contextOptions));
this->init(contextOptions, ctxInfo, glInterface);
}
diff --git a/src/gpu/gl/GrGLContext.cpp b/src/gpu/gl/GrGLContext.cpp
index ee840b3..b4fb3ea 100644
--- a/src/gpu/gl/GrGLContext.cpp
+++ b/src/gpu/gl/GrGLContext.cpp
@@ -60,7 +60,7 @@
args.fContextOptions = &options;
- return SkNEW_ARGS(GrGLContext, (args));
+ return new GrGLContext(args);
}
GrGLContextInfo::GrGLContextInfo(const ConstructorArgs& args) {
@@ -72,5 +72,5 @@
fDriver = args.fDriver;
fDriverVersion = args.fDriverVersion;
- fGLCaps.reset(SkNEW_ARGS(GrGLCaps, (*args.fContextOptions, *this, fInterface)));
+ fGLCaps.reset(new GrGLCaps(*args.fContextOptions, *this, fInterface));
}
diff --git a/src/gpu/gl/GrGLCreateNullInterface.cpp b/src/gpu/gl/GrGLCreateNullInterface.cpp
index 886aacd..37d0285 100644
--- a/src/gpu/gl/GrGLCreateNullInterface.cpp
+++ b/src/gpu/gl/GrGLCreateNullInterface.cpp
@@ -24,16 +24,16 @@
BufferObj(GrGLuint id) : fID(id), fDataPtr(NULL), fSize(0), fMapped(false) {
}
- ~BufferObj() { SkDELETE_ARRAY(fDataPtr); }
+ ~BufferObj() { delete[] fDataPtr; }
void allocate(GrGLsizeiptr size, const GrGLchar* dataPtr) {
if (fDataPtr) {
SkASSERT(0 != fSize);
- SkDELETE_ARRAY(fDataPtr);
+ delete[] fDataPtr;
}
fSize = size;
- fDataPtr = SkNEW_ARRAY(char, size);
+ fDataPtr = new char[size];
}
GrGLuint id() const { return fID; }
@@ -82,14 +82,14 @@
if (kFreeListEnd == fFreeListHead) {
// no free slots - create a new one
id = fBuffers.count();
- buffer = SkNEW_ARGS(BufferObj, (id));
+ buffer = new BufferObj(id);
*fBuffers.append() = buffer;
} else {
// grab the head of the free list and advance the head to the next free slot.
id = static_cast<GrGLuint>(fFreeListHead);
fFreeListHead = reinterpret_cast<intptr_t>(fBuffers[id]);
- buffer = SkNEW_ARGS(BufferObj, (id));
+ buffer = new BufferObj(id);
fBuffers[id] = buffer;
}
@@ -100,7 +100,7 @@
SkASSERT(fBuffers.count() > 0);
GrGLuint id = buffer->id();
- SkDELETE(buffer);
+ delete buffer;
fBuffers[id] = reinterpret_cast<BufferObj*>(fFreeListHead);
fFreeListHead = id;
@@ -141,8 +141,8 @@
, fCurrShaderID(0) {}
private:
- static void* Create() { return SkNEW(ThreadContext ); }
- static void Delete(void* context) { SkDELETE(reinterpret_cast<ThreadContext *>(context)); }
+ static void* Create() { return new ThreadContext; }
+ static void Delete(void* context) { delete reinterpret_cast<ThreadContext*>(context); }
};
// Functions not declared in GrGLBogusInterface.h (not common with the Debug GL interface).
@@ -343,7 +343,7 @@
} // end anonymous namespace
const GrGLInterface* GrGLCreateNullInterface() {
- GrGLInterface* interface = SkNEW(GrGLInterface);
+ GrGLInterface* interface = new GrGLInterface;
interface->fStandard = kGL_GrGLStandard;
diff --git a/src/gpu/gl/GrGLExtensions.cpp b/src/gpu/gl/GrGLExtensions.cpp
index 5ccb339..f2d54ff 100644
--- a/src/gpu/gl/GrGLExtensions.cpp
+++ b/src/gpu/gl/GrGLExtensions.cpp
@@ -31,7 +31,7 @@
return idx;
}
-GrGLExtensions::GrGLExtensions(const GrGLExtensions& that) : fStrings(SkNEW(SkTArray<SkString>)) {
+GrGLExtensions::GrGLExtensions(const GrGLExtensions& that) : fStrings(new SkTArray<SkString>) {
*this = that;
}
@@ -112,7 +112,7 @@
// This is not terribly effecient but we really only expect this function to be called at
// most a handful of times when our test programs start.
SkAutoTDelete< SkTArray<SkString> > oldStrings(fStrings.detach());
- fStrings.reset(SkNEW(SkTArray<SkString>(oldStrings->count() - 1)));
+ fStrings.reset(new SkTArray<SkString>(oldStrings->count() - 1));
fStrings->push_back_n(idx, &oldStrings->front());
fStrings->push_back_n(oldStrings->count() - idx - 1, &(*oldStrings)[idx] + 1);
return true;
diff --git a/src/gpu/gl/GrGLFragmentProcessor.h b/src/gpu/gl/GrGLFragmentProcessor.h
index c46b002..05ee375 100644
--- a/src/gpu/gl/GrGLFragmentProcessor.h
+++ b/src/gpu/gl/GrGLFragmentProcessor.h
@@ -20,7 +20,7 @@
virtual ~GrGLFragmentProcessor() {
for (int i = 0; i < fChildProcessors.count(); ++i) {
- SkDELETE(fChildProcessors[i]);
+ delete fChildProcessors[i];
}
}
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 9cc699c..92cfba1 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -173,7 +173,7 @@
}
GrGLContext* glContext = GrGLContext::Create(glInterface, options);
if (glContext) {
- return SkNEW_ARGS(GrGLGpu, (glContext, context));
+ return new GrGLGpu(glContext, context);
}
return NULL;
}
@@ -207,7 +207,7 @@
SkDebugf("%s", this->glCaps().dump().c_str());
}
- fProgramCache = SkNEW_ARGS(ProgramCache, (this));
+ fProgramCache = new ProgramCache(this);
SkASSERT(this->glCaps().maxVertexAttributes() >= GrGeometryProcessor::kMaxVertexAttribs);
@@ -449,9 +449,9 @@
idDesc.fTextureID, &rtIDDesc)) {
return NULL;
}
- texture = SkNEW_ARGS(GrGLTextureRenderTarget, (this, surfDesc, idDesc, rtIDDesc));
+ texture = new GrGLTextureRenderTarget(this, surfDesc, idDesc, rtIDDesc);
} else {
- texture = SkNEW_ARGS(GrGLTexture, (this, surfDesc, idDesc));
+ texture = new GrGLTexture(this, surfDesc, idDesc);
}
if (NULL == texture) {
return NULL;
@@ -484,7 +484,7 @@
desc.fSampleCnt = SkTMin(wrapDesc.fSampleCnt, this->caps()->maxSampleCount());
desc.fOrigin = resolve_origin(wrapDesc.fOrigin, true);
- GrRenderTarget* tgt = SkNEW_ARGS(GrGLRenderTarget, (this, desc, idDesc));
+ GrRenderTarget* tgt = new GrGLRenderTarget(this, desc, idDesc);
if (wrapDesc.fStencilBits) {
GrGLStencilAttachment::IDDesc sbDesc;
GrGLStencilAttachment::Format format;
@@ -492,13 +492,8 @@
format.fPacked = false;
format.fStencilBits = wrapDesc.fStencilBits;
format.fTotalBits = wrapDesc.fStencilBits;
- GrGLStencilAttachment* sb = SkNEW_ARGS(GrGLStencilAttachment,
- (this,
- sbDesc,
- desc.fWidth,
- desc.fHeight,
- desc.fSampleCnt,
- format));
+ GrGLStencilAttachment* sb = new GrGLStencilAttachment(
+ this, sbDesc, desc.fWidth, desc.fHeight, desc.fSampleCnt, format);
tgt->renderTargetPriv().didAttachStencilAttachment(sb);
sb->unref();
}
@@ -1083,9 +1078,9 @@
GL_CALL(DeleteTextures(1, &idDesc.fTextureID));
return return_null_texture();
}
- tex = SkNEW_ARGS(GrGLTextureRenderTarget, (this, desc, idDesc, rtIDDesc));
+ tex = new GrGLTextureRenderTarget(this, desc, idDesc, rtIDDesc);
} else {
- tex = SkNEW_ARGS(GrGLTexture, (this, desc, idDesc));
+ tex = new GrGLTexture(this, desc, idDesc);
}
tex->setCachedTexParams(initialTexParams, this->getResetTimestamp());
#ifdef TRACE_TEXTURE_CREATION
@@ -1143,7 +1138,7 @@
}
GrGLTexture* tex;
- tex = SkNEW_ARGS(GrGLTexture, (this, desc, idDesc));
+ tex = new GrGLTexture(this, desc, idDesc);
tex->setCachedTexParams(initialTexParams, this->getResetTimestamp());
#ifdef TRACE_TEXTURE_CREATION
SkDebugf("--- new compressed texture [%d] size=(%d %d) config=%d\n",
@@ -1223,8 +1218,8 @@
// whatever sizes GL gives us. In that case we query for the size.
GrGLStencilAttachment::Format format = sFmt;
get_stencil_rb_sizes(this->glInterface(), &format);
- SkAutoTUnref<GrGLStencilAttachment> sb(SkNEW_ARGS(GrGLStencilAttachment,
- (this, sbDesc, width, height, samples, format)));
+ SkAutoTUnref<GrGLStencilAttachment> sb(
+ new GrGLStencilAttachment(this, sbDesc, width, height, samples, format));
if (this->attachStencilAttachmentToRenderTarget(sb, rt)) {
fLastSuccessfulStencilFmtIdx = sIdx;
rt->renderTargetPriv().didAttachStencilAttachment(sb);
@@ -1366,7 +1361,7 @@
if (this->glCaps().useNonVBOVertexAndIndexDynamicData() && desc.fDynamic) {
desc.fID = 0;
- GrGLVertexBuffer* vertexBuffer = SkNEW_ARGS(GrGLVertexBuffer, (this, desc));
+ GrGLVertexBuffer* vertexBuffer = new GrGLVertexBuffer(this, desc);
return vertexBuffer;
} else {
GL_CALL(GenBuffers(1, &desc.fID));
@@ -1384,7 +1379,7 @@
this->notifyVertexBufferDelete(desc.fID);
return NULL;
}
- GrGLVertexBuffer* vertexBuffer = SkNEW_ARGS(GrGLVertexBuffer, (this, desc));
+ GrGLVertexBuffer* vertexBuffer = new GrGLVertexBuffer(this, desc);
return vertexBuffer;
}
return NULL;
@@ -1398,7 +1393,7 @@
if (this->glCaps().useNonVBOVertexAndIndexDynamicData() && desc.fDynamic) {
desc.fID = 0;
- GrIndexBuffer* indexBuffer = SkNEW_ARGS(GrGLIndexBuffer, (this, desc));
+ GrIndexBuffer* indexBuffer = new GrGLIndexBuffer(this, desc);
return indexBuffer;
} else {
GL_CALL(GenBuffers(1, &desc.fID));
@@ -1416,7 +1411,7 @@
this->notifyIndexBufferDelete(desc.fID);
return NULL;
}
- GrIndexBuffer* indexBuffer = SkNEW_ARGS(GrGLIndexBuffer, (this, desc));
+ GrIndexBuffer* indexBuffer = new GrGLIndexBuffer(this, desc);
return indexBuffer;
}
return NULL;
@@ -3182,7 +3177,7 @@
GrGLuint arrayID;
GR_GL_CALL(gpu->glInterface(), GenVertexArrays(1, &arrayID));
int attrCount = gpu->glCaps().maxVertexAttributes();
- fVBOVertexArray = SkNEW_ARGS(GrGLVertexArray, (arrayID, attrCount));
+ fVBOVertexArray = new GrGLVertexArray(arrayID, attrCount);
}
if (ibufferID) {
attribState = fVBOVertexArray->bindWithIndexBuffer(gpu, *ibufferID);
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index defb81a..4be8a76 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -341,7 +341,7 @@
public:
HWGeometryState() { fVBOVertexArray = NULL; this->invalidate(); }
- ~HWGeometryState() { SkDELETE(fVBOVertexArray); }
+ ~HWGeometryState() { delete fVBOVertexArray; }
void invalidate() {
fBoundVertexArrayIDIsValid = false;
diff --git a/src/gpu/gl/GrGLGpuProgramCache.cpp b/src/gpu/gl/GrGLGpuProgramCache.cpp
index 11e237a..c6b673b 100644
--- a/src/gpu/gl/GrGLGpuProgramCache.cpp
+++ b/src/gpu/gl/GrGLGpuProgramCache.cpp
@@ -58,7 +58,7 @@
GrGLGpu::ProgramCache::~ProgramCache() {
for (int i = 0; i < fCount; ++i){
- SkDELETE(fEntries[i]);
+ delete fEntries[i];
}
// dump stats
#ifdef PROGRAM_CACHE_STATS
@@ -80,7 +80,7 @@
for (int i = 0; i < fCount; ++i) {
SkASSERT(fEntries[i]->fProgram.get());
fEntries[i]->fProgram->abandon();
- SkDELETE(fEntries[i]);
+ delete fEntries[i];
}
fCount = 0;
}
@@ -131,7 +131,7 @@
}
int purgeIdx = 0;
if (fCount < kMaxEntries) {
- entry = SkNEW(Entry);
+ entry = new Entry;
purgeIdx = fCount++;
fEntries[purgeIdx] = entry;
} else {
diff --git a/src/gpu/gl/GrGLInterface.cpp b/src/gpu/gl/GrGLInterface.cpp
index ffc2ea0..fca7bf2 100644
--- a/src/gpu/gl/GrGLInterface.cpp
+++ b/src/gpu/gl/GrGLInterface.cpp
@@ -75,7 +75,7 @@
GrGLInterface* GrGLInterface::NewClone(const GrGLInterface* interface) {
SkASSERT(interface);
- GrGLInterface* clone = SkNEW(GrGLInterface);
+ GrGLInterface* clone = new GrGLInterface;
clone->fStandard = interface->fStandard;
clone->fExtensions = interface->fExtensions;
clone->fFunctions = interface->fFunctions;
diff --git a/src/gpu/gl/GrGLNameAllocator.cpp b/src/gpu/gl/GrGLNameAllocator.cpp
index 94792f1..49d4564 100644
--- a/src/gpu/gl/GrGLNameAllocator.cpp
+++ b/src/gpu/gl/GrGLNameAllocator.cpp
@@ -319,10 +319,10 @@
return this->takeRef();
}
- SparseNameRange* left = SkNEW_ARGS(ContiguousNameRange, (fFirst, name));
+ SparseNameRange* left = new ContiguousNameRange(fFirst, name);
SparseNameRange* right = this->takeRef();
fFirst = name + 1;
- return SkNEW_ARGS(SparseNameTree, (left, right));
+ return new SparseNameTree(left, right);
}
};
@@ -338,7 +338,7 @@
GrGLuint GrGLNameAllocator::allocateName() {
if (NULL == fAllocatedNames.get()) {
- fAllocatedNames.reset(SkNEW_ARGS(ContiguousNameRange, (fFirstName, fFirstName + 1)));
+ fAllocatedNames.reset(new ContiguousNameRange(fFirstName, fFirstName + 1));
return fFirstName;
}
diff --git a/src/gpu/gl/GrGLPathRendering.cpp b/src/gpu/gl/GrGLPathRendering.cpp
index 7c77155..22b12bf 100644
--- a/src/gpu/gl/GrGLPathRendering.cpp
+++ b/src/gpu/gl/GrGLPathRendering.cpp
@@ -82,12 +82,12 @@
}
GrPath* GrGLPathRendering::createPath(const SkPath& inPath, const GrStrokeInfo& stroke) {
- return SkNEW_ARGS(GrGLPath, (this->gpu(), inPath, stroke));
+ return new GrGLPath(this->gpu(), inPath, stroke);
}
GrPathRange* GrGLPathRendering::createPathRange(GrPathRange::PathGenerator* pathGenerator,
const GrStrokeInfo& stroke) {
- return SkNEW_ARGS(GrGLPathRange, (this->gpu(), pathGenerator, stroke));
+ return new GrGLPathRange(this->gpu(), pathGenerator, stroke);
}
void GrGLPathRendering::onStencilPath(const StencilPathArgs& args, const GrPath* path) {
@@ -240,7 +240,7 @@
static const int range = 65536;
GrGLuint firstName;
GL_CALL_RET(firstName, GenPaths(range));
- fPathNameAllocator.reset(SkNEW_ARGS(GrGLNameAllocator, (firstName, firstName + range)));
+ fPathNameAllocator.reset(new GrGLNameAllocator(firstName, firstName + range));
}
// When allocating names one at a time, pull from a client-side pool of
diff --git a/src/gpu/gl/SkGLContext.cpp b/src/gpu/gl/SkGLContext.cpp
index 8975a98..75fbf2b 100644
--- a/src/gpu/gl/SkGLContext.cpp
+++ b/src/gpu/gl/SkGLContext.cpp
@@ -105,7 +105,7 @@
}
SkGLContext::GLFenceSync* SkGLContext::GLFenceSync::CreateIfSupported(const SkGLContext* ctx) {
- SkAutoTDelete<GLFenceSync> ret(SkNEW(GLFenceSync));
+ SkAutoTDelete<GLFenceSync> ret(new GLFenceSync);
if (kGL_GrGLStandard == ctx->gl()->fStandard) {
const GrGLubyte* versionStr;
diff --git a/src/gpu/gl/SkNullGLContext.cpp b/src/gpu/gl/SkNullGLContext.cpp
index c59fb98..dddea76 100644
--- a/src/gpu/gl/SkNullGLContext.cpp
+++ b/src/gpu/gl/SkNullGLContext.cpp
@@ -22,16 +22,16 @@
BufferObj(GrGLuint id) : fID(id), fDataPtr(NULL), fSize(0), fMapped(false) {}
- ~BufferObj() { SkDELETE_ARRAY(fDataPtr); }
+ ~BufferObj() { delete[] fDataPtr; }
void allocate(GrGLsizeiptr size, const GrGLchar* dataPtr) {
if (fDataPtr) {
SkASSERT(0 != fSize);
- SkDELETE_ARRAY(fDataPtr);
+ delete[] fDataPtr;
}
fSize = size;
- fDataPtr = SkNEW_ARRAY(char, size);
+ fDataPtr = new char[size];
}
GrGLuint id() const { return fID; }
@@ -80,14 +80,14 @@
if (kFreeListEnd == fFreeListHead) {
// no free slots - create a new one
id = fBuffers.count();
- buffer = SkNEW_ARGS(BufferObj, (id));
+ buffer = new BufferObj(id);
*fBuffers.append() = buffer;
} else {
// grab the head of the free list and advance the head to the next free slot.
id = static_cast<GrGLuint>(fFreeListHead);
fFreeListHead = reinterpret_cast<intptr_t>(fBuffers[id]);
- buffer = SkNEW_ARGS(BufferObj, (id));
+ buffer = new BufferObj(id);
fBuffers[id] = buffer;
}
@@ -98,7 +98,7 @@
SkASSERT(fBuffers.count() > 0);
GrGLuint id = buffer->id();
- SkDELETE(buffer);
+ delete buffer;
fBuffers[id] = reinterpret_cast<BufferObj*>(fFreeListHead);
fFreeListHead = id;
@@ -346,7 +346,7 @@
} // end anonymous namespace
static GrGLInterface* create_null_interface(State* state) {
- GrGLInterface* interface = SkNEW_ARGS(NullInterface, (state));
+ GrGLInterface* interface = new NullInterface(state);
interface->fStandard = kGL_GrGLStandard;
@@ -498,7 +498,7 @@
//////////////////////////////////////////////////////////////////////////////
static void* create_tls() {
- State** current = SkNEW(State*);
+ State** current = new State*;
*current = NULL;
return current;
}
@@ -508,7 +508,7 @@
if (*current) {
(*current)->unref();
}
- SkDELETE(current);
+ delete current;
}
static State* current_context() {
@@ -536,16 +536,16 @@
if (kGLES_GrGLStandard == forcedGpuAPI) {
return NULL;
}
- SkNullGLContext* ctx = SkNEW(SkNullGLContext);
+ SkNullGLContext* ctx = new SkNullGLContext;
if (!ctx->isValid()) {
- SkDELETE(ctx);
+ delete ctx;
return NULL;
}
return ctx;
}
SkNullGLContext::SkNullGLContext() {
- fState = SkNEW(ContextState);
+ fState = new ContextState;
GrGLInterface* interface = create_null_interface(fState);
this->init(interface);
#if GR_GL_PER_GL_FUNC_CALLBACK
diff --git a/src/gpu/gl/builders/GrGLPathProgramBuilder.cpp b/src/gpu/gl/builders/GrGLPathProgramBuilder.cpp
index 9bebe0d..426676f 100644
--- a/src/gpu/gl/builders/GrGLPathProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLPathProgramBuilder.cpp
@@ -18,12 +18,9 @@
}
GrGLProgram* GrGLPathProgramBuilder::createProgram(GrGLuint programID) {
- return SkNEW_ARGS(GrGLPathProgram, (fGpu, this->desc(), fUniformHandles, programID,
- fUniforms,
- fSeparableVaryingInfos,
- fGeometryProcessor,
- fXferProcessor, fFragmentProcessors.get(),
- &fSamplerUniforms));
+ return new GrGLPathProgram(fGpu, this->desc(), fUniformHandles, programID, fUniforms,
+ fSeparableVaryingInfos, fGeometryProcessor, fXferProcessor,
+ fFragmentProcessors.get(), &fSamplerUniforms);
}
GrGLProgramBuilder::SeparableVaryingHandle GrGLPathProgramBuilder::addSeparableVarying(
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index 2db5686..39d8ec5 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -55,9 +55,9 @@
SkASSERT(gpu->glCaps().shaderCaps()->pathRenderingSupport() &&
!args.fPrimitiveProcessor->willUseGeoShader() &&
args.fPrimitiveProcessor->numAttribs() == 0);
- return SkNEW_ARGS(GrGLPathProgramBuilder, (gpu, args));
+ return new GrGLPathProgramBuilder(gpu, args);
} else {
- return SkNEW_ARGS(GrGLProgramBuilder, (gpu, args));
+ return new GrGLProgramBuilder(gpu, args);
}
}
@@ -203,7 +203,7 @@
this->emitAndInstallProc(primProc, inputColor, inputCoverage);
- fFragmentProcessors.reset(SkNEW(GrGLInstalledFragProcs));
+ fFragmentProcessors.reset(new GrGLInstalledFragProcs);
int numProcs = this->pipeline().numFragmentStages();
this->emitAndInstallFragProcs(0, this->pipeline().numColorFragmentStages(), inputColor);
this->emitAndInstallFragProcs(this->pipeline().numColorFragmentStages(), numProcs,
@@ -280,7 +280,7 @@
int index,
const char* outColor,
const char* inColor) {
- GrGLInstalledFragProc* ifp = SkNEW(GrGLInstalledFragProc);
+ GrGLInstalledFragProc* ifp = new GrGLInstalledFragProc;
const GrFragmentProcessor& fp = *fs.processor();
ifp->fGLProc.reset(fp.createGLInstance());
@@ -301,7 +301,7 @@
const char* outColor,
const char* outCoverage) {
SkASSERT(!fGeometryProcessor);
- fGeometryProcessor = SkNEW(GrGLInstalledGeoProc);
+ fGeometryProcessor = new GrGLInstalledGeoProc;
const GrBatchTracker& bt = this->batchTracker();
fGeometryProcessor->fGLProc.reset(gp.createGLInstance(bt, *fGpu->glCaps().glslCaps()));
@@ -325,7 +325,7 @@
AutoStageAdvance adv(this);
SkASSERT(!fXferProcessor);
- fXferProcessor = SkNEW(GrGLInstalledXferProc);
+ fXferProcessor = new GrGLInstalledXferProc;
fXferProcessor->fGLProc.reset(xp.createGLInstance());
@@ -492,9 +492,9 @@
}
GrGLProgram* GrGLProgramBuilder::createProgram(GrGLuint programID) {
- return SkNEW_ARGS(GrGLProgram, (fGpu, this->desc(), fUniformHandles, programID, fUniforms,
- fGeometryProcessor, fXferProcessor, fFragmentProcessors.get(),
- &fSamplerUniforms));
+ return new GrGLProgram(fGpu, this->desc(), fUniformHandles, programID, fUniforms,
+ fGeometryProcessor, fXferProcessor, fFragmentProcessors.get(),
+ &fSamplerUniforms);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -502,6 +502,6 @@
GrGLInstalledFragProcs::~GrGLInstalledFragProcs() {
int numProcs = fProcs.count();
for (int e = 0; e < numProcs; ++e) {
- SkDELETE(fProcs[e]);
+ delete fProcs[e];
}
}
diff --git a/src/gpu/gl/debug/GrDebugGL.h b/src/gpu/gl/debug/GrDebugGL.h
index 9192725..ae6a978 100644
--- a/src/gpu/gl/debug/GrDebugGL.h
+++ b/src/gpu/gl/debug/GrDebugGL.h
@@ -93,7 +93,7 @@
SkASSERT(0 < gStaticRefCount);
if (NULL == gObj) {
- gObj = SkNEW(GrDebugGL);
+ gObj = new GrDebugGL;
}
return gObj;
@@ -109,7 +109,7 @@
SkASSERT(gStaticRefCount > 0);
gStaticRefCount--;
if (0 == gStaticRefCount) {
- SkDELETE(gObj);
+ delete gObj;
gObj = NULL;
}
}
diff --git a/src/gpu/gl/debug/GrFakeRefObj.h b/src/gpu/gl/debug/GrFakeRefObj.h
index 27e27ce..3058051 100644
--- a/src/gpu/gl/debug/GrFakeRefObj.h
+++ b/src/gpu/gl/debug/GrFakeRefObj.h
@@ -79,10 +79,8 @@
// factory creation entry point. This entry point is used by the GrGLDebug
// object to instantiate the various objects
// all globally unique IDs
-#define GR_DEFINE_CREATOR(className) \
- public: \
- static GrFakeRefObj *create ## className() { \
- return SkNEW(className); \
- }
+#define GR_DEFINE_CREATOR(className) \
+public: \
+ static GrFakeRefObj *create##className() { return new className; }
#endif // GrFakeRefObj_DEFINED
diff --git a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
index 8b0f8c5..ef52fb6 100644
--- a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
+++ b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
@@ -836,7 +836,7 @@
////////////////////////////////////////////////////////////////////////////////
const GrGLInterface* GrGLCreateDebugInterface() {
- GrGLInterface* interface = SkNEW(GrDebugGLInterface);
+ GrGLInterface *interface = new GrDebugGLInterface;
interface->fStandard = kGL_GrGLStandard;
diff --git a/src/gpu/gl/debug/SkDebugGLContext.h b/src/gpu/gl/debug/SkDebugGLContext.h
index 6a4d9fc..0a61f72 100644
--- a/src/gpu/gl/debug/SkDebugGLContext.h
+++ b/src/gpu/gl/debug/SkDebugGLContext.h
@@ -18,7 +18,7 @@
if (kGLES_GrGLStandard == forcedGpuAPI) {
return NULL;
}
- return SkNEW(SkDebugGLContext);
+ return new SkDebugGLContext;
}
private:
void onPlatformMakeCurrent() const override {}
diff --git a/src/gpu/gl/egl/SkCreatePlatformGLContext_egl.cpp b/src/gpu/gl/egl/SkCreatePlatformGLContext_egl.cpp
index 9ed57a3..9bdedf7 100644
--- a/src/gpu/gl/egl/SkCreatePlatformGLContext_egl.cpp
+++ b/src/gpu/gl/egl/SkCreatePlatformGLContext_egl.cpp
@@ -236,7 +236,7 @@
if (!display || !supports_egl_extension(display, "EGL_KHR_fence_sync")) {
return NULL;
}
- return SkNEW_ARGS(SkEGLFenceSync, (display));
+ return new SkEGLFenceSync(display);
}
SkPlatformGpuFence SkEGLFenceSync::insertFence() const {
@@ -259,9 +259,9 @@
} // anonymous namespace
SkGLContext* SkCreatePlatformGLContext(GrGLStandard forcedGpuAPI) {
- EGLGLContext* ctx = SkNEW_ARGS(EGLGLContext, (forcedGpuAPI));
+ EGLGLContext* ctx = new EGLGLContext(forcedGpuAPI);
if (!ctx->isValid()) {
- SkDELETE(ctx);
+ delete ctx;
return NULL;
}
return ctx;
diff --git a/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp b/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp
index 7933757..cabd443 100644
--- a/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp
+++ b/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp
@@ -332,9 +332,9 @@
} // anonymous namespace
SkGLContext* SkCreatePlatformGLContext(GrGLStandard forcedGpuAPI) {
- GLXGLContext* ctx = SkNEW_ARGS(GLXGLContext, (forcedGpuAPI));
+ GLXGLContext *ctx = new GLXGLContext(forcedGpuAPI);
if (!ctx->isValid()) {
- SkDELETE(ctx);
+ delete ctx;
return NULL;
}
return ctx;
diff --git a/src/gpu/gl/mac/SkCreatePlatformGLContext_mac.cpp b/src/gpu/gl/mac/SkCreatePlatformGLContext_mac.cpp
index d2d8569..4754c01 100644
--- a/src/gpu/gl/mac/SkCreatePlatformGLContext_mac.cpp
+++ b/src/gpu/gl/mac/SkCreatePlatformGLContext_mac.cpp
@@ -110,9 +110,9 @@
if (kGLES_GrGLStandard == forcedGpuAPI) {
return NULL;
}
- MacGLContext* ctx = SkNEW(MacGLContext);
+ MacGLContext* ctx = new MacGLContext;
if (!ctx->isValid()) {
- SkDELETE(ctx);
+ delete ctx;
return NULL;
}
return ctx;
diff --git a/src/gpu/gl/mesa/SkMesaGLContext.h b/src/gpu/gl/mesa/SkMesaGLContext.h
index fa3df7b..1548bfd 100644
--- a/src/gpu/gl/mesa/SkMesaGLContext.h
+++ b/src/gpu/gl/mesa/SkMesaGLContext.h
@@ -23,9 +23,9 @@
if (kGLES_GrGLStandard == forcedGpuAPI) {
return NULL;
}
- SkMesaGLContext* ctx = SkNEW(SkMesaGLContext);
+ SkMesaGLContext* ctx = new SkMesaGLContext;
if (!ctx->isValid()) {
- SkDELETE(ctx);
+ delete ctx;
return NULL;
}
return ctx;
diff --git a/src/gpu/gl/win/SkCreatePlatformGLContext_win.cpp b/src/gpu/gl/win/SkCreatePlatformGLContext_win.cpp
index 8a4c5db..0517f73 100644
--- a/src/gpu/gl/win/SkCreatePlatformGLContext_win.cpp
+++ b/src/gpu/gl/win/SkCreatePlatformGLContext_win.cpp
@@ -188,9 +188,9 @@
} // anonymous namespace
SkGLContext* SkCreatePlatformGLContext(GrGLStandard forcedGpuAPI) {
- WinGLContext* ctx = SkNEW_ARGS(WinGLContext, (forcedGpuAPI));
+ WinGLContext* ctx = new WinGLContext(forcedGpuAPI);
if (!ctx->isValid()) {
- SkDELETE(ctx);
+ delete ctx;
return NULL;
}
return ctx;
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp
index 715b4f4..3cefec2 100644
--- a/src/image/SkImage.cpp
+++ b/src/image/SkImage.cpp
@@ -247,8 +247,8 @@
unrefCopy.reset(tex);
}
const SkImageInfo info = bm.info();
- return SkNEW_ARGS(SkImage_Gpu, (info.width(), info.height(), bm.getGenerationID(),
- info.alphaType(), tex, 0, SkSurface::kNo_Budgeted));
+ return new SkImage_Gpu(info.width(), info.height(), bm.getGenerationID(), info.alphaType(),
+ tex, 0, SkSurface::kNo_Budgeted);
}
#endif
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index d172df8..1be6eaa 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -149,9 +149,7 @@
}
const SkSurface::Budgeted budgeted = SkSurface::kNo_Budgeted;
- return SkNEW_ARGS(SkImage_Gpu,
- (desc.fWidth, desc.fHeight, kNeedNewImageUniqueID, at, tex, 0, budgeted));
-
+ return new SkImage_Gpu(desc.fWidth, desc.fHeight, kNeedNewImageUniqueID, at, tex, 0, budgeted);
}
SkImage* SkImage::NewFromTexture(GrContext* ctx, const GrBackendTextureDesc& desc, SkAlphaType at,
@@ -184,8 +182,8 @@
const SkSurface::Budgeted budgeted = SkSurface::kYes_Budgeted;
const int sampleCount = 0; // todo: make this an explicit parameter to newSurface()?
- return SkNEW_ARGS(SkImage_Gpu, (desc.fWidth, desc.fHeight, kNeedNewImageUniqueID,
- at, dst, sampleCount, budgeted));
+ return new SkImage_Gpu(desc.fWidth, desc.fHeight, kNeedNewImageUniqueID, at, dst, sampleCount,
+ budgeted);
}
SkImage* SkImage::NewFromYUVTexturesCopy(GrContext* ctx , SkYUVColorSpace colorSpace,
@@ -258,8 +256,8 @@
GrDrawContext* drawContext = ctx->drawContext();
drawContext->drawRect(dst->asRenderTarget(), GrClip::WideOpen(), paint, SkMatrix::I(), rect);
ctx->flushSurfaceWrites(dst);
- return SkNEW_ARGS(SkImage_Gpu, (dstDesc.fWidth, dstDesc.fHeight, kNeedNewImageUniqueID,
- kOpaque_SkAlphaType, dst, 0, budgeted));
+ return new SkImage_Gpu(dstDesc.fWidth, dstDesc.fHeight, kNeedNewImageUniqueID,
+ kOpaque_SkAlphaType, dst, 0, budgeted);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp
index 51bc6f0..3486114 100644
--- a/src/image/SkImage_Raster.cpp
+++ b/src/image/SkImage_Raster.cpp
@@ -191,7 +191,7 @@
// Here we actually make a copy of the caller's pixel data
SkAutoDataUnref data(SkData::NewWithCopy(pixels, size));
- return SkNEW_ARGS(SkImage_Raster, (info, data, rowBytes, ctable, NULL));
+ return new SkImage_Raster(info, data, rowBytes, ctable, NULL);
}
@@ -207,7 +207,7 @@
}
SkColorTable* ctable = NULL;
- return SkNEW_ARGS(SkImage_Raster, (info, data, rowBytes, ctable, NULL));
+ return new SkImage_Raster(info, data, rowBytes, ctable, NULL);
}
SkImage* SkImage::NewFromRaster(const SkImageInfo& info, const void* pixels, size_t rowBytes,
@@ -219,7 +219,7 @@
SkColorTable* ctable = NULL;
SkAutoDataUnref data(SkData::NewWithProc(pixels, size, proc, ctx));
- return SkNEW_ARGS(SkImage_Raster, (info, data, rowBytes, ctable, NULL));
+ return new SkImage_Raster(info, data, rowBytes, ctable, NULL);
}
SkImage* SkImage::NewFromGenerator(SkImageGenerator* generator, const SkIRect* subset) {
@@ -231,7 +231,7 @@
return NULL;
}
- return SkNEW_ARGS(SkImage_Raster, (bitmap, NULL));
+ return new SkImage_Raster(bitmap, NULL);
}
SkImage* SkNewImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr,
@@ -240,7 +240,7 @@
if (!SkImage_Raster::ValidArgs(info, rowBytes, NULL, NULL)) {
return NULL;
}
- return SkNEW_ARGS(SkImage_Raster, (info, pr, pixelRefOrigin, rowBytes, props));
+ return new SkImage_Raster(info, pr, pixelRefOrigin, rowBytes, props);
}
SkImage* SkNewImageFromRasterBitmap(const SkBitmap& bm, const SkSurfaceProps* props,
@@ -265,7 +265,7 @@
as_IB(image)->initWithProps(*props);
}
} else {
- image = SkNEW_ARGS(SkImage_Raster, (bm, props));
+ image = new SkImage_Raster(bm, props);
}
return image;
}
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index f0719d8..34671f7 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -66,7 +66,7 @@
// When we think this works...
// flags |= SkCanvas::kConservativeRasterClip_InitFlag;
- return SkNEW_ARGS(SkCanvas, (fDevice, flags));
+ return new SkCanvas(fDevice, flags);
}
SkSurface* SkSurface_Gpu::onNewSurface(const SkImageInfo& info) {
@@ -84,9 +84,8 @@
SkImage* image = NULL;
GrTexture* tex = fDevice->accessRenderTarget()->asTexture();
if (tex) {
- image = SkNEW_ARGS(SkImage_Gpu,
- (info.width(), info.height(), kNeedNewImageUniqueID, info.alphaType(),
- tex, sampleCount, budgeted));
+ image = new SkImage_Gpu(info.width(), info.height(), kNeedNewImageUniqueID,
+ info.alphaType(), tex, sampleCount, budgeted);
}
if (image) {
as_IB(image)->initWithProps(this->props());
@@ -123,7 +122,7 @@
if (!device) {
return NULL;
}
- return SkNEW_ARGS(SkSurface_Gpu, (device));
+ return new SkSurface_Gpu(device);
}
SkSurface* SkSurface::NewRenderTarget(GrContext* ctx, Budgeted budgeted, const SkImageInfo& info,
@@ -133,7 +132,7 @@
if (!device) {
return NULL;
}
- return SkNEW_ARGS(SkSurface_Gpu, (device));
+ return new SkSurface_Gpu(device);
}
SkSurface* SkSurface::NewFromBackendTexture(GrContext* context, const GrBackendTextureDesc& desc,
@@ -154,7 +153,7 @@
if (!device) {
return NULL;
}
- return SkNEW_ARGS(SkSurface_Gpu, (device));
+ return new SkSurface_Gpu(device);
}
SkSurface* SkSurface::NewFromBackendRenderTarget(GrContext* context,
@@ -172,7 +171,7 @@
if (!device) {
return NULL;
}
- return SkNEW_ARGS(SkSurface_Gpu, (device));
+ return new SkSurface_Gpu(device);
}
#endif
diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp
index bcf6da7..3c88f7a 100644
--- a/src/image/SkSurface_Raster.cpp
+++ b/src/image/SkSurface_Raster.cpp
@@ -105,9 +105,7 @@
}
}
-SkCanvas* SkSurface_Raster::onNewCanvas() {
- return SkNEW_ARGS(SkCanvas, (fBitmap, this->props()));
-}
+SkCanvas* SkSurface_Raster::onNewCanvas() { return new SkCanvas(fBitmap, this->props()); }
SkSurface* SkSurface_Raster::onNewSurface(const SkImageInfo& info) {
return SkSurface::NewRaster(info, &this->props());
@@ -174,7 +172,7 @@
return NULL;
}
- return SkNEW_ARGS(SkSurface_Raster, (info, pixels, rb, releaseProc, context, props));
+ return new SkSurface_Raster(info, pixels, rb, releaseProc, context, props);
}
SkSurface* SkSurface::NewRasterDirect(const SkImageInfo& info, void* pixels, size_t rowBytes,
@@ -191,5 +189,5 @@
if (NULL == pr.get()) {
return NULL;
}
- return SkNEW_ARGS(SkSurface_Raster, (pr, props));
+ return new SkSurface_Raster(pr, props);
}
diff --git a/src/images/SkDecodingImageGenerator.cpp b/src/images/SkDecodingImageGenerator.cpp
index b4af220..5d71ab8 100644
--- a/src/images/SkDecodingImageGenerator.cpp
+++ b/src/images/SkDecodingImageGenerator.cpp
@@ -257,9 +257,8 @@
return NULL;
}
- return SkNEW_ARGS(DecodingImageGenerator,
- (data, autoStream.detach(), info.makeAlphaType(newAlphaType),
- opts.fSampleSize, opts.fDitherImage));
+ return new DecodingImageGenerator(data, autoStream.detach(), info.makeAlphaType(newAlphaType),
+ opts.fSampleSize, opts.fDitherImage);
}
} // namespace
@@ -273,7 +272,7 @@
if (NULL == data) {
return NULL;
}
- SkStreamRewindable* stream = SkNEW_ARGS(SkMemoryStream, (data));
+ SkStreamRewindable* stream = new SkMemoryStream(data);
SkASSERT(stream != NULL);
return CreateDecodingImageGenerator(data, stream, opts);
}
diff --git a/src/images/SkImageDecoder.cpp b/src/images/SkImageDecoder.cpp
index 5b3cf32..0be295c 100644
--- a/src/images/SkImageDecoder.cpp
+++ b/src/images/SkImageDecoder.cpp
@@ -160,7 +160,7 @@
bool SkImageDecoder::onBuildTileIndex(SkStreamRewindable* stream, int* /*width*/,
int* /*height*/) {
- SkDELETE(stream);
+ delete stream;
return false;
}
diff --git a/src/images/SkImageDecoder_FactoryRegistrar.cpp b/src/images/SkImageDecoder_FactoryRegistrar.cpp
index b47a6d5..68202a9 100644
--- a/src/images/SkImageDecoder_FactoryRegistrar.cpp
+++ b/src/images/SkImageDecoder_FactoryRegistrar.cpp
@@ -31,7 +31,7 @@
// if we are given a stream that does not support rewinding.
if (!rewindSuceeded) {
SkDEBUGF(("Unable to rewind the image stream."));
- SkDELETE(codec);
+ delete codec;
return NULL;
}
diff --git a/src/images/SkImageDecoder_astc.cpp b/src/images/SkImageDecoder_astc.cpp
index 869acfb..cb29b4d 100644
--- a/src/images/SkImageDecoder_astc.cpp
+++ b/src/images/SkImageDecoder_astc.cpp
@@ -186,7 +186,7 @@
static SkImageDecoder* sk_libastc_dfactory(SkStreamRewindable* stream) {
if (is_astc(stream)) {
- return SkNEW(SkASTCImageDecoder);
+ return new SkASTCImageDecoder;
}
return NULL;
}
diff --git a/src/images/SkImageDecoder_ktx.cpp b/src/images/SkImageDecoder_ktx.cpp
index 837fe58..a7e1a70 100644
--- a/src/images/SkImageDecoder_ktx.cpp
+++ b/src/images/SkImageDecoder_ktx.cpp
@@ -309,7 +309,7 @@
static SkImageDecoder* sk_libktx_dfactory(SkStreamRewindable* stream) {
if (SkKTXFile::is_ktx(stream)) {
- return SkNEW(SkKTXImageDecoder);
+ return new SkKTXImageDecoder;
}
return NULL;
}
@@ -322,7 +322,7 @@
}
SkImageEncoder* sk_libktx_efactory(SkImageEncoder::Type t) {
- return (SkImageEncoder::kKTX_Type == t) ? SkNEW(SkKTXImageEncoder) : NULL;
+ return (SkImageEncoder::kKTX_Type == t) ? new SkKTXImageEncoder : NULL;
}
static SkImageDecoder_DecodeReg gReg(sk_libktx_dfactory);
diff --git a/src/images/SkImageDecoder_libbmp.cpp b/src/images/SkImageDecoder_libbmp.cpp
index 6647e1b..3884508 100644
--- a/src/images/SkImageDecoder_libbmp.cpp
+++ b/src/images/SkImageDecoder_libbmp.cpp
@@ -46,7 +46,7 @@
static SkImageDecoder* sk_libbmp_dfactory(SkStreamRewindable* stream) {
if (is_bmp(stream)) {
- return SkNEW(SkBMPImageDecoder);
+ return new SkBMPImageDecoder;
}
return NULL;
}
diff --git a/src/images/SkImageDecoder_libgif.cpp b/src/images/SkImageDecoder_libgif.cpp
index 5d55a13..65172ac 100644
--- a/src/images/SkImageDecoder_libgif.cpp
+++ b/src/images/SkImageDecoder_libgif.cpp
@@ -365,7 +365,7 @@
fillIndex = 0; // If not, fix it.
}
- SkAutoTUnref<SkColorTable> ctable(SkNEW_ARGS(SkColorTable, (colorPtr, colorCount)));
+ SkAutoTUnref<SkColorTable> ctable(new SkColorTable(colorPtr, colorCount));
if (!this->allocPixelRef(bm, ctable)) {
return error_return(*bm, "allocPixelRef");
}
@@ -524,7 +524,7 @@
static SkImageDecoder* sk_libgif_dfactory(SkStreamRewindable* stream) {
if (is_gif(stream)) {
- return SkNEW(SkGIFImageDecoder);
+ return new SkGIFImageDecoder;
}
return NULL;
}
diff --git a/src/images/SkImageDecoder_libico.cpp b/src/images/SkImageDecoder_libico.cpp
index b9b3fba..78f41d9 100644
--- a/src/images/SkImageDecoder_libico.cpp
+++ b/src/images/SkImageDecoder_libico.cpp
@@ -435,7 +435,7 @@
static SkImageDecoder* sk_libico_dfactory(SkStreamRewindable* stream) {
if (is_ico(stream)) {
- return SkNEW(SkICOImageDecoder);
+ return new SkICOImageDecoder;
}
return NULL;
}
diff --git a/src/images/SkImageDecoder_libjpeg.cpp b/src/images/SkImageDecoder_libjpeg.cpp
index 8e92dd8..d403b74 100644
--- a/src/images/SkImageDecoder_libjpeg.cpp
+++ b/src/images/SkImageDecoder_libjpeg.cpp
@@ -210,9 +210,7 @@
fImageHeight = 0;
}
- virtual ~SkJPEGImageDecoder() {
- SkDELETE(fImageIndex);
- }
+ virtual ~SkJPEGImageDecoder() { delete fImageIndex; }
#endif
Format getFormat() const override {
@@ -943,8 +941,7 @@
#ifdef SK_BUILD_FOR_ANDROID
bool SkJPEGImageDecoder::onBuildTileIndex(SkStreamRewindable* stream, int *width, int *height) {
-
- SkAutoTDelete<SkJPEGImageIndex> imageIndex(SkNEW_ARGS(SkJPEGImageIndex, (stream, this)));
+ SkAutoTDelete<SkJPEGImageIndex> imageIndex(new SkJPEGImageIndex(stream, this));
skjpeg_error_mgr sk_err;
set_error_mgr(imageIndex->cinfo(), &sk_err);
@@ -1000,7 +997,7 @@
*height = fImageHeight;
}
- SkDELETE(fImageIndex);
+ delete fImageIndex;
fImageIndex = imageIndex.detach();
return true;
@@ -1437,7 +1434,7 @@
static SkImageDecoder* sk_libjpeg_dfactory(SkStreamRewindable* stream) {
if (is_jpeg(stream)) {
- return SkNEW(SkJPEGImageDecoder);
+ return new SkJPEGImageDecoder;
}
return NULL;
}
@@ -1450,7 +1447,7 @@
}
static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) {
- return (SkImageEncoder::kJPEG_Type == t) ? SkNEW(SkJPEGImageEncoder) : NULL;
+ return (SkImageEncoder::kJPEG_Type == t) ? new SkJPEGImageEncoder : NULL;
}
static SkImageDecoder_DecodeReg gDReg(sk_libjpeg_dfactory);
diff --git a/src/images/SkImageDecoder_libpng.cpp b/src/images/SkImageDecoder_libpng.cpp
index 44aa8e2..bccdfc8 100644
--- a/src/images/SkImageDecoder_libpng.cpp
+++ b/src/images/SkImageDecoder_libpng.cpp
@@ -85,9 +85,7 @@
return kPNG_Format;
}
- virtual ~SkPNGImageDecoder() {
- SkDELETE(fImageIndex);
- }
+ virtual ~SkPNGImageDecoder() { delete fImageIndex; }
protected:
#ifdef SK_BUILD_FOR_ANDROID
@@ -723,7 +721,7 @@
*colorPtr++ = lastColor;
}
- *colorTablep = SkNEW_ARGS(SkColorTable, (colorStorage, colorCount));
+ *colorTablep = new SkColorTable(colorStorage, colorCount);
*reallyHasAlphap = reallyHasAlpha;
return true;
}
@@ -755,9 +753,9 @@
png_build_index(png_ptr);
if (fImageIndex) {
- SkDELETE(fImageIndex);
+ delete fImageIndex;
}
- fImageIndex = SkNEW_ARGS(SkPNGImageIndex, (streamDeleter.detach(), png_ptr, info_ptr));
+ fImageIndex = new SkPNGImageIndex(streamDeleter.detach(), png_ptr, info_ptr);
return true;
}
@@ -1271,7 +1269,7 @@
SkImageDecoder* sk_libpng_dfactory(SkStreamRewindable* stream) {
if (is_png(stream)) {
- return SkNEW(SkPNGImageDecoder);
+ return new SkPNGImageDecoder;
}
return NULL;
}
@@ -1284,7 +1282,7 @@
}
SkImageEncoder* sk_libpng_efactory(SkImageEncoder::Type t) {
- return (SkImageEncoder::kPNG_Type == t) ? SkNEW(SkPNGImageEncoder) : NULL;
+ return (SkImageEncoder::kPNG_Type == t) ? new SkPNGImageEncoder : NULL;
}
static SkImageDecoder_DecodeReg gDReg(sk_libpng_dfactory);
diff --git a/src/images/SkImageDecoder_libwebp.cpp b/src/images/SkImageDecoder_libwebp.cpp
index a7c9610..e0c1d64 100644
--- a/src/images/SkImageDecoder_libwebp.cpp
+++ b/src/images/SkImageDecoder_libwebp.cpp
@@ -657,7 +657,7 @@
}
// Magic matches, call decoder
- return SkNEW(SkWEBPImageDecoder);
+ return new SkWEBPImageDecoder;
}
static SkImageDecoder::Format get_format_webp(SkStreamRewindable* stream) {
@@ -669,7 +669,7 @@
}
static SkImageEncoder* sk_libwebp_efactory(SkImageEncoder::Type t) {
- return (SkImageEncoder::kWEBP_Type == t) ? SkNEW(SkWEBPImageEncoder) : NULL;
+ return (SkImageEncoder::kWEBP_Type == t) ? new SkWEBPImageEncoder : NULL;
}
static SkImageDecoder_DecodeReg gDReg(sk_libwebp_dfactory);
diff --git a/src/images/SkImageDecoder_pkm.cpp b/src/images/SkImageDecoder_pkm.cpp
index 9e1a2aa..f407308 100644
--- a/src/images/SkImageDecoder_pkm.cpp
+++ b/src/images/SkImageDecoder_pkm.cpp
@@ -111,7 +111,7 @@
static SkImageDecoder* sk_libpkm_dfactory(SkStreamRewindable* stream) {
if (is_pkm(stream)) {
- return SkNEW(SkPKMImageDecoder);
+ return new SkPKMImageDecoder;
}
return NULL;
}
diff --git a/src/images/SkImageDecoder_wbmp.cpp b/src/images/SkImageDecoder_wbmp.cpp
index b7a6790..82127c3 100644
--- a/src/images/SkImageDecoder_wbmp.cpp
+++ b/src/images/SkImageDecoder_wbmp.cpp
@@ -119,7 +119,7 @@
}
const SkPMColor colors[] = { SK_ColorBLACK, SK_ColorWHITE };
- SkColorTable* ct = SkNEW_ARGS(SkColorTable, (colors, 2));
+ SkColorTable* ct = new SkColorTable(colors, 2);
SkAutoUnref aur(ct);
if (!this->allocPixelRef(decodedBitmap, ct)) {
@@ -156,7 +156,7 @@
wbmp_head head;
if (head.init(stream)) {
- return SkNEW(SkWBMPImageDecoder);
+ return new SkWBMPImageDecoder;
}
return NULL;
}
diff --git a/src/images/SkMovie_gif.cpp b/src/images/SkMovie_gif.cpp
index 380aca4..c40f552 100644
--- a/src/images/SkMovie_gif.cpp
+++ b/src/images/SkMovie_gif.cpp
@@ -443,7 +443,7 @@
memcmp(GIF89_STAMP, buf, GIF_STAMP_LEN) == 0) {
// must rewind here, since our construct wants to re-read the data
stream->rewind();
- return SkNEW_ARGS(SkGIFMovie, (stream));
+ return new SkGIFMovie(stream);
}
}
return NULL;
diff --git a/src/lazy/SkCachingPixelRef.cpp b/src/lazy/SkCachingPixelRef.cpp
index 3edd0de..f65e545 100644
--- a/src/lazy/SkCachingPixelRef.cpp
+++ b/src/lazy/SkCachingPixelRef.cpp
@@ -17,11 +17,10 @@
}
const SkImageInfo info = generator->getInfo();
if (!dst->setInfo(info)) {
- SkDELETE(generator);
+ delete generator;
return false;
}
- SkAutoTUnref<SkCachingPixelRef> ref(SkNEW_ARGS(SkCachingPixelRef,
- (info, generator, dst->rowBytes())));
+ SkAutoTUnref<SkCachingPixelRef> ref(new SkCachingPixelRef(info, generator, dst->rowBytes()));
dst->setPixelRef(ref);
return true;
}
@@ -36,7 +35,7 @@
SkASSERT(fImageGenerator != NULL);
}
SkCachingPixelRef::~SkCachingPixelRef() {
- SkDELETE(fImageGenerator);
+ delete fImageGenerator;
// Assert always unlock before unref.
}
diff --git a/src/lazy/SkCachingPixelRef.h b/src/lazy/SkCachingPixelRef.h
index 818db22..1057441 100644
--- a/src/lazy/SkCachingPixelRef.h
+++ b/src/lazy/SkCachingPixelRef.h
@@ -35,8 +35,8 @@
*
* If Install fails or when the SkCachingPixelRef 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`.
*/
static bool Install(SkImageGenerator* gen, SkBitmap* dst);
diff --git a/src/lazy/SkDiscardableMemoryPool.cpp b/src/lazy/SkDiscardableMemoryPool.cpp
index 70072c6..898d766 100644
--- a/src/lazy/SkDiscardableMemoryPool.cpp
+++ b/src/lazy/SkDiscardableMemoryPool.cpp
@@ -178,8 +178,7 @@
if (NULL == addr) {
return NULL;
}
- PoolDiscardableMemory* dm = SkNEW_ARGS(PoolDiscardableMemory,
- (this, addr, bytes));
+ PoolDiscardableMemory* dm = new PoolDiscardableMemory(this, addr, bytes);
SkAutoMutexAcquire autoMutexAcquire(fMutex);
fList.addToHead(dm);
fUsed += bytes;
@@ -257,7 +256,7 @@
} // namespace
SkDiscardableMemoryPool* SkDiscardableMemoryPool::Create(size_t size, SkBaseMutex* mutex) {
- return SkNEW_ARGS(DiscardableMemoryPool, (size, mutex));
+ return new DiscardableMemoryPool(size, mutex);
}
SK_DECLARE_STATIC_LAZY_PTR(SkDiscardableMemoryPool, global, create_global_pool);
diff --git a/src/lazy/SkDiscardablePixelRef.cpp b/src/lazy/SkDiscardablePixelRef.cpp
index 4f9178e..01bfd83 100644
--- a/src/lazy/SkDiscardablePixelRef.cpp
+++ b/src/lazy/SkDiscardablePixelRef.cpp
@@ -33,9 +33,9 @@
fDiscardableMemory->unlock();
fDiscardableMemoryIsLocked = false;
}
- SkDELETE(fDiscardableMemory);
+ delete fDiscardableMemory;
SkSafeUnref(fDMFactory);
- SkDELETE(fGenerator);
+ delete fGenerator;
}
bool SkDiscardablePixelRef::onNewLockPixels(LockRec* rec) {
@@ -47,7 +47,7 @@
rec->fRowBytes = fRowBytes;
return true;
}
- SkDELETE(fDiscardableMemory);
+ delete fDiscardableMemory;
fDiscardableMemory = NULL;
fDiscardableMemoryIsLocked = false;
}
@@ -74,7 +74,7 @@
if (!fGenerator->getPixels(info, pixels, fRowBytes, colors, &colorCount)) {
fDiscardableMemory->unlock();
fDiscardableMemoryIsLocked = false;
- SkDELETE(fDiscardableMemory);
+ delete fDiscardableMemory;
fDiscardableMemory = NULL;
return false;
}
@@ -85,7 +85,7 @@
// could move it into the block, but then again perhaps it is small enough that this doesn't
// really matter.
if (colorCount > 0) {
- fCTable.reset(SkNEW_ARGS(SkColorTable, (colors, colorCount)));
+ fCTable.reset(new SkColorTable(colors, colorCount));
} else {
fCTable.reset(NULL);
}
@@ -137,8 +137,7 @@
return dst->tryAllocPixels();
}
SkAutoTUnref<SkDiscardablePixelRef> ref(
- SkNEW_ARGS(SkDiscardablePixelRef,
- (prInfo, autoGenerator.detach(), dst->rowBytes(), factory)));
+ new SkDiscardablePixelRef(prInfo, autoGenerator.detach(), dst->rowBytes(), factory));
dst->setPixelRef(ref, origin.x(), origin.y());
return true;
}
diff --git a/src/opts/SkXfermode_opts.h b/src/opts/SkXfermode_opts.h
index b4fc8e1..673387b 100644
--- a/src/opts/SkXfermode_opts.h
+++ b/src/opts/SkXfermode_opts.h
@@ -280,8 +280,9 @@
static SkXfermode* create_xfermode(const ProcCoeff& rec, SkXfermode::Mode mode) {
switch (mode) {
- #define CASE(Mode) case SkXfermode::k##Mode##_Mode: \
- return SkNEW_ARGS(Sk4pxXfermode, (rec, mode, &Mode, &xfer_aa<Mode>))
+#define CASE(Mode) \
+ case SkXfermode::k##Mode##_Mode: \
+ return new Sk4pxXfermode(rec, mode, &Mode, &xfer_aa<Mode>)
CASE(Clear);
CASE(Src);
CASE(Dst);
@@ -306,8 +307,9 @@
CASE(Lighten);
#undef CASE
- #define CASE(Mode) case SkXfermode::k##Mode##_Mode: \
- return SkNEW_ARGS(SkPMFloatXfermode, (rec, mode, &Mode))
+#define CASE(Mode) \
+ case SkXfermode::k##Mode##_Mode: \
+ return new SkPMFloatXfermode(rec, mode, &Mode)
CASE(ColorDodge);
CASE(ColorBurn);
CASE(SoftLight);
diff --git a/src/opts/opts_check_x86.cpp b/src/opts/opts_check_x86.cpp
index 34045d4..2e140e8 100644
--- a/src/opts/opts_check_x86.cpp
+++ b/src/opts/opts_check_x86.cpp
@@ -76,7 +76,7 @@
int cpu_info[4] = { 0, 0, 0, 0 };
getcpuid(1, cpu_info);
- int* level = SkNEW(int);
+ int* level = new int;
if ((cpu_info[2] & (1<<20)) != 0) {
*level = SK_CPU_SSE_LEVEL_SSE42;
diff --git a/src/pathops/SkPathOpsDebug.cpp b/src/pathops/SkPathOpsDebug.cpp
index 61f5096..813f237 100644
--- a/src/pathops/SkPathOpsDebug.cpp
+++ b/src/pathops/SkPathOpsDebug.cpp
@@ -75,13 +75,9 @@
#if DEBUG_SHOW_TEST_NAME
-void* SkPathOpsDebug::CreateNameStr() {
- return SkNEW_ARRAY(char, DEBUG_FILENAME_STRING_LENGTH);
-}
+void* SkPathOpsDebug::CreateNameStr() { return new char[DEBUG_FILENAME_STRING_LENGTH]; }
-void SkPathOpsDebug::DeleteNameStr(void* v) {
- SkDELETE_ARRAY(reinterpret_cast<char* >(v));
-}
+void SkPathOpsDebug::DeleteNameStr(void* v) { delete[] reinterpret_cast<char*>(v); }
void SkPathOpsDebug::BumpTestName(char* test) {
char* num = test + strlen(test);
diff --git a/src/pathops/SkPathOpsTSect.h b/src/pathops/SkPathOpsTSect.h
index 50e1279..6ea01be 100644
--- a/src/pathops/SkPathOpsTSect.h
+++ b/src/pathops/SkPathOpsTSect.h
@@ -349,8 +349,8 @@
template<typename TCurve, typename OppCurve>
void SkTSpan<TCurve, OppCurve>::addBounded(SkTSpan<OppCurve, TCurve>* span, SkChunkAlloc* heap) {
- SkTSpanBounded<OppCurve, TCurve>* bounded = SkNEW_PLACEMENT(heap->allocThrow(
- sizeof(SkTSpanBounded<OppCurve, TCurve>)), (SkTSpanBounded<OppCurve, TCurve>));
+ SkTSpanBounded<OppCurve, TCurve>* bounded = new (heap->allocThrow(
+ sizeof(SkTSpanBounded<OppCurve, TCurve>)))(SkTSpanBounded<OppCurve, TCurve>);
bounded->fBounded = span;
bounded->fNext = fBounded;
fBounded = bounded;
@@ -829,8 +829,8 @@
result->reset();
fDeleted = result->fNext;
} else {
- result = SkNEW_PLACEMENT(fHeap.allocThrow(sizeof(SkTSpan<TCurve, OppCurve>)),
- (SkTSpan<TCurve, OppCurve>));
+ result = new (fHeap.allocThrow(sizeof(SkTSpan<TCurve, OppCurve>)))(
+ SkTSpan<TCurve, OppCurve>);
result->fBounded = NULL;
#if DEBUG_T_SECT
++fDebugAllocatedCount;
diff --git a/src/pdf/SkDeflate.cpp b/src/pdf/SkDeflate.cpp
index 2ca516c..bef8d97 100644
--- a/src/pdf/SkDeflate.cpp
+++ b/src/pdf/SkDeflate.cpp
@@ -65,8 +65,7 @@
z_stream fZStream;
};
-SkDeflateWStream::SkDeflateWStream(SkWStream* out)
- : fImpl(SkNEW(SkDeflateWStream::Impl)) {
+SkDeflateWStream::SkDeflateWStream(SkWStream* out) : fImpl(new SkDeflateWStream::Impl) {
fImpl->fOut = out;
fImpl->fInBufferIndex = 0;
if (!fImpl->fOut) {
diff --git a/src/pdf/SkPDFBitmap.cpp b/src/pdf/SkPDFBitmap.cpp
index ba26cd8..3505233 100644
--- a/src/pdf/SkPDFBitmap.cpp
+++ b/src/pdf/SkPDFBitmap.cpp
@@ -314,7 +314,7 @@
}
static SkPDFArray* make_indexed_color_space(const SkColorTable* table) {
- SkPDFArray* result = SkNEW(SkPDFArray);
+ SkPDFArray* result = new SkPDFArray;
result->reserve(4);
result->appendName("Indexed");
result->appendName("DeviceRGB");
@@ -457,7 +457,7 @@
SkJFIFInfo info;
if (data && SkIsJFIF(data, &info)) {
bool yuv = info.fType == SkJFIFInfo::kYCbCr;
- SkPDFBitmap* pdfBitmap = SkNEW_ARGS(PDFJpegBitmap, (bm, data, yuv));
+ SkPDFBitmap* pdfBitmap = new PDFJpegBitmap(bm, data, yuv);
canon->addBitmap(pdfBitmap);
return pdfBitmap;
}
@@ -465,9 +465,9 @@
SkPDFObject* smask = NULL;
if (!bm.isOpaque() && !SkBitmap::ComputeIsOpaque(bm)) {
- smask = SkNEW_ARGS(PDFAlphaBitmap, (bm));
+ smask = new PDFAlphaBitmap(bm);
}
- SkPDFBitmap* pdfBitmap = SkNEW_ARGS(PDFDefaultBitmap, (bm, smask));
+ SkPDFBitmap* pdfBitmap = new PDFDefaultBitmap(bm, smask);
canon->addBitmap(pdfBitmap);
return pdfBitmap;
}
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 179e02b..678e6c0 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -697,10 +697,7 @@
////////////////////////////////////////////////////////////////////////////////
-SkPDFDevice::SkPDFDevice(SkISize pageSize,
- SkScalar rasterDpi,
- SkPDFCanon* canon,
- bool flip)
+SkPDFDevice::SkPDFDevice(SkISize pageSize, SkScalar rasterDpi, SkPDFCanon* canon, bool flip)
: INHERITED(SkSurfaceProps(0, kUnknown_SkPixelGeometry))
, fPageSize(pageSize)
, fContentSize(pageSize)
@@ -710,7 +707,7 @@
, fLastMarginContentEntry(NULL)
, fDrawingArea(kContent_DrawingArea)
, fClipStack(NULL)
- , fFontGlyphUsage(SkNEW(SkPDFGlyphSetMap))
+ , fFontGlyphUsage(new SkPDFGlyphSetMap)
, fRasterDpi(rasterDpi)
, fCanon(canon) {
SkASSERT(pageSize.width() > 0);
@@ -741,7 +738,7 @@
fLastMarginContentEntry = NULL;
fDrawingArea = kContent_DrawingArea;
if (fFontGlyphUsage.get() == NULL) {
- fFontGlyphUsage.reset(SkNEW(SkPDFGlyphSetMap));
+ fFontGlyphUsage.reset(new SkPDFGlyphSetMap);
}
}
@@ -896,17 +893,17 @@
}
static SkPDFDict* create_link_annotation(const SkRect& translatedRect) {
- SkAutoTUnref<SkPDFDict> annotation(SkNEW_ARGS(SkPDFDict, ("Annot")));
+ SkAutoTUnref<SkPDFDict> annotation(new SkPDFDict("Annot"));
annotation->insertName("Subtype", "Link");
- SkAutoTUnref<SkPDFArray> border(SkNEW(SkPDFArray));
+ SkAutoTUnref<SkPDFArray> border(new SkPDFArray);
border->reserve(3);
border->appendInt(0); // Horizontal corner radius.
border->appendInt(0); // Vertical corner radius.
border->appendInt(0); // Width, 0 = no border.
annotation->insertObject("Border", border.detach());
- SkAutoTUnref<SkPDFArray> rect(SkNEW(SkPDFArray));
+ SkAutoTUnref<SkPDFArray> rect(new SkPDFArray);
rect->reserve(4);
rect->appendScalar(translatedRect.fLeft);
rect->appendScalar(translatedRect.fTop);
@@ -922,7 +919,7 @@
SkString url(static_cast<const char *>(urlData->data()),
urlData->size() - 1);
- SkAutoTUnref<SkPDFDict> action(SkNEW_ARGS(SkPDFDict, ("Action")));
+ SkAutoTUnref<SkPDFDict> action(new SkPDFDict("Action"));
action->insertName("S", "URI");
action->insertString("URI", url);
annotation->insertObject("A", action.detach());
@@ -1434,7 +1431,7 @@
SkPDFArray* SkPDFDevice::copyMediaBox() const {
// should this be a singleton?
- SkAutoTUnref<SkPDFArray> mediaBox(SkNEW(SkPDFArray));
+ SkAutoTUnref<SkPDFArray> mediaBox(new SkPDFArray);
mediaBox->reserve(4);
mediaBox->appendInt(0);
mediaBox->appendInt(0);
@@ -1579,9 +1576,7 @@
for (size_t i = 0; i < count; i++) {
SkPoint translatedPoint;
transform.mapXY(points[i].x(), points[i].y(), &translatedPoint);
- fNamedDestinations.push(
- SkNEW_ARGS(NamedDestination, (nameData, translatedPoint)));
-
+ fNamedDestinations.push(new NamedDestination(nameData, translatedPoint));
}
return true;
}
@@ -1590,7 +1585,7 @@
void SkPDFDevice::addAnnotation(SkPDFDict* annotation) {
if (NULL == fAnnotations) {
- fAnnotations = SkNEW(SkPDFArray);
+ fAnnotations = new SkPDFArray;
}
fAnnotations->appendObject(annotation);
}
@@ -1600,7 +1595,7 @@
int nDest = fNamedDestinations.count();
for (int i = 0; i < nDest; i++) {
NamedDestination* dest = fNamedDestinations[i];
- SkAutoTUnref<SkPDFArray> pdfDest(SkNEW(SkPDFArray));
+ SkAutoTUnref<SkPDFArray> pdfDest(new SkPDFArray);
pdfDest->reserve(5);
pdfDest->appendObjRef(SkRef(page));
pdfDest->appendName("XYZ");
@@ -1613,7 +1608,7 @@
}
SkPDFFormXObject* SkPDFDevice::createFormXObjectFromDevice() {
- SkPDFFormXObject* xobject = SkNEW_ARGS(SkPDFFormXObject, (this));
+ SkPDFFormXObject* xobject = new SkPDFFormXObject(this);
// We always draw the form xobjects that we create back into the device, so
// we simply preserve the font usage instead of pulling it out and merging
// it back in later.
diff --git a/src/pdf/SkPDFDevice.h b/src/pdf/SkPDFDevice.h
index bed2947..06d3e10 100644
--- a/src/pdf/SkPDFDevice.h
+++ b/src/pdf/SkPDFDevice.h
@@ -65,14 +65,14 @@
static SkPDFDevice* Create(SkISize pageSize,
SkScalar rasterDpi,
SkPDFCanon* canon) {
- return SkNEW_ARGS(SkPDFDevice, (pageSize, rasterDpi, canon, true));
+ return new SkPDFDevice(pageSize, rasterDpi, canon, true);
}
/** Create a PDF drawing context without fipping the y-axis. */
static SkPDFDevice* CreateUnflipped(SkISize pageSize,
SkScalar rasterDpi,
SkPDFCanon* canon) {
- return SkNEW_ARGS(SkPDFDevice, (pageSize, rasterDpi, canon, false));
+ return new SkPDFDevice(pageSize, rasterDpi, canon, false);
}
virtual ~SkPDFDevice();
diff --git a/src/pdf/SkPDFGraphicState.cpp b/src/pdf/SkPDFGraphicState.cpp
index c4b6c20..bff32ae 100644
--- a/src/pdf/SkPDFGraphicState.cpp
+++ b/src/pdf/SkPDFGraphicState.cpp
@@ -140,8 +140,7 @@
SkAutoTUnref<SkData> psInvertStream(
SkData::NewWithoutCopy(psInvert, strlen(psInvert)));
- SkPDFStream* invertFunction = SkNEW_ARGS(
- SkPDFStream, (psInvertStream.get()));
+ SkPDFStream* invertFunction = new SkPDFStream(psInvertStream.get());
invertFunction->insertInt("FunctionType", 4);
invertFunction->insertObject("Domain", SkRef(domainAndRange.get()));
invertFunction->insertObject("Range", domainAndRange.detach());
@@ -199,7 +198,7 @@
SkWStream* stream,
const SkPDFObjNumMap& objNumMap,
const SkPDFSubstituteMap& substitutes) const {
- SkAutoTUnref<SkPDFDict> dict(SkNEW_ARGS(SkPDFDict, ("ExtGState")));
+ SkAutoTUnref<SkPDFDict> dict(new SkPDFDict("ExtGState"));
dict->insertName("Type", "ExtGState");
SkScalar alpha = SkIntToScalar(fAlpha) / 0xFF;
diff --git a/src/pdf/SkPDFResourceDict.cpp b/src/pdf/SkPDFResourceDict.cpp
index dbe733e..2f9abca 100644
--- a/src/pdf/SkPDFResourceDict.cpp
+++ b/src/pdf/SkPDFResourceDict.cpp
@@ -61,7 +61,7 @@
if (0 == resourceList.count()) {
return;
}
- SkAutoTUnref<SkPDFDict> resources(SkNEW(SkPDFDict));
+ SkAutoTUnref<SkPDFDict> resources(new SkPDFDict);
for (int i = 0; i < resourceList.count(); i++) {
resources->insertObjRef(SkPDFResourceDict::getResourceName(type, i),
SkRef(resourceList[i]));
@@ -74,10 +74,10 @@
const SkTDArray<SkPDFObject*>* patternResources,
const SkTDArray<SkPDFObject*>* xObjectResources,
const SkTDArray<SkPDFObject*>* fontResources) {
- SkAutoTUnref<SkPDFDict> dict(SkNEW(SkPDFDict));
+ SkAutoTUnref<SkPDFDict> dict(new SkPDFDict);
static const char kProcs[][7] = {
"PDF", "Text", "ImageB", "ImageC", "ImageI"};
- SkAutoTUnref<SkPDFArray> procSets(SkNEW(SkPDFArray));
+ SkAutoTUnref<SkPDFArray> procSets(new SkPDFArray);
procSets->reserve(SK_ARRAY_COUNT(kProcs));
for (size_t i = 0; i < SK_ARRAY_COUNT(kProcs); i++) {
diff --git a/src/pdf/SkPDFShader.cpp b/src/pdf/SkPDFShader.cpp
index e518bcf..6b4e758 100644
--- a/src/pdf/SkPDFShader.cpp
+++ b/src/pdf/SkPDFShader.cpp
@@ -518,8 +518,7 @@
const SkMatrix& matrix,
const SkIRect& surfaceBBox,
SkScalar rasterScale) {
- SkAutoTDelete<SkPDFShader::State> state(
- SkNEW_ARGS(State, (shader, matrix, surfaceBBox, rasterScale)));
+ SkAutoTDelete<SkPDFShader::State> state(new State(shader, matrix, surfaceBBox, rasterScale));
return get_pdf_shader_by_state(canon, dpi, &state);
}
@@ -625,7 +624,7 @@
create_smask_graphic_state(canon, dpi, state));
SkPDFAlphaFunctionShader* alphaFunctionShader =
- SkNEW_ARGS(SkPDFAlphaFunctionShader, (autoState->detach()));
+ new SkPDFAlphaFunctionShader(autoState->detach());
SkAutoTUnref<SkPDFDict> resourceDict(
get_gradient_resource_dict(colorShader.get(), alphaGs.get()));
@@ -680,7 +679,7 @@
namespace {
SkPDFObject* create_range_object() {
- SkPDFArray* range = SkNEW(SkPDFArray);
+ SkPDFArray* range = new SkPDFArray;
range->reserve(6);
range->appendInt(0);
range->appendInt(1);
@@ -701,7 +700,7 @@
SkPDFArray* domain) {
SkAutoDataUnref funcData(
SkData::NewWithCopy(psCode.c_str(), psCode.size()));
- SkPDFStream* result = SkNEW_ARGS(SkPDFStream, (funcData.get()));
+ SkPDFStream* result = new SkPDFStream(funcData.get());
result->insertInt("FunctionType", 4);
result->insertObject("Domain", SkRef(domain));
result->insertObject("Range", SkRef(rangeObject.get()));
@@ -814,8 +813,7 @@
make_ps_function(functionCode, domain.get()));
pdfShader->insertObjRef("Function", function.detach());
- SkPDFFunctionShader* pdfFunctionShader =
- SkNEW_ARGS(SkPDFFunctionShader, (autoState->detach()));
+ SkPDFFunctionShader* pdfFunctionShader = new SkPDFFunctionShader(autoState->detach());
pdfFunctionShader->insertInt("PatternType", 2);
pdfFunctionShader->insertObject("Matrix",
@@ -1028,8 +1026,7 @@
// Put the canvas into the pattern stream (fContent).
SkAutoTDelete<SkStreamAsset> content(patternDevice->content());
- SkPDFImageShader* imageShader =
- SkNEW_ARGS(SkPDFImageShader, (autoState->detach()));
+ SkPDFImageShader* imageShader = new SkPDFImageShader(autoState->detach());
imageShader->setData(content.get());
SkAutoTUnref<SkPDFDict> resourceDict(
diff --git a/src/pdf/SkPDFTypes.cpp b/src/pdf/SkPDFTypes.cpp
index 9bb9dee..43361fc 100644
--- a/src/pdf/SkPDFTypes.cpp
+++ b/src/pdf/SkPDFTypes.cpp
@@ -38,7 +38,7 @@
SkPDFUnion& SkPDFUnion::operator=(SkPDFUnion&& other) {
if (this != &other) {
this->~SkPDFUnion();
- SkNEW_PLACEMENT_ARGS(this, SkPDFUnion, (other.move()));
+ new (this) SkPDFUnion(other.move());
}
return *this;
}
@@ -56,8 +56,7 @@
switch (fType) {
case Type::kNameSkS:
case Type::kStringSkS:
- SkNEW_PLACEMENT_ARGS(pun(u.fSkString), SkString,
- (*pun(fSkString)));
+ new (pun(u.fSkString)) SkString (*pun(fSkString));
return u.move();
case Type::kObjRef:
case Type::kObject:
@@ -226,13 +225,13 @@
SkPDFUnion SkPDFUnion::Name(const SkString& s) {
SkPDFUnion u(Type::kNameSkS);
- SkNEW_PLACEMENT_ARGS(pun(u.fSkString), SkString, (s));
+ new (pun(u.fSkString)) SkString(s);
return u.move();
}
SkPDFUnion SkPDFUnion::String(const SkString& s) {
SkPDFUnion u(Type::kStringSkS);
- SkNEW_PLACEMENT_ARGS(pun(u.fSkString), SkString, (s));
+ new (pun(u.fSkString)) SkString(s);
return u.move();
}
@@ -298,9 +297,7 @@
}
}
-void SkPDFArray::append(SkPDFUnion&& value) {
- SkNEW_PLACEMENT_ARGS(fValues.append(), SkPDFUnion, (value.move()));
-}
+void SkPDFArray::append(SkPDFUnion&& value) { new (fValues.append()) SkPDFUnion(value.move()); }
void SkPDFArray::appendInt(int32_t value) {
this->append(SkPDFUnion::Int(value));
@@ -378,8 +375,8 @@
void SkPDFDict::set(SkPDFUnion&& name, SkPDFUnion&& value) {
Record* rec = fRecords.append();
SkASSERT(name.isName());
- SkNEW_PLACEMENT_ARGS(&rec->fKey, SkPDFUnion, (name.move()));
- SkNEW_PLACEMENT_ARGS(&rec->fValue, SkPDFUnion, (value.move()));
+ new (&rec->fKey) SkPDFUnion(name.move());
+ new (&rec->fValue) SkPDFUnion(value.move());
}
int SkPDFDict::size() const { return fRecords.count(); }
diff --git a/src/pdf/SkPDFTypes.h b/src/pdf/SkPDFTypes.h
index 85aa013..60d5114 100644
--- a/src/pdf/SkPDFTypes.h
+++ b/src/pdf/SkPDFTypes.h
@@ -313,10 +313,7 @@
class SkPDFSharedStream : public SkPDFObject {
public:
// Takes ownership of asset.
- SkPDFSharedStream(SkStreamAsset* data)
- : fAsset(data), fDict(SkNEW(SkPDFDict)) {
- SkASSERT(data);
- }
+ SkPDFSharedStream(SkStreamAsset* data) : fAsset(data), fDict(new SkPDFDict) { SkASSERT(data); }
SkPDFDict* dict() { return fDict; }
void emitObject(SkWStream*,
const SkPDFObjNumMap&,
diff --git a/src/pipe/SkGPipePriv.h b/src/pipe/SkGPipePriv.h
index c86e6fb..07c62f5 100644
--- a/src/pipe/SkGPipePriv.h
+++ b/src/pipe/SkGPipePriv.h
@@ -179,7 +179,7 @@
~BitmapInfo() {
SkASSERT(0 == fToBeDrawnCount);
- SkDELETE(fBitmap);
+ delete fBitmap;
}
void addDraws(int drawsToAdd) {
diff --git a/src/pipe/SkGPipeRead.cpp b/src/pipe/SkGPipeRead.cpp
index 29d798b..97cae90 100644
--- a/src/pipe/SkGPipeRead.cpp
+++ b/src/pipe/SkGPipeRead.cpp
@@ -150,7 +150,7 @@
SkASSERT(shouldFlattenBitmaps(fFlags));
SkBitmap* bm;
if(fBitmaps.count() == index) {
- bm = SkNEW(SkBitmap);
+ bm = new SkBitmap;
*fBitmaps.append() = bm;
} else {
bm = fBitmaps[index];
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index aa04cb8..b74b36d 100644
--- a/src/pipe/SkGPipeWrite.cpp
+++ b/src/pipe/SkGPipeWrite.cpp
@@ -437,15 +437,16 @@
#define FLATTENABLES_TO_KEEP 10
SkGPipeCanvas::SkGPipeCanvas(SkGPipeController* controller,
- SkWriter32* writer, uint32_t flags,
- uint32_t width, uint32_t height)
+ SkWriter32* writer,
+ uint32_t flags,
+ uint32_t width,
+ uint32_t height)
: SkCanvas(width, height)
- , fFactorySet(is_cross_process(flags) ? SkNEW(SkNamedFactorySet) : NULL)
+ , fFactorySet(is_cross_process(flags) ? new SkNamedFactorySet : NULL)
, fWriter(*writer)
, fFlags(flags)
, fFlattenableHeap(FLATTENABLES_TO_KEEP, fFactorySet, is_cross_process(flags))
- , fFlatDictionary(&fFlattenableHeap)
-{
+ , fFlatDictionary(&fFlattenableHeap) {
fController = controller;
fDone = false;
fBlockSize = 0; // need first block from controller
@@ -458,11 +459,10 @@
}
if (shouldFlattenBitmaps(flags)) {
- fBitmapShuttle.reset(SkNEW_ARGS(BitmapShuttle, (this)));
- fBitmapHeap = SkNEW_ARGS(SkBitmapHeap, (fBitmapShuttle.get(), BITMAPS_TO_KEEP));
+ fBitmapShuttle.reset(new BitmapShuttle(this));
+ fBitmapHeap = new SkBitmapHeap(fBitmapShuttle.get(), BITMAPS_TO_KEEP);
} else {
- fBitmapHeap = SkNEW_ARGS(SkBitmapHeap,
- (BITMAPS_TO_KEEP, controller->numberOfReaders()));
+ fBitmapHeap = new SkBitmapHeap(BITMAPS_TO_KEEP, controller->numberOfReaders());
if (this->needOpBytes(sizeof(void*))) {
this->writeOp(kShareBitmapHeap_DrawOp);
fWriter.writePtr(static_cast<void*>(fBitmapHeap));
@@ -470,7 +470,7 @@
}
fFlattenableHeap.setBitmapStorage(fBitmapHeap);
- fImageHeap = SkNEW(SkImageHeap);
+ fImageHeap = new SkImageHeap;
if (this->needOpBytes(sizeof(void*))) {
this->writeOp(kShareImageHeap_DrawOp);
fWriter.writePtr(static_cast<void*>(fImageHeap));
@@ -1399,7 +1399,7 @@
uint32_t width, uint32_t height) {
if (NULL == fCanvas) {
fWriter.reset(NULL, 0);
- fCanvas = SkNEW_ARGS(SkGPipeCanvas, (controller, &fWriter, flags, width, height));
+ fCanvas = new SkGPipeCanvas(controller, &fWriter, flags, width, height);
}
controller->setCanvas(fCanvas);
return fCanvas;
diff --git a/src/ports/SkFontConfigInterface_direct.cpp b/src/ports/SkFontConfigInterface_direct.cpp
index 9ef088d..3400aa9 100644
--- a/src/ports/SkFontConfigInterface_direct.cpp
+++ b/src/ports/SkFontConfigInterface_direct.cpp
@@ -133,7 +133,7 @@
SkAutoMutexAcquire ac(mutex);
static SkFontConfigInterfaceDirect* singleton = NULL;
if (singleton == NULL) {
- singleton = SkNEW(SkFontConfigInterfaceDirect);
+ singleton = new SkFontConfigInterfaceDirect;
}
return singleton;
}
@@ -733,9 +733,7 @@
}
}
- 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 3672f4e..d207f08 100644
--- a/src/ports/SkFontConfigTypeface.h
+++ b/src/ports/SkFontConfigTypeface.h
@@ -21,12 +21,12 @@
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 63f598f..860f320 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -158,7 +158,7 @@
if (0 == gFTCount) {
SkASSERT(NULL == gFTLibrary);
- gFTLibrary = SkNEW(FreeTypeLibrary);
+ gFTLibrary = new FreeTypeLibrary;
}
++gFTCount;
return gFTLibrary->library();
@@ -172,7 +172,7 @@
--gFTCount;
if (0 == gFTCount) {
SkASSERT(NULL != gFTLibrary);
- SkDELETE(gFTLibrary);
+ delete gFTLibrary;
SkDEBUGCODE(gFTLibrary = NULL;)
}
}
@@ -319,7 +319,7 @@
}
// 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 @@
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 @@
gFaceRecHead = next;
}
FT_Done_Face(face);
- SkDELETE(rec);
+ delete rec;
}
return;
}
@@ -662,11 +662,10 @@
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
old mode 100755
new mode 100644
index b55aa35..b144aee
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -2198,9 +2198,8 @@
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 @@
AutoCFRelease<CTFontDescriptorRef> desc(
CTFontDescriptorCreateWithAttributes(cfAttr));
- return SkNEW_ARGS(SkFontStyleSet_Mac, (cfFamilyName, desc));
+ return new SkFontStyleSet_Mac(cfFamilyName, desc);
}
public:
@@ -2488,6 +2487,4 @@
///////////////////////////////////////////////////////////////////////////////
-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
old mode 100755
new mode 100644
index d19ab1a..97e659e
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -2277,10 +2277,9 @@
}
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 @@
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 @@
}
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 @@
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 @@
///////////////////////////////////////////////////////////////////////////////
-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 45c787a..dc89d91 100644
--- a/src/ports/SkFontMgr_android.cpp
+++ b/src/ports/SkFontMgr_android.cpp
@@ -204,33 +204,27 @@
// 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 @@
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 @@
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 @@
}
}
- 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 @@
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 835acd7..496a54c 100644
--- a/src/ports/SkFontMgr_custom.cpp
+++ b/src/ports/SkFontMgr_custom.cpp
@@ -296,8 +296,8 @@
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 @@
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 @@
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 @@
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 @@
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 5a34455..3dc1ea0 100644
--- a/src/ports/SkFontMgr_fontconfig.cpp
+++ b/src/ports/SkFontMgr_fontconfig.cpp
@@ -65,8 +65,8 @@
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 @@
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 @@
}
}
- return SkNEW_ARGS(StyleSet, (this, matches.detach()));
+ return new StyleSet(this, matches.detach());
}
virtual SkTypeface* onMatchFamilyStyle(const char familyName[],
@@ -830,12 +830,12 @@
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 @@
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 ca8b260..df51764 100644
--- a/src/ports/SkFontMgr_win_dw.cpp
+++ b/src/ports/SkFontMgr_win_dw.cpp
@@ -479,7 +479,7 @@
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::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 @@
};
}
- 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 @@
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 ba16e4b..e1e6dc1 100644
--- a/src/ports/SkImageDecoder_CG.cpp
+++ b/src/ports/SkImageDecoder_CG.cpp
@@ -221,7 +221,7 @@
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 @@
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 55344a7..9194831 100644
--- a/src/ports/SkImageDecoder_WIC.cpp
+++ b/src/ports/SkImageDecoder_WIC.cpp
@@ -256,7 +256,7 @@
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 @@
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 e5ad6da..e6cca08 100644
--- a/src/ports/SkImageDecoder_empty.cpp
+++ b/src/ports/SkImageDecoder_empty.cpp
@@ -49,7 +49,7 @@
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 72480b8..2b11651 100644
--- a/src/ports/SkImageGenerator_skia.cpp
+++ b/src/ports/SkImageGenerator_skia.cpp
@@ -49,8 +49,8 @@
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 @@
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 b7cf583..b604c21 100644
--- a/src/ports/SkOSFile_posix.cpp
+++ b/src/ports/SkOSFile_posix.cpp
@@ -104,12 +104,10 @@
};
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 62510e7..64bd516 100644
--- a/src/ports/SkOSFile_win.cpp
+++ b/src/ports/SkOSFile_win.cpp
@@ -155,12 +155,10 @@
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 006346a..2d06255 100644
--- a/src/ports/SkRemotableFontMgr_win_dw.cpp
+++ b/src/ports/SkRemotableFontMgr_win_dw.cpp
@@ -466,7 +466,7 @@
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 @@
};
}
- 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 90dc2c4..3af4cca 100644
--- a/src/ports/SkTypeface_win_dw.cpp
+++ b/src/ports/SkTypeface_win_dw.cpp
@@ -239,11 +239,11 @@
&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 71d928b..866e634 100644
--- a/src/ports/SkTypeface_win_dw.h
+++ b/src/ports/SkTypeface_win_dw.h
@@ -78,9 +78,8 @@
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:
diff --git a/src/svg/SkSVGCanvas.cpp b/src/svg/SkSVGCanvas.cpp
index 22a6e0b..b6634b8 100644
--- a/src/svg/SkSVGCanvas.cpp
+++ b/src/svg/SkSVGCanvas.cpp
@@ -13,5 +13,5 @@
SkISize size = bounds.roundOut().size();
SkAutoTUnref<SkBaseDevice> device(SkSVGDevice::Create(size, writer));
- return SkNEW_ARGS(SkCanvas, (device));
+ return new SkCanvas(device);
}
diff --git a/src/svg/SkSVGDevice.cpp b/src/svg/SkSVGDevice.cpp
index 64f74c8..a3f8af7 100644
--- a/src/svg/SkSVGDevice.cpp
+++ b/src/svg/SkSVGDevice.cpp
@@ -290,7 +290,7 @@
if (!res.fClip.isEmpty()) {
// The clip is in device space. Apply it via a <g> wrapper to avoid local transform
// interference.
- fClipGroup.reset(SkNEW_ARGS(AutoElement, ("g", fWriter)));
+ fClipGroup.reset(new AutoElement("g", fWriter));
fClipGroup->addAttribute("clip-path",res.fClip);
}
@@ -566,13 +566,13 @@
return NULL;
}
- return SkNEW_ARGS(SkSVGDevice, (size, writer));
+ return new SkSVGDevice(size, writer);
}
SkSVGDevice::SkSVGDevice(const SkISize& size, SkXMLWriter* writer)
: INHERITED(SkSurfaceProps(0, kUnknown_SkPixelGeometry))
, fWriter(writer)
- , fResourceBucket(SkNEW(ResourceBucket)) {
+ , fResourceBucket(new ResourceBucket) {
SkASSERT(writer);
fLegacyBitmap.setInfo(SkImageInfo::MakeUnknown(size.width(), size.height()));
@@ -580,7 +580,7 @@
fWriter->writeHeader();
// The root <svg> tag gets closed by the destructor.
- fRootElement.reset(SkNEW_ARGS(AutoElement, ("svg", fWriter)));
+ fRootElement.reset(new AutoElement("svg", fWriter));
fRootElement->addAttribute("xmlns", "http://www.w3.org/2000/svg");
fRootElement->addAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
diff --git a/src/svg/skp2svg.cpp b/src/svg/skp2svg.cpp
index ae6e54c..2bfb687 100644
--- a/src/svg/skp2svg.cpp
+++ b/src/svg/skp2svg.cpp
@@ -45,17 +45,17 @@
SkAutoTDelete<SkWStream> outStream;
if (FLAGS_output.count() > 0) {
- SkFILEWStream* fileStream = SkNEW_ARGS(SkFILEWStream, (FLAGS_output[0]));
+ SkFILEWStream* fileStream = new SkFILEWStream(FLAGS_output[0]);
if (!fileStream->isValid()) {
SkDebugf("Couldn't open output file for writing: %s\n", FLAGS_output[0]);
return kIOError;
}
outStream.reset(fileStream);
} else {
- outStream.reset(SkNEW(SkDebugWStream));
+ outStream.reset(new SkDebugWStream);
}
- SkAutoTDelete<SkXMLWriter> xmlWriter(SkNEW_ARGS(SkXMLStreamWriter, (outStream.get())));
+ SkAutoTDelete<SkXMLWriter> xmlWriter(new SkXMLStreamWriter(outStream.get()));
SkAutoTUnref<SkCanvas> svgCanvas(SkSVGCanvas::Create(pic->cullRect(), xmlWriter.get()));
pic->playback(svgCanvas);
diff --git a/src/utils/SkCamera.cpp b/src/utils/SkCamera.cpp
index d9f9cf5..c7389ce 100644
--- a/src/utils/SkCamera.cpp
+++ b/src/utils/SkCamera.cpp
@@ -291,13 +291,13 @@
Rec* rec = fRec;
while (rec != &fInitialRec) {
Rec* next = rec->fNext;
- SkDELETE(rec);
+ delete rec;
rec = next;
}
}
void Sk3DView::save() {
- Rec* rec = SkNEW(Rec);
+ Rec* rec = new Rec;
rec->fNext = fRec;
rec->fMatrix = fRec->fMatrix;
fRec = rec;
@@ -306,7 +306,7 @@
void Sk3DView::restore() {
SkASSERT(fRec != &fInitialRec);
Rec* next = fRec->fNext;
- SkDELETE(fRec);
+ delete fRec;
fRec = next;
}
diff --git a/src/utils/SkCanvasStateUtils.cpp b/src/utils/SkCanvasStateUtils.cpp
index 12ceefc..8ab853d 100644
--- a/src/utils/SkCanvasStateUtils.cpp
+++ b/src/utils/SkCanvasStateUtils.cpp
@@ -206,7 +206,7 @@
return NULL;
}
- SkAutoTDelete<SkCanvasState_v1> canvasState(SkNEW_ARGS(SkCanvasState_v1, (canvas)));
+ SkAutoTDelete<SkCanvasState_v1> canvasState(new SkCanvasState_v1(canvas));
// decompose the total matrix and clip
setup_MC_state(&canvasState->mcState, canvas->getTotalMatrix(),
@@ -311,7 +311,7 @@
SkASSERT(!bitmap.empty());
SkASSERT(!bitmap.isNull());
- SkAutoTUnref<SkCanvas> canvas(SkNEW_ARGS(SkCanvas, (bitmap)));
+ SkAutoTUnref<SkCanvas> canvas(new SkCanvas(bitmap));
// setup the matrix and clip
setup_canvas_from_MC_state(layerState.mcState, canvas.get());
@@ -330,7 +330,7 @@
return NULL;
}
- SkAutoTUnref<SkCanvasStack> canvas(SkNEW_ARGS(SkCanvasStack, (state->width, state->height)));
+ SkAutoTUnref<SkCanvasStack> canvas(new SkCanvasStack(state->width, state->height));
// setup the matrix and clip on the n-way canvas
setup_canvas_from_MC_state(state_v1->mcState, canvas);
@@ -355,5 +355,5 @@
// Upcast to the correct version of SkCanvasState. This avoids having a virtual destructor on
// SkCanvasState. That would be strange since SkCanvasState has no other virtual functions, and
// instead uses the field "version" to determine how to behave.
- SkDELETE(static_cast<SkCanvasState_v1*>(state));
+ delete static_cast<SkCanvasState_v1*>(state);
}
diff --git a/src/utils/SkEventTracer.cpp b/src/utils/SkEventTracer.cpp
index 6176e1c..1c916ed 100644
--- a/src/utils/SkEventTracer.cpp
+++ b/src/utils/SkEventTracer.cpp
@@ -47,7 +47,7 @@
SkASSERT(nullptr == sk_atomic_load(&gUserTracer, sk_memory_order_acquire));
sk_atomic_store(&gUserTracer, tracer, sk_memory_order_release);
// An atomic load during process shutdown is probably overkill, but safe overkill.
- atexit([](){ SkDELETE(sk_atomic_load(&gUserTracer, sk_memory_order_acquire)); });
+ atexit([]() { delete sk_atomic_load(&gUserTracer, sk_memory_order_acquire); });
}
SkEventTracer* SkEventTracer::GetInstance() {
diff --git a/src/utils/SkFrontBufferedStream.cpp b/src/utils/SkFrontBufferedStream.cpp
index beead37..08364d1 100644
--- a/src/utils/SkFrontBufferedStream.cpp
+++ b/src/utils/SkFrontBufferedStream.cpp
@@ -69,7 +69,7 @@
if (NULL == stream) {
return NULL;
}
- return SkNEW_ARGS(FrontBufferedStream, (stream, bufferSize));
+ return new FrontBufferedStream(stream, bufferSize);
}
FrontBufferedStream::FrontBufferedStream(SkStream* stream, size_t bufferSize)
diff --git a/src/utils/SkImageGeneratorUtils.cpp b/src/utils/SkImageGeneratorUtils.cpp
index f5198c0..c9b2252 100644
--- a/src/utils/SkImageGeneratorUtils.cpp
+++ b/src/utils/SkImageGeneratorUtils.cpp
@@ -14,7 +14,7 @@
};
SkImageGenerator* SkImageGeneratorUtils::NewEmpty(const SkImageInfo& info) {
- return SkNEW_ARGS(GeneratorFromEmpty, (info));
+ return new GeneratorFromEmpty(info);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -38,7 +38,7 @@
};
SkImageGenerator* SkImageGeneratorUtils::NewFromBitmap(const SkBitmap& bm) {
- return SkNEW_ARGS(GeneratorFromBitmap, (bm));
+ return new GeneratorFromBitmap(bm);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -91,7 +91,7 @@
}
const SkAlphaType at = kPremul_SkAlphaType; // take isOpaque from caller?
SkImageInfo info = SkImageInfo::Make(desc.fWidth, desc.fHeight, ct, at, cpt);
- return SkNEW_ARGS(GeneratorFromTexture, (ctx, tex, info));
+ return new GeneratorFromTexture(ctx, tex, info);
}
#endif
return nullptr;
@@ -126,7 +126,7 @@
const SkColorType ct = kN32_SkColorType;
const SkAlphaType at = image->isOpaque() ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
const SkImageInfo info = SkImageInfo::Make(image->width(), image->height(), ct, at);
- return SkNEW_ARGS(GeneratorFromImage, (image, info));
+ return new GeneratorFromImage(image, info);
}
return nullptr;
}
diff --git a/src/utils/SkNullCanvas.cpp b/src/utils/SkNullCanvas.cpp
index 866a361..b5ee8d3 100644
--- a/src/utils/SkNullCanvas.cpp
+++ b/src/utils/SkNullCanvas.cpp
@@ -14,5 +14,5 @@
SkCanvas* SkCreateNullCanvas() {
// An N-Way canvas forwards calls to N canvas's. When N == 0 it's
// effectively a null canvas.
- return SkNEW_ARGS(SkNWayCanvas, (0,0));
+ return new SkNWayCanvas(0, 0);
}
diff --git a/src/utils/SkPatchGrid.cpp b/src/utils/SkPatchGrid.cpp
index 96e3c8f..386e3a6 100644
--- a/src/utils/SkPatchGrid.cpp
+++ b/src/utils/SkPatchGrid.cpp
@@ -22,11 +22,11 @@
}
SkPatchGrid::~SkPatchGrid() {
- SkDELETE_ARRAY(fCornerPts);
- SkDELETE_ARRAY(fCornerColors);
- SkDELETE_ARRAY(fTexCoords);
- SkDELETE_ARRAY(fHrzCtrlPts);
- SkDELETE_ARRAY(fVrtCtrlPts);
+ delete[] fCornerPts;
+ delete[] fCornerColors;
+ delete[] fTexCoords;
+ delete[] fHrzCtrlPts;
+ delete[] fVrtCtrlPts;
}
bool SkPatchGrid::setPatch(int x, int y, const SkPoint cubics[12], const SkColor colors[4],
@@ -120,38 +120,38 @@
}
void SkPatchGrid::reset(int rows, int cols, VertexType flags, SkXfermode* xMode) {
- SkDELETE_ARRAY(fCornerPts);
- SkDELETE_ARRAY(fCornerColors);
- SkDELETE_ARRAY(fTexCoords);
- SkDELETE_ARRAY(fHrzCtrlPts);
- SkDELETE_ARRAY(fVrtCtrlPts);
-
+ delete[] fCornerPts;
+ delete[] fCornerColors;
+ delete[] fTexCoords;
+ delete[] fHrzCtrlPts;
+ delete[] fVrtCtrlPts;
+
fCols = cols;
fRows = rows;
fModeFlags = flags;
fXferMode = xMode;
-
- fCornerPts = SkNEW_ARRAY(SkPoint, (fRows + 1) * (fCols + 1));
- fHrzCtrlPts = SkNEW_ARRAY(SkPoint, (fRows + 1) * fCols * 2);
- fVrtCtrlPts = SkNEW_ARRAY(SkPoint, fRows * 2 * (fCols + 1));
+
+ fCornerPts = new SkPoint[(fRows + 1) * (fCols + 1)];
+ fHrzCtrlPts = new SkPoint[(fRows + 1) * fCols * 2];
+ fVrtCtrlPts = new SkPoint[fRows * 2 * (fCols + 1)];
memset(fCornerPts, 0, (fRows + 1) * (fCols + 1) * sizeof(SkPoint));
memset(fHrzCtrlPts, 0, (fRows + 1) * fCols * 2 * sizeof(SkPoint));
memset(fVrtCtrlPts, 0, fRows * 2 * (fCols + 1) * sizeof(SkPoint));
if (fModeFlags & kColors_VertexType) {
- fCornerColors = SkNEW_ARRAY(SkColor, (fRows + 1) * (fCols + 1));
+ fCornerColors = new SkColor[(fRows + 1) * (fCols + 1)];
memset(fCornerColors, 0, (fRows + 1) * (fCols + 1) * sizeof(SkColor));
}
if (fModeFlags & kTexs_VertexType) {
- fTexCoords = SkNEW_ARRAY(SkPoint, (fRows + 1) * (fCols + 1));
+ fTexCoords = new SkPoint[(fRows + 1) * (fCols + 1)];
memset(fTexCoords, 0, (fRows + 1) * (fCols + 1) * sizeof(SkPoint));
}
}
void SkPatchGrid::draw(SkCanvas* canvas, SkPaint& paint) {
- int* maxCols = SkNEW_ARRAY(int, fCols);
- int* maxRows = SkNEW_ARRAY(int, fRows);
+ int* maxCols = new int[fCols];
+ int* maxRows = new int[fRows];
memset(maxCols, 0, fCols * sizeof(int));
memset(maxRows, 0, fRows * sizeof(int));
@@ -184,6 +184,6 @@
}
}
}
- SkDELETE_ARRAY(maxCols);
- SkDELETE_ARRAY(maxRows);
+ delete[] maxCols;
+ delete[] maxRows;
}
diff --git a/src/utils/SkPatchUtils.cpp b/src/utils/SkPatchUtils.cpp
index 08fd438..e9ff906 100644
--- a/src/utils/SkPatchUtils.cpp
+++ b/src/utils/SkPatchUtils.cpp
@@ -217,10 +217,10 @@
data->fVertexCount = (lodX + 1) * (lodY + 1);
}
data->fIndexCount = lodX * lodY * 6;
-
- data->fPoints = SkNEW_ARRAY(SkPoint, data->fVertexCount);
- data->fIndices = SkNEW_ARRAY(uint16_t, data->fIndexCount);
-
+
+ data->fPoints = new SkPoint[data->fVertexCount];
+ data->fIndices = new uint16_t[data->fIndexCount];
+
// if colors is not null then create array for colors
SkPMColor colorsPM[kNumCorners];
if (colors) {
@@ -228,12 +228,12 @@
for (int i = 0; i < kNumCorners; i++) {
colorsPM[i] = SkPreMultiplyColor(colors[i]);
}
- data->fColors = SkNEW_ARRAY(uint32_t, data->fVertexCount);
+ data->fColors = new uint32_t[data->fVertexCount];
}
// if texture coordinates are not null then create array for them
if (texCoords) {
- data->fTexCoords = SkNEW_ARRAY(SkPoint, data->fVertexCount);
+ data->fTexCoords = new SkPoint[data->fVertexCount];
}
SkPoint pts[kNumPtsCubic];
diff --git a/src/utils/SkPatchUtils.h b/src/utils/SkPatchUtils.h
index 879053a..3560421 100644
--- a/src/utils/SkPatchUtils.h
+++ b/src/utils/SkPatchUtils.h
@@ -35,10 +35,10 @@
, fIndices(NULL) { }
~VertexData() {
- SkDELETE_ARRAY(fPoints);
- SkDELETE_ARRAY(fTexCoords);
- SkDELETE_ARRAY(fColors);
- SkDELETE_ARRAY(fIndices);
+ delete[] fPoints;
+ delete[] fTexCoords;
+ delete[] fColors;
+ delete[] fIndices;
}
};
diff --git a/src/utils/SkRTConf.cpp b/src/utils/SkRTConf.cpp
index 5c99d27..f441bf1 100644
--- a/src/utils/SkRTConf.cpp
+++ b/src/utils/SkRTConf.cpp
@@ -46,8 +46,8 @@
continue;
}
- SkString* key = SkNEW_ARGS(SkString,(keyptr));
- SkString* val = SkNEW_ARGS(SkString,(valptr));
+ SkString *key = new SkString(keyptr);
+ SkString *val = new SkString(valptr);
fConfigFileKeys.append(1, &key);
fConfigFileValues.append(1, &val);
@@ -64,8 +64,8 @@
}
for (int i = 0 ; i < fConfigFileKeys.count() ; i++) {
- SkDELETE(fConfigFileKeys[i]);
- SkDELETE(fConfigFileValues[i]);
+ delete fConfigFileKeys[i];
+ delete fConfigFileValues[i];
}
}
diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp
index 6251c1b..5ce9067 100644
--- a/src/utils/debugger/SkDebugCanvas.cpp
+++ b/src/utils/debugger/SkDebugCanvas.cpp
@@ -58,12 +58,15 @@
class DebugPaintFilterCanvas : public SkPaintFilterCanvas {
public:
- DebugPaintFilterCanvas(int width, int height, bool overdrawViz, bool overrideFilterQuality,
+ DebugPaintFilterCanvas(int width,
+ int height,
+ bool overdrawViz,
+ bool overrideFilterQuality,
SkFilterQuality quality)
: INHERITED(width, height)
- , fOverdrawXfermode(overdrawViz ? SkNEW(OverdrawXfermode) : NULL)
+ , fOverdrawXfermode(overdrawViz ? new OverdrawXfermode : NULL)
, fOverrideFilterQuality(overrideFilterQuality)
- , fFilterQuality(quality) { }
+ , fFilterQuality(quality) {}
protected:
void onFilterPaint(SkPaint* paint, Type) const override {
@@ -361,11 +364,8 @@
}
const SkImageInfo info = this->imageInfo();
- fPaintFilterCanvas.reset(SkNEW_ARGS(DebugPaintFilterCanvas, (info.width(),
- info.height(),
- fOverdrawViz,
- fOverrideFilterQuality,
- fFilterQuality)));
+ fPaintFilterCanvas.reset(new DebugPaintFilterCanvas(info.width(), info.height(), fOverdrawViz,
+ fOverrideFilterQuality, fFilterQuality));
}
void SkDebugCanvas::setOverdrawViz(bool overdrawViz) {
diff --git a/src/utils/debugger/SkObjectParser.cpp b/src/utils/debugger/SkObjectParser.cpp
index 3807fad..cba8d06 100644
--- a/src/utils/debugger/SkObjectParser.cpp
+++ b/src/utils/debugger/SkObjectParser.cpp
@@ -201,7 +201,7 @@
if (boundStr) {
mPath->append(*boundStr);
- SkDELETE(boundStr);
+ delete boundStr;
}
return mPath;
diff --git a/src/utils/mac/SkStream_mac.cpp b/src/utils/mac/SkStream_mac.cpp
index 2688471..e62ced2 100644
--- a/src/utils/mac/SkStream_mac.cpp
+++ b/src/utils/mac/SkStream_mac.cpp
@@ -20,7 +20,7 @@
SkStream* stream = (SkStream*)info;
SkASSERT(stream->getMemoryBase() == addr);
SkASSERT(stream->getLength() == size);
- SkDELETE(stream);
+ delete stream;
}
// These are used by CGDataProviderSequentialCallbacks
@@ -42,7 +42,7 @@
// Used when info is an SkStream.
static void release_info_proc(void* info) {
SkASSERT(info);
- SkDELETE((SkStream*)info);
+ delete (SkStream*)info;
}
CGDataProviderRef SkCreateDataProviderFromStream(SkStream* stream) {
diff --git a/src/utils/win/SkDWriteFontFileStream.cpp b/src/utils/win/SkDWriteFontFileStream.cpp
index a187601..eb7e5dc 100644
--- a/src/utils/win/SkDWriteFontFileStream.cpp
+++ b/src/utils/win/SkDWriteFontFileStream.cpp
@@ -85,7 +85,7 @@
}
SkDWriteFontFileStream* SkDWriteFontFileStream::duplicate() const {
- return SkNEW_ARGS(SkDWriteFontFileStream, (fFontFileStream.get()));
+ return new SkDWriteFontFileStream(fFontFileStream.get());
}
size_t SkDWriteFontFileStream::getPosition() const {
diff --git a/src/utils/win/SkWGL_win.cpp b/src/utils/win/SkWGL_win.cpp
index 5c46138..60f3cb3 100644
--- a/src/utils/win/SkWGL_win.cpp
+++ b/src/utils/win/SkWGL_win.cpp
@@ -432,7 +432,7 @@
if (dc) {
HGLRC glrc = create_gl_context(dc, extensions, contextType);
if (glrc) {
- return SkNEW_ARGS(SkWGLPbufferContext, (pbuf, dc, glrc));
+ return new SkWGLPbufferContext(pbuf, dc, glrc);
}
extensions.releasePbufferDC(pbuf, dc);
}
diff --git a/src/views/SkEventSink.cpp b/src/views/SkEventSink.cpp
index 42c1ceb..282f2b8 100644
--- a/src/views/SkEventSink.cpp
+++ b/src/views/SkEventSink.cpp
@@ -148,7 +148,7 @@
count = prev->countListners();
}
- SkListenersTagList* next = SkNEW_ARGS(SkListenersTagList, (count + 1));
+ SkListenersTagList* next = new SkListenersTagList(count + 1);
if (prev)
{
@@ -209,7 +209,7 @@
const SkEventSinkID* iter = list->fIDs;
const SkEventSinkID* stop = iter + list->countListners();
while (iter < stop) {
- SkEvent* copy = SkNEW_ARGS(SkEvent, (evt));
+ SkEvent* copy = new SkEvent(evt);
copy->setTargetID(*iter++)->postDelay(delay);
}
}
diff --git a/src/xml/SkDOM.cpp b/src/xml/SkDOM.cpp
index eb1bc09..3bb0835 100644
--- a/src/xml/SkDOM.cpp
+++ b/src/xml/SkDOM.cpp
@@ -366,7 +366,7 @@
SkXMLParser* SkDOM::beginParsing() {
SkASSERT(!fParser);
- fParser.reset(SkNEW_ARGS(SkDOMParser, (&fAlloc)));
+ fParser.reset(new SkDOMParser(&fAlloc));
return fParser.get();
}
diff --git a/tests/BlurTest.cpp b/tests/BlurTest.cpp
index 645340a..cde700e 100644
--- a/tests/BlurTest.cpp
+++ b/tests/BlurTest.cpp
@@ -293,7 +293,7 @@
desc.fSampleCnt = 0;
SkAutoTUnref<GrTexture> texture(grContext->createTexture(desc, false, NULL, 0));
- SkAutoTUnref<SkGpuDevice> device(SkNEW_ARGS(SkGpuDevice, (grContext, texture.get())));
+ SkAutoTUnref<SkGpuDevice> device(new SkGpuDevice (grContext, texture.get()));
SkCanvas canvas(device.get());
blur_path(&canvas, path, gaussianSigma);
diff --git a/tests/CachedDataTest.cpp b/tests/CachedDataTest.cpp
index f65a46b..e3ceeaf 100644
--- a/tests/CachedDataTest.cpp
+++ b/tests/CachedDataTest.cpp
@@ -31,9 +31,9 @@
SkDiscardableMemory* dm = pool->create(size);
// the pool "can" return null, but it shouldn't in these controlled conditions
SK_ALWAYSBREAK(dm);
- return SkNEW_ARGS(SkCachedData, (size, dm));
+ return new SkCachedData(size, dm);
} else {
- return SkNEW_ARGS(SkCachedData, (sk_malloc_throw(size), size));
+ return new SkCachedData(sk_malloc_throw(size), size);
}
}
diff --git a/tests/CachedDecodingPixelRefTest.cpp b/tests/CachedDecodingPixelRefTest.cpp
index c69cd96..721c090 100644
--- a/tests/CachedDecodingPixelRefTest.cpp
+++ b/tests/CachedDecodingPixelRefTest.cpp
@@ -239,8 +239,7 @@
PixelRefType pixelRefType,
SkDiscardableMemory::Factory* factory) {
SkASSERT((pixelRefType >= 0) && (pixelRefType <= kLast_PixelRefType));
- SkAutoTDelete<SkImageGenerator> gen(SkNEW_ARGS(TestImageGenerator,
- (type, reporter)));
+ SkAutoTDelete<SkImageGenerator> gen(new TestImageGenerator(type, reporter));
REPORTER_ASSERT(reporter, gen.get() != NULL);
SkBitmap lazy;
bool success;
@@ -317,7 +316,7 @@
};
for (size_t i = 0; i < SK_ARRAY_COUNT(testTypes); ++i) {
TestImageGenerator::TestType test = testTypes[i];
- SkImageGenerator* gen = SkNEW_ARGS(TestImageGenerator, (test, r));
+ SkImageGenerator* gen = new TestImageGenerator(test, r);
SkAutoTUnref<SkImage> image(SkImage::NewFromGenerator(gen));
if (NULL == image.get()) {
ERRORF(r, "SkImage::NewFromGenerator unexpecedly failed ["
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp
index c80e6be..f797635 100644
--- a/tests/CanvasTest.cpp
+++ b/tests/CanvasTest.cpp
@@ -654,7 +654,7 @@
}
addr = (const SkPMColor*)((const char*)addr + rowBytes);
}
- SkDELETE(canvas);
+ delete canvas;
// now try a deliberately bad info
info = info.makeWH(-1, info.height());
@@ -672,7 +672,7 @@
info = SkImageInfo::MakeN32Premul(0, 0);
canvas = SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes);
REPORTER_ASSERT(reporter, canvas);
- SkDELETE(canvas);
+ delete canvas;
}
DEF_TEST(Canvas, reporter) {
diff --git a/tests/DataRefTest.cpp b/tests/DataRefTest.cpp
index 8f06a18..58600ef 100644
--- a/tests/DataRefTest.cpp
+++ b/tests/DataRefTest.cpp
@@ -310,6 +310,6 @@
check_alphabet_buffer(reporter, readers[i]);
check_alphabet_stream(reporter, streams[i]);
readers[i]->unref();
- SkDELETE(streams[i]);
+ delete streams[i];
}
}
diff --git a/tests/DrawBitmapRectTest.cpp b/tests/DrawBitmapRectTest.cpp
index 52c7433..0b0c87c 100644
--- a/tests/DrawBitmapRectTest.cpp
+++ b/tests/DrawBitmapRectTest.cpp
@@ -34,7 +34,7 @@
SkAutoTUnref<SkDiscardableMemoryPool> pool(
SkDiscardableMemoryPool::Create(10 * 1000, NULL));
SkBitmap bm;
- bool success = SkInstallDiscardablePixelRef(SkNEW(FailureImageGenerator), NULL, &bm, pool);
+ bool success = SkInstallDiscardablePixelRef(new FailureImageGenerator, NULL, &bm, pool);
REPORTER_ASSERT(reporter, success);
// now our bitmap has a pixelref, but we know it will fail to lock
diff --git a/tests/DrawFilterTest.cpp b/tests/DrawFilterTest.cpp
index 13ae5c6..de4672d 100644
--- a/tests/DrawFilterTest.cpp
+++ b/tests/DrawFilterTest.cpp
@@ -28,8 +28,7 @@
SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(10, 10));
SkCanvas* canvas = surface->getCanvas();
-
- SkAutoTUnref<TestFilter> df(SkNEW(TestFilter));
+ SkAutoTUnref<TestFilter> df(new TestFilter);
REPORTER_ASSERT(reporter, NULL == canvas->getDrawFilter());
diff --git a/tests/FrontBufferedStreamTest.cpp b/tests/FrontBufferedStreamTest.cpp
index f3ef47d..0b161b9 100644
--- a/tests/FrontBufferedStreamTest.cpp
+++ b/tests/FrontBufferedStreamTest.cpp
@@ -54,7 +54,7 @@
// NOTE: For this and other tests in this file, we cheat and continue to refer to the
// wrapped stream, but that's okay because we know the wrapping stream has not been
// deleted yet (and we only call const methods in it).
- SkMemoryStream* memStream = SkNEW_ARGS(SkMemoryStream, (gAbcs, strlen(gAbcs), false));
+ SkMemoryStream* memStream = new SkMemoryStream(gAbcs, strlen(gAbcs), false);
SkAutoTDelete<SkStream> bufferedStream(SkFrontBufferedStream::Create(memStream, bufferSize));
test_hasLength(reporter, *bufferedStream.get(), *memStream);
@@ -82,7 +82,7 @@
}
static void test_perfectly_sized_buffer(skiatest::Reporter* reporter, size_t bufferSize) {
- SkMemoryStream* memStream = SkNEW_ARGS(SkMemoryStream, (gAbcs, strlen(gAbcs), false));
+ SkMemoryStream* memStream = new SkMemoryStream(gAbcs, strlen(gAbcs), false);
SkAutoTDelete<SkStream> bufferedStream(SkFrontBufferedStream::Create(memStream, bufferSize));
test_hasLength(reporter, *bufferedStream.get(), *memStream);
@@ -101,7 +101,7 @@
}
static void test_skipping(skiatest::Reporter* reporter, size_t bufferSize) {
- SkMemoryStream* memStream = SkNEW_ARGS(SkMemoryStream, (gAbcs, strlen(gAbcs), false));
+ SkMemoryStream* memStream = new SkMemoryStream(gAbcs, strlen(gAbcs), false);
SkAutoTDelete<SkStream> bufferedStream(SkFrontBufferedStream::Create(memStream, bufferSize));
test_hasLength(reporter, *bufferedStream.get(), *memStream);
@@ -152,7 +152,8 @@
// does not invalidate the buffer.
static void test_read_beyond_buffer(skiatest::Reporter* reporter, size_t bufferSize) {
// Use a stream that behaves like Android's stream.
- AndroidLikeMemoryStream* memStream = SkNEW_ARGS(AndroidLikeMemoryStream, ((void*)gAbcs, bufferSize, false));
+ AndroidLikeMemoryStream* memStream =
+ new AndroidLikeMemoryStream((void*)gAbcs, bufferSize, false);
// Create a buffer that matches the length of the stream.
SkAutoTDelete<SkStream> bufferedStream(SkFrontBufferedStream::Create(memStream, bufferSize));
@@ -200,7 +201,8 @@
static void test_length_combos(skiatest::Reporter* reporter, size_t bufferSize) {
for (int hasLen = 0; hasLen <= 1; hasLen++) {
for (int hasPos = 0; hasPos <= 1; hasPos++) {
- LengthOptionalStream* stream = SkNEW_ARGS(LengthOptionalStream, (SkToBool(hasLen), SkToBool(hasPos)));
+ LengthOptionalStream* stream =
+ new LengthOptionalStream(SkToBool(hasLen), SkToBool(hasPos));
SkAutoTDelete<SkStream> buffered(SkFrontBufferedStream::Create(stream, bufferSize));
test_hasLength(reporter, *buffered.get(), *stream);
}
@@ -209,7 +211,7 @@
// Test using a stream with an initial offset.
static void test_initial_offset(skiatest::Reporter* reporter, size_t bufferSize) {
- SkMemoryStream* memStream = SkNEW_ARGS(SkMemoryStream, (gAbcs, strlen(gAbcs), false));
+ SkMemoryStream* memStream = new SkMemoryStream(gAbcs, strlen(gAbcs), false);
// Skip a few characters into the memStream, so that bufferedStream represents an offset into
// the stream it wraps.
@@ -286,7 +288,7 @@
};
DEF_TEST(ShortFrontBufferedStream, reporter) {
- FailingStream* failingStream = SkNEW(FailingStream);
+ FailingStream* failingStream = new FailingStream;
SkAutoTDelete<SkStreamRewindable> stream(SkFrontBufferedStream::Create(failingStream, 64));
SkBitmap bm;
// The return value of DecodeStream is not important. We are just using DecodeStream because
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index 16745e5..4b3bcdf 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -69,7 +69,7 @@
const char* name() const override { return "Big Ole Key"; }
GrGLFragmentProcessor* onCreateGLInstance() const override {
- return SkNEW_ARGS(GLBigKeyProcessor, (*this));
+ return new GLBigKeyProcessor(*this);
}
private:
diff --git a/tests/ImageCacheTest.cpp b/tests/ImageCacheTest.cpp
index e2efe97..98fb4ef 100644
--- a/tests/ImageCacheTest.cpp
+++ b/tests/ImageCacheTest.cpp
@@ -50,7 +50,7 @@
REPORTER_ASSERT(reporter, !cache.find(key, TestingRec::Visitor, &value));
REPORTER_ASSERT(reporter, -1 == value);
- cache.add(SkNEW_ARGS(TestingRec, (key, i)));
+ cache.add(new TestingRec(key, i));
REPORTER_ASSERT(reporter, cache.find(key, TestingRec::Visitor, &value));
REPORTER_ASSERT(reporter, i == value);
@@ -60,7 +60,7 @@
// stress test, should trigger purges
for (int i = 0; i < COUNT * 100; ++i) {
TestingKey key(i);
- cache.add(SkNEW_ARGS(TestingRec, (key, i)));
+ cache.add(new TestingRec(key, i));
}
}
@@ -75,8 +75,8 @@
static void test_cache_purge_shared_id(skiatest::Reporter* reporter, SkResourceCache& cache) {
for (int i = 0; i < COUNT; ++i) {
- TestingKey key(i, i & 1); // every other key will have a 1 for its sharedID
- cache.add(SkNEW_ARGS(TestingRec, (key, i)));
+ TestingKey key(i, i & 1); // every other key will have a 1 for its sharedID
+ cache.add(new TestingRec(key, i));
}
// Ensure that everyone is present
@@ -143,8 +143,8 @@
TestingKey key(1);
- cache.add(SkNEW_ARGS(TestingRec, (key, 2)));
- cache.add(SkNEW_ARGS(TestingRec, (key, 3)));
+ cache.add(new TestingRec(key, 2));
+ cache.add(new TestingRec(key, 3));
// Lookup can return either value.
intptr_t value = -1;
diff --git a/tests/ImageDecodingTest.cpp b/tests/ImageDecodingTest.cpp
index 1348ded..971c3e7 100644
--- a/tests/ImageDecodingTest.cpp
+++ b/tests/ImageDecodingTest.cpp
@@ -742,8 +742,7 @@
pixels[pixelCount] = sentinal; // This value should not be changed.
SkAutoTUnref<SingleAllocator> allocator(
- SkNEW_ARGS(SingleAllocator,
- ((void*)pixels.get(), sizeof(uint16_t) * pixelCount)));
+ new SingleAllocator((void*)pixels.get(), sizeof(uint16_t) * pixelCount));
decoder->setAllocator(allocator);
decoder->setSampleSize(2);
SkBitmap bitmap;
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index c15d719..f2aa0e9 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -80,7 +80,7 @@
skiatest::Reporter* reporter = (skiatest::Reporter*)buffer.readFunctionPtr();
SkMatrix matrix;
buffer.readMatrix(&matrix);
- return SkNEW_ARGS(MatrixTestImageFilter, (reporter, matrix));
+ return new MatrixTestImageFilter(reporter, matrix);
}
#ifndef SK_IGNORE_TO_STRING
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index 1c173da..de945f9 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -109,7 +109,7 @@
const SkPMColor green = SkPackARGB32(0xFF, 0, 0xFF, 0);
const SkPMColor blue = SkPackARGB32(0xFF, 0, 0, 0xFF);
SkPMColor colors[] = { red, green, blue, 0 };
- SkAutoTUnref<SkColorTable> ctable(SkNEW_ARGS(SkColorTable, (colors, SK_ARRAY_COUNT(colors))));
+ SkAutoTUnref<SkColorTable> ctable(new SkColorTable(colors, SK_ARRAY_COUNT(colors)));
// The colortable made a copy, so we can trash the original colors
memset(colors, 0xFF, sizeof(colors));
diff --git a/tests/JpegTest.cpp b/tests/JpegTest.cpp
index 8828926..1153a36 100644
--- a/tests/JpegTest.cpp
+++ b/tests/JpegTest.cpp
@@ -456,7 +456,7 @@
DEF_TEST(Jpeg_YUV, reporter) {
size_t len = sizeof(goodJpegImage);
- SkMemoryStream* stream = SkNEW_ARGS(SkMemoryStream, (goodJpegImage, len));
+ SkMemoryStream* stream = new SkMemoryStream(goodJpegImage, len);
SkBitmap bitmap;
SkDecodingImageGenerator::Options opts;
diff --git a/tests/KtxTest.cpp b/tests/KtxTest.cpp
index 53caabd..eb36d64 100644
--- a/tests/KtxTest.cpp
+++ b/tests/KtxTest.cpp
@@ -55,7 +55,7 @@
SkAutoDataUnref encodedData(SkImageEncoder::EncodeData(bm8888, SkImageEncoder::kKTX_Type, 0));
REPORTER_ASSERT(reporter, encodedData);
- SkAutoTDelete<SkMemoryStream> stream(SkNEW_ARGS(SkMemoryStream, (encodedData)));
+ SkAutoTDelete<SkMemoryStream> stream(new SkMemoryStream(encodedData));
REPORTER_ASSERT(reporter, stream);
SkBitmap decodedBitmap;
@@ -107,8 +107,7 @@
0xFF, 0xFF, 0xFF, 0x80, // Pixel 3
0xFF, 0xFF, 0xFF, 0x80};// Pixel 4
- SkAutoTDelete<SkMemoryStream> stream(
- SkNEW_ARGS(SkMemoryStream, (kHalfWhiteKTX, sizeof(kHalfWhiteKTX))));
+ SkAutoTDelete<SkMemoryStream> stream(new SkMemoryStream(kHalfWhiteKTX, sizeof(kHalfWhiteKTX)));
REPORTER_ASSERT(reporter, stream);
SkBitmap decodedBitmap;
diff --git a/tests/LayerRasterizerTest.cpp b/tests/LayerRasterizerTest.cpp
index b4edc14..82060b0 100644
--- a/tests/LayerRasterizerTest.cpp
+++ b/tests/LayerRasterizerTest.cpp
@@ -43,15 +43,13 @@
int DummyRasterizer::gCount;
-SkFlattenable* DummyRasterizer::CreateProc(SkReadBuffer&) {
- return SkNEW(DummyRasterizer);
-}
+SkFlattenable* DummyRasterizer::CreateProc(SkReadBuffer&) { return new DummyRasterizer; }
// Check to make sure that the SkPaint in the layer has its destructor called.
DEF_TEST(LayerRasterizer_destructor, reporter) {
{
SkPaint paint;
- paint.setRasterizer(SkNEW(DummyRasterizer))->unref();
+ paint.setRasterizer(new DummyRasterizer)->unref();
REPORTER_ASSERT(reporter, DummyRasterizer::GetCount() == 1);
SkLayerRasterizer::Builder builder;
diff --git a/tests/LazyPtrTest.cpp b/tests/LazyPtrTest.cpp
index 89443f9..c6ffd72 100644
--- a/tests/LazyPtrTest.cpp
+++ b/tests/LazyPtrTest.cpp
@@ -14,7 +14,7 @@
struct CreateIntFromFloat {
CreateIntFromFloat(float val) : fVal(val) {}
- int* operator()() const { return SkNEW_ARGS(int, ((int)fVal)); }
+ int* operator()() const { return new int((int)fVal); }
float fVal;
};
@@ -24,7 +24,7 @@
} // namespace
DEF_TEST(LazyPtr, r) {
- // Basic usage: calls SkNEW(int).
+ // Basic usage: calls new int.
SkLazyPtr<int> lazy;
int* ptr = lazy.get();
REPORTER_ASSERT(r, ptr);
@@ -48,7 +48,7 @@
REPORTER_ASSERT(r, ptr);
REPORTER_ASSERT(r, 99 == *ptr);
// Since custom_destroy didn't actually delete ptr, we do now.
- SkDELETE(ptr);
+ delete ptr;
}
DEF_TEST(LazyPtr_Threaded, r) {
diff --git a/tests/PDFInvalidBitmapTest.cpp b/tests/PDFInvalidBitmapTest.cpp
index 8a9b1fa..57e51f0 100644
--- a/tests/PDFInvalidBitmapTest.cpp
+++ b/tests/PDFInvalidBitmapTest.cpp
@@ -32,7 +32,7 @@
SkBitmap make_invalid_bitmap(const SkImageInfo& imageInfo) {
SkBitmap bitmap;
bitmap.setInfo(imageInfo);
- bitmap.setPixelRef(SkNEW_ARGS(InvalidPixelRef, (imageInfo)))->unref();
+ bitmap.setPixelRef(new InvalidPixelRef(imageInfo))->unref();
return bitmap;
}
diff --git a/tests/PDFPrimitivesTest.cpp b/tests/PDFPrimitivesTest.cpp
index 1d35c08..8af806c 100644
--- a/tests/PDFPrimitivesTest.cpp
+++ b/tests/PDFPrimitivesTest.cpp
@@ -384,7 +384,7 @@
SkFlattenable* DummyImageFilter::CreateProc(SkReadBuffer& buffer) {
SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 0);
bool visited = buffer.readBool();
- return SkNEW_ARGS(DummyImageFilter, (visited));
+ return new DummyImageFilter(visited);
}
#ifndef SK_IGNORE_TO_STRING
diff --git a/tests/PathOpsOpCircleThreadedTest.cpp b/tests/PathOpsOpCircleThreadedTest.cpp
index 0bb75cc..30b1603 100644
--- a/tests/PathOpsOpCircleThreadedTest.cpp
+++ b/tests/PathOpsOpCircleThreadedTest.cpp
@@ -70,8 +70,8 @@
for (int b = a + 1; b < 7; ++b) {
for (int c = 0 ; c < 6; ++c) {
for (int d = 0; d < 2; ++d) {
- *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
- (&testOpCirclesMain, a, b, c, d, &testRunner));
+ *testRunner.fRunnables.append() = new PathOpsThreadedRunnable(
+ &testOpCirclesMain, a, b, c, d, &testRunner);
}
}
if (!reporter->allowExtendedTest()) goto finish;
diff --git a/tests/PathOpsOpCubicThreadedTest.cpp b/tests/PathOpsOpCubicThreadedTest.cpp
index 12eb71b..991d4e7 100644
--- a/tests/PathOpsOpCubicThreadedTest.cpp
+++ b/tests/PathOpsOpCubicThreadedTest.cpp
@@ -87,8 +87,8 @@
for (int b = a + 1; b < 7; ++b) {
for (int c = 0 ; c < 6; ++c) {
for (int d = c + 1; d < 7; ++d) {
- *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
- (&testOpCubicsMain, a, b, c, d, &testRunner));
+ *testRunner.fRunnables.append() =
+ new PathOpsThreadedRunnable(&testOpCubicsMain, a, b, c, d, &testRunner);
}
}
if (!reporter->allowExtendedTest()) goto finish;
diff --git a/tests/PathOpsOpLoopThreadedTest.cpp b/tests/PathOpsOpLoopThreadedTest.cpp
old mode 100755
new mode 100644
index 3f6d081..7b4b7ce
--- a/tests/PathOpsOpLoopThreadedTest.cpp
+++ b/tests/PathOpsOpLoopThreadedTest.cpp
@@ -99,8 +99,8 @@
for (int b = a + 1; b < 7; ++b) {
for (int c = 0 ; c < 6; ++c) {
for (int d = c + 1; d < 7; ++d) {
- *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
- (&testOpLoopsMain, a, b, c, d, &testRunner));
+ *testRunner.fRunnables.append() =
+ new PathOpsThreadedRunnable(&testOpLoopsMain, a, b, c, d, &testRunner);
}
}
if (!reporter->allowExtendedTest()) goto finish;
diff --git a/tests/PathOpsOpRectThreadedTest.cpp b/tests/PathOpsOpRectThreadedTest.cpp
index 9195e4a..4d672e4 100644
--- a/tests/PathOpsOpRectThreadedTest.cpp
+++ b/tests/PathOpsOpRectThreadedTest.cpp
@@ -88,8 +88,8 @@
for (int b = a + 1; b < 7; ++b) {
for (int c = 0 ; c < 6; ++c) {
for (int d = c + 1; d < 7; ++d) {
- *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
- (&testPathOpsRectsMain, a, b, c, d, &testRunner));
+ *testRunner.fRunnables.append() = new PathOpsThreadedRunnable(
+ &testPathOpsRectsMain, a, b, c, d, &testRunner);
}
}
if (!reporter->allowExtendedTest()) goto finish;
diff --git a/tests/PathOpsQuadLineIntersectionThreadedTest.cpp b/tests/PathOpsQuadLineIntersectionThreadedTest.cpp
index a4f87df..9ecc1f0 100644
--- a/tests/PathOpsQuadLineIntersectionThreadedTest.cpp
+++ b/tests/PathOpsQuadLineIntersectionThreadedTest.cpp
@@ -116,8 +116,8 @@
for (int a = 0; a < 16; ++a) {
for (int b = 0 ; b < 16; ++b) {
for (int c = 0 ; c < 16; ++c) {
- *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
- (&testQuadLineIntersectMain, a, b, c, 0, &testRunner));
+ *testRunner.fRunnables.append() = new PathOpsThreadedRunnable(
+ &testQuadLineIntersectMain, a, b, c, 0, &testRunner);
}
if (!reporter->allowExtendedTest()) goto finish;
}
diff --git a/tests/PathOpsSimplifyDegenerateThreadedTest.cpp b/tests/PathOpsSimplifyDegenerateThreadedTest.cpp
old mode 100755
new mode 100644
index 8e8c58b..99a54d8
--- a/tests/PathOpsSimplifyDegenerateThreadedTest.cpp
+++ b/tests/PathOpsSimplifyDegenerateThreadedTest.cpp
@@ -80,9 +80,8 @@
int cx = c & 0x03;
int cy = c >> 2;
bool abcIsATriangle = (bx - ax) * (cy - ay) != (by - ay) * (cx - ax);
- *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
- (&testSimplifyDegeneratesMain, a, b, c, abcIsATriangle,
- &testRunner));
+ *testRunner.fRunnables.append() = new PathOpsThreadedRunnable(
+ &testSimplifyDegeneratesMain, a, b, c, abcIsATriangle, &testRunner);
}
if (!reporter->allowExtendedTest()) goto finish;
}
diff --git a/tests/PathOpsSimplifyQuadThreadedTest.cpp b/tests/PathOpsSimplifyQuadThreadedTest.cpp
index e3c0bc2..8ab84d7 100644
--- a/tests/PathOpsSimplifyQuadThreadedTest.cpp
+++ b/tests/PathOpsSimplifyQuadThreadedTest.cpp
@@ -86,8 +86,8 @@
for (int b = a ; b < 16; ++b) {
for (int c = b ; c < 16; ++c) {
for (int d = c; d < 16; ++d) {
- *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
- (&testSimplifyQuadsMain, a, b, c, d, &testRunner));
+ *testRunner.fRunnables.append() = new PathOpsThreadedRunnable(
+ &testSimplifyQuadsMain, a, b, c, d, &testRunner);
}
if (!reporter->allowExtendedTest()) goto finish;
}
diff --git a/tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp b/tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp
old mode 100755
new mode 100644
index f8e9a6e..f2c1dfc
--- a/tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp
+++ b/tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp
@@ -82,8 +82,8 @@
for (int b = a ; b < 16; ++b) {
for (int c = b ; c < 16; ++c) {
for (int d = c; d < 16; ++d) {
- *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
- (&testSimplifyQuadralateralsMain, a, b, c, d, &testRunner));
+ *testRunner.fRunnables.append() = new PathOpsThreadedRunnable(
+ &testSimplifyQuadralateralsMain, a, b, c, d, &testRunner);
}
if (!reporter->allowExtendedTest()) goto finish;
}
diff --git a/tests/PathOpsSimplifyRectThreadedTest.cpp b/tests/PathOpsSimplifyRectThreadedTest.cpp
index 52a78ec..8c4e03c 100644
--- a/tests/PathOpsSimplifyRectThreadedTest.cpp
+++ b/tests/PathOpsSimplifyRectThreadedTest.cpp
@@ -193,8 +193,8 @@
for (int b = a ; b < 8; ++b) {
for (int c = b ; c < 8; ++c) {
for (int d = c; d < 8; ++d) {
- *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
- (&testSimplify4x4RectsMain, a, b, c, d, &testRunner));
+ *testRunner.fRunnables.append() = new PathOpsThreadedRunnable(
+ &testSimplify4x4RectsMain, a, b, c, d, &testRunner);
}
if (!reporter->allowExtendedTest()) goto finish;
}
diff --git a/tests/PathOpsSimplifyTrianglesThreadedTest.cpp b/tests/PathOpsSimplifyTrianglesThreadedTest.cpp
old mode 100755
new mode 100644
index ee0ca2b..8d8feee
--- a/tests/PathOpsSimplifyTrianglesThreadedTest.cpp
+++ b/tests/PathOpsSimplifyTrianglesThreadedTest.cpp
@@ -90,8 +90,8 @@
if ((bx - ax) * (cy - ay) == (by - ay) * (cx - ax)) {
continue;
}
- *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
- (&testSimplifyTrianglesMain, a, b, c, 0, &testRunner));
+ *testRunner.fRunnables.append() = new PathOpsThreadedRunnable(
+ &testSimplifyTrianglesMain, a, b, c, 0, &testRunner);
}
if (!reporter->allowExtendedTest()) goto finish;
}
diff --git a/tests/PathOpsSkpClipTest.cpp b/tests/PathOpsSkpClipTest.cpp
old mode 100755
new mode 100644
index 95421fc..de4f48c
--- a/tests/PathOpsSkpClipTest.cpp
+++ b/tests/PathOpsSkpClipTest.cpp
@@ -300,7 +300,7 @@
TestRunner::~TestRunner() {
for (int index = 0; index < fRunnables.count(); index++) {
- SkDELETE(fRunnables[index]);
+ delete fRunnables[index];
}
}
@@ -799,8 +799,8 @@
if (!filename.endsWith(".skp")) {
filename.append(".skp");
}
- *testRunner.fRunnables.append() = SkNEW_ARGS(TestRunnableEncode,
- (&testSkpClipEncode, result.fDirNo, filename.c_str(), &testRunner));
+ *testRunner.fRunnables.append() = new TestRunnableEncode(&testSkpClipEncode, result.fDirNo,
+ filename.c_str(), &testRunner);
}
testRunner.render();
}
@@ -823,18 +823,17 @@
typedef SkTRegistry<Test*(*)(void*)> TestRegistry;
-#define DEF_TEST(name) \
- static void test_##name(); \
- class name##Class : public Test { \
- public: \
- static Test* Factory(void*) { return SkNEW(name##Class); } \
- protected: \
- void onGetName(SkString* name) override { \
- name->set(#name); \
- } \
- void onRun() override { test_##name(); } \
- }; \
- static TestRegistry gReg_##name##Class(name##Class::Factory); \
+#define DEF_TEST(name) \
+ static void test_##name(); \
+ class name##Class : public Test { \
+ public: \
+ static Test* Factory(void*) { return new name##Class; } \
+ \
+ protected: \
+ void onGetName(SkString* name) override { name->set(#name); } \
+ void onRun() override { test_##name(); } \
+ }; \
+ static TestRegistry gReg_##name##Class(name##Class::Factory); \
static void test_##name()
DEF_TEST(PathOpsSkpClip) {
@@ -868,8 +867,7 @@
int dirNo;
gDirs.reset();
while ((dirNo = gDirs.next()) > 0) {
- *testRunner.fRunnables.append() = SkNEW_ARGS(TestRunnableDir,
- (&testSkpClipMain, dirNo, &testRunner));
+ *testRunner.fRunnables.append() = new TestRunnableDir(&testSkpClipMain, dirNo, &testRunner);
}
testRunner.render();
TestState state;
@@ -934,8 +932,8 @@
int count = sorted.get()[dirNo - firstDirNo].count();
if (SkTSearch<SortByName, Less>(sorted.get()[dirNo - firstDirNo].begin(),
count, &name, sizeof(&name)) < 0) {
- *testRunner.fRunnables.append() = SkNEW_ARGS(TestRunnableFile,
- (&testSkpClip, dirNo, filename.c_str(), &testRunner));
+ *testRunner.fRunnables.append() = new TestRunnableFile(
+ &testSkpClip, dirNo, filename.c_str(), &testRunner);
}
}
checkEarlyExit:
diff --git a/tests/PathOpsThreadedCommon.cpp b/tests/PathOpsThreadedCommon.cpp
index 10501d1..342b560 100644
--- a/tests/PathOpsThreadedCommon.cpp
+++ b/tests/PathOpsThreadedCommon.cpp
@@ -11,7 +11,7 @@
PathOpsThreadedTestRunner::~PathOpsThreadedTestRunner() {
for (int index = 0; index < fRunnables.count(); index++) {
- SkDELETE(fRunnables[index]);
+ delete fRunnables[index];
}
}
diff --git a/tests/PathOpsTightBoundsTest.cpp b/tests/PathOpsTightBoundsTest.cpp
index d50c26a..9537561 100644
--- a/tests/PathOpsTightBoundsTest.cpp
+++ b/tests/PathOpsTightBoundsTest.cpp
@@ -39,8 +39,8 @@
int outerCount = reporter->allowExtendedTest() ? 100 : 1;
for (int index = 0; index < outerCount; ++index) {
for (int idx2 = 0; idx2 < 10; ++idx2) {
- *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
- (&testTightBoundsLines, 0, 0, 0, 0, &testRunner));
+ *testRunner.fRunnables.append() =
+ new PathOpsThreadedRunnable(&testTightBoundsLines, 0, 0, 0, 0, &testRunner);
}
}
testRunner.render();
@@ -114,8 +114,8 @@
int outerCount = reporter->allowExtendedTest() ? 100 : 1;
for (int index = 0; index < outerCount; ++index) {
for (int idx2 = 0; idx2 < 10; ++idx2) {
- *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
- (&testTightBoundsQuads, 0, 0, 0, 0, &testRunner));
+ *testRunner.fRunnables.append() =
+ new PathOpsThreadedRunnable(&testTightBoundsQuads, 0, 0, 0, 0, &testRunner);
}
}
testRunner.render();
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index b0bd667..68eb677 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -3577,7 +3577,7 @@
static void TestPathRef(skiatest::Reporter* reporter) {
static const int kRepeatCnt = 10;
- SkAutoTUnref<SkPathRef> pathRef(SkNEW(SkPathRef));
+ SkAutoTUnref<SkPathRef> pathRef(new SkPathRef);
SkPathRef::Editor ed(&pathRef);
@@ -3758,19 +3758,19 @@
// Check that listener is notified on moveTo().
- SkPathPriv::AddGenIDChangeListener(p, SkNEW(ChangeListener(&changed)));
+ SkPathPriv::AddGenIDChangeListener(p, new ChangeListener(&changed));
REPORTER_ASSERT(reporter, !changed);
p.moveTo(10, 0);
REPORTER_ASSERT(reporter, changed);
// Check that listener is notified on lineTo().
- SkPathPriv::AddGenIDChangeListener(p, SkNEW(ChangeListener(&changed)));
+ SkPathPriv::AddGenIDChangeListener(p, new ChangeListener(&changed));
REPORTER_ASSERT(reporter, !changed);
p.lineTo(20, 0);
REPORTER_ASSERT(reporter, changed);
// Check that listener is notified on reset().
- SkPathPriv::AddGenIDChangeListener(p, SkNEW(ChangeListener(&changed)));
+ SkPathPriv::AddGenIDChangeListener(p, new ChangeListener(&changed));
REPORTER_ASSERT(reporter, !changed);
p.reset();
REPORTER_ASSERT(reporter, changed);
@@ -3778,7 +3778,7 @@
p.moveTo(0, 0);
// Check that listener is notified on rewind().
- SkPathPriv::AddGenIDChangeListener(p, SkNEW(ChangeListener(&changed)));
+ SkPathPriv::AddGenIDChangeListener(p, new ChangeListener(&changed));
REPORTER_ASSERT(reporter, !changed);
p.rewind();
REPORTER_ASSERT(reporter, changed);
@@ -3787,7 +3787,7 @@
{
SkPath q;
q.moveTo(10, 10);
- SkPathPriv::AddGenIDChangeListener(q, SkNEW(ChangeListener(&changed)));
+ SkPathPriv::AddGenIDChangeListener(q, new ChangeListener(&changed));
REPORTER_ASSERT(reporter, !changed);
}
// q went out of scope.
diff --git a/tests/PixelRefTest.cpp b/tests/PixelRefTest.cpp
index 8a6e8e3..775354c 100644
--- a/tests/PixelRefTest.cpp
+++ b/tests/PixelRefTest.cpp
@@ -73,7 +73,7 @@
// Register a listener.
int count = 0;
- pixelRef->addGenIDChangeListener(SkNEW_ARGS(TestListener, (&count)));
+ pixelRef->addGenIDChangeListener(new TestListener(&count));
REPORTER_ASSERT(r, 0 == count);
// No one has looked at our pixelRef's generation ID, so invalidating it doesn't make sense.
@@ -90,7 +90,7 @@
// Force the generation ID to be recalculated, then add a listener.
REPORTER_ASSERT(r, 0 != pixelRef->getGenerationID());
- pixelRef->addGenIDChangeListener(SkNEW_ARGS(TestListener, (&count)));
+ pixelRef->addGenIDChangeListener(new TestListener(&count));
pixelRef->notifyPixelsChanged();
REPORTER_ASSERT(r, 1 == count);
diff --git a/tests/QuickRejectTest.cpp b/tests/QuickRejectTest.cpp
index e5dea24..c17aae9 100644
--- a/tests/QuickRejectTest.cpp
+++ b/tests/QuickRejectTest.cpp
@@ -17,7 +17,7 @@
public:
SkDrawLooper::Context* createContext(SkCanvas*, void* storage) const override {
- return SkNEW_PLACEMENT(storage, TestDrawLooperContext);
+ return new (storage) TestDrawLooperContext;
}
size_t contextSize() const override { return sizeof(TestDrawLooperContext); }
@@ -49,7 +49,7 @@
};
};
-SkFlattenable* TestLooper::CreateProc(SkReadBuffer&) { return SkNEW(TestLooper); }
+SkFlattenable* TestLooper::CreateProc(SkReadBuffer&) { return new TestLooper; }
static void test_drawBitmap(skiatest::Reporter* reporter) {
SkBitmap src;
diff --git a/tests/RecordTest.cpp b/tests/RecordTest.cpp
index b510da7..cf8c602 100644
--- a/tests/RecordTest.cpp
+++ b/tests/RecordTest.cpp
@@ -51,7 +51,7 @@
}
};
-#define APPEND(record, type, ...) SkNEW_PLACEMENT_ARGS(record.append<type>(), type, (__VA_ARGS__))
+#define APPEND(record, type, ...) new (record.append<type>()) type(__VA_ARGS__)
// Basic tests for the low-level SkRecord code.
DEF_TEST(Record, r) {
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index d5ee845..dff96f9 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -261,7 +261,7 @@
}
static TestResource* CreateScratch(GrGpu* gpu, SimulatedProperty property, bool cached = true) {
- return SkNEW_ARGS(TestResource, (gpu, property, cached, kScratchConstructor));
+ return new TestResource(gpu, property, cached, kScratchConstructor);
}
~TestResource() {
@@ -342,10 +342,10 @@
GrResourceCache* cache = mock.cache();
// Create a bunch of resources with no keys
- TestResource* a = SkNEW_ARGS(TestResource, (context->getGpu()));
- TestResource* b = SkNEW_ARGS(TestResource, (context->getGpu()));
- TestResource* c = SkNEW_ARGS(TestResource, (context->getGpu()));
- TestResource* d = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* a = new TestResource(context->getGpu());
+ TestResource* b = new TestResource(context->getGpu());
+ TestResource* c = new TestResource(context->getGpu());
+ TestResource* d = new TestResource(context->getGpu());
a->setSize(11);
b->setSize(12);
c->setSize(13);
@@ -404,14 +404,13 @@
TestResource* scratch =
TestResource::CreateScratch(context->getGpu(), TestResource::kB_SimulatedProperty);
scratch->setSize(10);
- TestResource* unique = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* unique = new TestResource(context->getGpu());
unique->setSize(11);
unique->resourcePriv().setUniqueKey(uniqueKey);
- TestResource* wrapped = SkNEW_ARGS(TestResource,
- (context->getGpu(), GrGpuResource::kBorrowed_LifeCycle));
+ TestResource* wrapped = new TestResource(context->getGpu(), GrGpuResource::kBorrowed_LifeCycle);
wrapped->setSize(12);
- TestResource* unbudgeted = SkNEW_ARGS(TestResource,
- (context->getGpu(), GrGpuResource::kUncached_LifeCycle));
+ TestResource* unbudgeted =
+ new TestResource(context->getGpu(), GrGpuResource::kUncached_LifeCycle);
unbudgeted->setSize(13);
// Make sure we can't add a unique key to the wrapped resource
@@ -446,7 +445,7 @@
unbudgeted->gpuMemorySize() == cache->getResourceBytes());
// Now try freeing the budgeted resources first
- wrapped = SkNEW_ARGS(TestResource, (context->getGpu(), GrGpuResource::kBorrowed_LifeCycle));
+ wrapped = new TestResource(context->getGpu(), GrGpuResource::kBorrowed_LifeCycle);
scratch->setSize(12);
unique->unref();
cache->purgeAllUnlocked();
@@ -499,7 +498,7 @@
REPORTER_ASSERT(reporter, 1 == cache->getBudgetedResourceCount());
REPORTER_ASSERT(reporter, 10 == cache->getBudgetedResourceBytes());
- unique = SkNEW_ARGS(TestResource, (context->getGpu()));
+ unique = new TestResource(context->getGpu());
unique->setSize(11);
unique->resourcePriv().setUniqueKey(uniqueKey);
unique->unref();
@@ -509,8 +508,7 @@
REPORTER_ASSERT(reporter, 21 == cache->getBudgetedResourceBytes());
size_t large = 2 * cache->getResourceBytes();
- unbudgeted = SkNEW_ARGS(TestResource,
- (context->getGpu(), large, GrGpuResource::kUncached_LifeCycle));
+ unbudgeted = new TestResource(context->getGpu(), large, GrGpuResource::kUncached_LifeCycle);
REPORTER_ASSERT(reporter, 3 == cache->getResourceCount());
REPORTER_ASSERT(reporter, 21 + large == cache->getResourceBytes());
REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount());
@@ -522,8 +520,7 @@
REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount());
REPORTER_ASSERT(reporter, 21 == cache->getBudgetedResourceBytes());
- wrapped = SkNEW_ARGS(TestResource,
- (context->getGpu(), large, GrGpuResource::kBorrowed_LifeCycle));
+ wrapped = new TestResource(context->getGpu(), large, GrGpuResource::kBorrowed_LifeCycle);
REPORTER_ASSERT(reporter, 3 == cache->getResourceCount());
REPORTER_ASSERT(reporter, 21 + large == cache->getResourceBytes());
REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount());
@@ -775,7 +772,7 @@
make_unique_key<0>(&key, 0);
// Create two resources that we will attempt to register with the same unique key.
- TestResource* a = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* a = new TestResource(context->getGpu());
a->setSize(11);
// Set key on resource a.
@@ -792,7 +789,7 @@
REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive());
// Create resource b and set the same key. It should replace a's unique key cache entry.
- TestResource* b = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* b = new TestResource(context->getGpu());
b->setSize(12);
b->resourcePriv().setUniqueKey(key);
REPORTER_ASSERT(reporter, b == cache->findAndRefUniqueResource(key));
@@ -812,7 +809,7 @@
// Now replace b with c, but make sure c can start with one unique key and change it to b's key.
// Also make b be unreffed when replacement occurs.
b->unref();
- TestResource* c = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* c = new TestResource(context->getGpu());
GrUniqueKey differentKey;
make_unique_key<0>(&differentKey, 1);
c->setSize(13);
@@ -849,7 +846,7 @@
{
GrUniqueKey key2;
make_unique_key<0>(&key2, 0);
- SkAutoTUnref<TestResource> d(SkNEW_ARGS(TestResource, (context->getGpu())));
+ SkAutoTUnref<TestResource> d(new TestResource(context->getGpu()));
int foo = 4132;
SkAutoTUnref<SkData> data(SkData::NewWithCopy(&foo, sizeof(foo)));
key2.setCustomData(data.get());
@@ -873,8 +870,8 @@
make_unique_key<0>(&key3, 3);
// Add three resources to the cache. Only c is usable as scratch.
- TestResource* a = SkNEW_ARGS(TestResource, (context->getGpu()));
- TestResource* b = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* a = new TestResource(context->getGpu());
+ TestResource* b = new TestResource(context->getGpu());
TestResource* c = TestResource::CreateScratch(context->getGpu(),
TestResource::kA_SimulatedProperty);
a->resourcePriv().setUniqueKey(key1);
@@ -939,9 +936,8 @@
make_unique_key<0>(&key1, 1);
make_unique_key<0>(&key2, 2);
-
- TestResource* a = SkNEW_ARGS(TestResource, (context->getGpu()));
- TestResource* b = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* a = new TestResource(context->getGpu());
+ TestResource* b = new TestResource(context->getGpu());
a->resourcePriv().setUniqueKey(key1);
b->resourcePriv().setUniqueKey(key2);
@@ -978,11 +974,11 @@
GrContext* context = mock.context();
GrResourceCache* cache = mock.cache();
- TestResource* a = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* a = new TestResource(context->getGpu());
a->resourcePriv().setUniqueKey(key1);
a->unref();
- TestResource* b = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* b = new TestResource(context->getGpu());
b->resourcePriv().setUniqueKey(key2);
b->unref();
@@ -1007,12 +1003,12 @@
GrContext* context = mock.context();
GrResourceCache* cache = mock.cache();
- TestResource* a = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* a = new TestResource(context->getGpu());
a->setSize(100);
a->resourcePriv().setUniqueKey(key1);
a->unref();
- TestResource* b = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* b = new TestResource(context->getGpu());
b->setSize(100);
b->resourcePriv().setUniqueKey(key2);
b->unref();
@@ -1061,7 +1057,7 @@
GrUniqueKey key;
make_unique_key<0>(&key, j);
- TestResource* r = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* r = new TestResource(context->getGpu());
r->resourcePriv().setUniqueKey(key);
if (random.nextU() % kLockedFreq) {
// Make this is purgeable.
@@ -1110,7 +1106,7 @@
{
// Insert a resource and send a flush notification kFlushCount times.
for (int i = 0; i < kFlushCount; ++i) {
- TestResource* r = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* r = new TestResource(context->getGpu());
GrUniqueKey k;
make_unique_key<1>(&k, i);
r->resourcePriv().setUniqueKey(k);
@@ -1141,7 +1137,7 @@
{
GrGpuResource* refedResources[kFlushCount >> 1];
for (int i = 0; i < kFlushCount; ++i) {
- TestResource* r = SkNEW_ARGS(TestResource, (context->getGpu()));
+ TestResource* r = new TestResource(context->getGpu());
GrUniqueKey k;
make_unique_key<1>(&k, i);
r->resourcePriv().setUniqueKey(k);
@@ -1196,12 +1192,12 @@
TestResource* resource;
- resource = SkNEW_ARGS(TestResource, (context->getGpu()));
+ resource = new TestResource(context->getGpu());
resource->resourcePriv().setUniqueKey(key1);
resource->setSize(1);
resource->unref();
- resource = SkNEW_ARGS(TestResource, (context->getGpu()));
+ resource = new TestResource(context->getGpu());
resource->resourcePriv().setUniqueKey(key2);
resource->setSize(1);
resource->unref();
diff --git a/tests/SkResourceCacheTest.cpp b/tests/SkResourceCacheTest.cpp
index bb12d66..58ab781 100644
--- a/tests/SkResourceCacheTest.cpp
+++ b/tests/SkResourceCacheTest.cpp
@@ -97,10 +97,10 @@
SkAutoTDelete<SkResourceCache> cache;
if (factory) {
- cache.reset(SkNEW_ARGS(SkResourceCache, (factory)));
+ cache.reset(new SkResourceCache(factory));
} else {
const size_t byteLimit = 100 * 1024;
- cache.reset(SkNEW_ARGS(SkResourceCache, (byteLimit)));
+ cache.reset(new SkResourceCache(byteLimit));
}
SkBitmap cachedBitmap;
make_bitmap(&cachedBitmap, SkImageInfo::MakeN32Premul(5, 5), allocator);
@@ -243,10 +243,10 @@
SkAutoTDelete<SkResourceCache> cache;
if (factory) {
- cache.reset(SkNEW_ARGS(SkResourceCache, (factory)));
+ cache.reset(new SkResourceCache(factory));
} else {
const size_t byteLimit = 100 * 1024;
- cache.reset(SkNEW_ARGS(SkResourceCache, (byteLimit)));
+ cache.reset(new SkResourceCache(byteLimit));
}
SkBitmap cachedBitmap;
make_bitmap(&cachedBitmap, SkImageInfo::MakeN32Premul(5, 5), allocator);
diff --git a/tests/SkpSkGrTest.cpp b/tests/SkpSkGrTest.cpp
index 212b0f6..23cd30c 100644
--- a/tests/SkpSkGrTest.cpp
+++ b/tests/SkpSkGrTest.cpp
@@ -164,7 +164,7 @@
SkpSkGrThreadedTestRunner::~SkpSkGrThreadedTestRunner() {
for (int index = 0; index < fRunnables.count(); index++) {
- SkDELETE(fRunnables[index]);
+ delete fRunnables[index];
}
}
@@ -477,7 +477,7 @@
}
}
finish:
- SkDELETE(pic);
+ delete pic;
}
static SkString makeStatusString(int dirNo) {
@@ -705,8 +705,8 @@
goto skipOver;
}
}
- *testRunner.fRunnables.append() = SkNEW_ARGS(SkpSkGrThreadedRunnable,
- (&testSkGrMain, dirIndex, filename.c_str(), &testRunner));
+ *testRunner.fRunnables.append() = new SkpSkGrThreadedRunnable(
+ &testSkGrMain, dirIndex, filename.c_str(), &testRunner);
skipOver:
;
}
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index fac283d..771fc9e 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -86,7 +86,7 @@
REPORTER_ASSERT(reporter, NULL == SkImage::NewRasterCopy(info, NULL, 0));
REPORTER_ASSERT(reporter, NULL == SkImage::NewRasterData(info, NULL, 0));
REPORTER_ASSERT(reporter, NULL == SkImage::NewFromRaster(info, NULL, 0, NULL, NULL));
- REPORTER_ASSERT(reporter, NULL == SkImage::NewFromGenerator(SkNEW(EmptyGenerator)));
+ REPORTER_ASSERT(reporter, NULL == SkImage::NewFromGenerator(new EmptyGenerator));
}
static void test_empty_surface(skiatest::Reporter* reporter, GrContext* ctx) {
diff --git a/tests/SwizzlerTest.cpp b/tests/SwizzlerTest.cpp
index 7ed1c39..c2ae07c 100644
--- a/tests/SwizzlerTest.cpp
+++ b/tests/SwizzlerTest.cpp
@@ -29,7 +29,7 @@
const size_t totalBytes = imageInfo.getSafeSize(rowBytes) + offset;
// Create fake image data where every byte has a value of 0
- SkAutoTDeleteArray<uint8_t> storage(SkNEW_ARRAY(uint8_t, totalBytes));
+ SkAutoTDeleteArray<uint8_t> storage(new uint8_t[totalBytes]);
memset(storage.get(), 0, totalBytes);
// Adjust the pointer in order to test on different memory alignments
uint8_t* imageData = storage.get() + offset;
diff --git a/tests/TArrayTest.cpp b/tests/TArrayTest.cpp
index 8c1e8e4..6a9b5f5 100644
--- a/tests/TArrayTest.cpp
+++ b/tests/TArrayTest.cpp
@@ -61,12 +61,12 @@
namespace {
SkTArray<int>* make() {
typedef SkTArray<int> IntArray;
- return SkNEW(IntArray);
+ return new IntArray;
}
template <int N> SkTArray<int>* make_s() {
typedef SkSTArray<N, int> IntArray;
- return SkNEW(IntArray);
+ return new IntArray;
}
}
@@ -97,14 +97,14 @@
for (int i = 0; i < kSizes[dataSizeB]; ++i) {
REPORTER_ASSERT(reporter, curr++ == (*a)[i]);
}
- SkDELETE(b);
+ delete b;
a->swap(a);
curr = kSizes[dataSizeA];
for (int i = 0; i < kSizes[dataSizeB]; ++i) {
REPORTER_ASSERT(reporter, curr++ == (*a)[i]);
}
- SkDELETE(a);
+ delete a;
}
}
}
diff --git a/tests/TextBlobCacheTest.cpp b/tests/TextBlobCacheTest.cpp
index 6f67382..cf2a239 100644
--- a/tests/TextBlobCacheTest.cpp
+++ b/tests/TextBlobCacheTest.cpp
@@ -107,7 +107,7 @@
if (normal) {
paint.setTypeface(orig);
} else {
- SkAutoTUnref<SkTypeface> typeface(SkNEW_ARGS(SkRandomTypeface, (orig, paint, true)));
+ SkAutoTUnref<SkTypeface> typeface(new SkRandomTypeface(orig, paint, true));
paint.setTypeface(typeface);
}
diff --git a/tests/skia_test.cpp b/tests/skia_test.cpp
index 150bf3b..fbd35d0 100644
--- a/tests/skia_test.cpp
+++ b/tests/skia_test.cpp
@@ -104,7 +104,7 @@
}
fStatus->endTest(fTest.name, !reporter.fError, elapsed,
reporter.fTestCount);
- SkDELETE(this);
+ delete this;
}
private:
@@ -189,7 +189,7 @@
} else if (test.needsGpu) {
gpuTests.push_back(&test);
} else {
- cpuTests.add(SkNEW_ARGS(SkTestRunnable, (test, &status)));
+ cpuTests.add(new SkTestRunnable(test, &status));
}
}
@@ -203,8 +203,7 @@
// Run GPU tests on this thread.
for (int i = 0; i < gpuTests.count(); i++) {
- SkNEW_ARGS(SkTestRunnable, (*gpuTests[i], &status, grContextFactoryPtr))
- ->run();
+ (new SkTestRunnable(*gpuTests[i], &status, grContextFactoryPtr))->run();
}
// Block until threaded tests finish.
diff --git a/tools/PictureBenchmark.cpp b/tools/PictureBenchmark.cpp
index f708f53..9a86d85 100644
--- a/tools/PictureBenchmark.cpp
+++ b/tools/PictureBenchmark.cpp
@@ -44,10 +44,10 @@
Timer* PictureBenchmark::setupTimer(bool useGLTimer) {
#if SK_SUPPORT_GPU
if (useGLTimer && fRenderer != NULL && fRenderer->isUsingGpuDevice()) {
- return SkNEW_ARGS(Timer, (fRenderer->getGLContext()));
+ return new Timer(fRenderer->getGLContext());
}
#endif
- return SkNEW_ARGS(Timer, (NULL));
+ return new Timer(NULL);
}
PictureRenderer* PictureBenchmark::setRenderer(sk_tools::PictureRenderer* renderer) {
diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp
index 34b08f5..ee8e981 100644
--- a/tools/PictureRenderer.cpp
+++ b/tools/PictureRenderer.cpp
@@ -131,7 +131,7 @@
case kBitmap_DeviceType: {
SkBitmap bitmap;
sk_tools::setup_bitmap(&bitmap, width, height);
- canvas.reset(SkNEW_ARGS(SkCanvas, (bitmap)));
+ canvas.reset(new SkCanvas(bitmap));
}
break;
#if SK_SUPPORT_GPU
@@ -165,7 +165,7 @@
if (!device) {
return NULL;
}
- canvas.reset(SkNEW_ARGS(SkCanvas, (device)));
+ canvas.reset(new SkCanvas(device));
break;
}
#endif
@@ -179,7 +179,7 @@
canvas->setAllowSoftClip(false);
}
- canvas.reset(SkNEW_ARGS(FlagsFilterCanvas, (canvas.get(), fDrawFilters)));
+ canvas.reset(new FlagsFilterCanvas(canvas.get(), fDrawFilters));
}
this->scaleToScaleFactor(canvas);
@@ -408,7 +408,7 @@
writer.endRecording();
fCanvas->flush();
if (out) {
- *out = SkNEW(SkBitmap);
+ *out = new SkBitmap;
setup_bitmap(*out, SkScalarCeilToInt(fPicture->cullRect().width()),
SkScalarCeilToInt(fPicture->cullRect().height()));
fCanvas->readPixels(*out, 0, 0);
@@ -453,7 +453,7 @@
}
fCanvas->flush();
if (out) {
- *out = SkNEW(SkBitmap);
+ *out = new SkBitmap;
setup_bitmap(*out, SkScalarCeilToInt(fPicture->cullRect().width()),
SkScalarCeilToInt(fPicture->cullRect().height()));
fCanvas->readPixels(*out, 0, 0);
@@ -694,7 +694,7 @@
SkBitmap bitmap;
if (out) {
- *out = SkNEW(SkBitmap);
+ *out = new SkBitmap;
setup_bitmap(*out, SkScalarCeilToInt(fPicture->cullRect().width()),
SkScalarCeilToInt(fPicture->cullRect().height()));
setup_bitmap(&bitmap, fTileWidth, fTileHeight);
@@ -794,7 +794,7 @@
void PlaybackCreationRenderer::setup() {
SkAutoTDelete<SkBBHFactory> factory(this->getFactory());
- fRecorder.reset(SkNEW(SkPictureRecorder));
+ fRecorder.reset(new SkPictureRecorder);
SkCanvas* canvas = fRecorder->beginRecording(SkIntToScalar(this->getViewWidth()),
SkIntToScalar(this->getViewHeight()),
factory.get(),
@@ -821,7 +821,7 @@
case kNone_BBoxHierarchyType:
return NULL;
case kRTree_BBoxHierarchyType:
- return SkNEW(SkRTreeFactory);
+ return new SkRTreeFactory;
}
SkASSERT(0); // invalid bbhType
return NULL;
diff --git a/tools/PictureRenderingFlags.cpp b/tools/PictureRenderingFlags.cpp
index bd718a0..7a2fc25 100644
--- a/tools/PictureRenderingFlags.cpp
+++ b/tools/PictureRenderingFlags.cpp
@@ -110,7 +110,7 @@
if (FLAGS_mode.count() >= 1) {
mode = FLAGS_mode[0];
if (0 == strcmp(mode, "record")) {
- renderer.reset(SkNEW_ARGS(sk_tools::RecordPictureRenderer, RENDERER_ARGS));
+ renderer.reset(new sk_tools::RecordPictureRenderer RENDERER_ARGS);
} else if (0 == strcmp(mode, "tile") || 0 == strcmp(mode, "pow2tile")
|| 0 == strcmp(mode, "copyTile")) {
useTiles = true;
@@ -134,10 +134,10 @@
heightString = FLAGS_mode[2];
} else if (0 == strcmp(mode, "playbackCreation") && kBench_PictureTool == tool) {
- renderer.reset(SkNEW_ARGS(sk_tools::PlaybackCreationRenderer, RENDERER_ARGS));
+ renderer.reset(new sk_tools::PlaybackCreationRenderer RENDERER_ARGS);
// undocumented
} else if (0 == strcmp(mode, "rerecord") && kRender_PictureTool == tool) {
- renderer.reset(SkNEW_ARGS(sk_tools::RecordPictureRenderer, RENDERER_ARGS));
+ renderer.reset(new sk_tools::RecordPictureRenderer RENDERER_ARGS);
} else if (0 == strcmp(mode, "simple")) {
// Allow 'mode' to be set to 'simple', but do not create a renderer, so we can
// ensure that pipe does not override a mode besides simple. The renderer will
@@ -175,12 +175,12 @@
x = y = 4;
}
#if SK_SUPPORT_GPU
- tiledRenderer.reset(SkNEW_ARGS(sk_tools::CopyTilesRenderer, (grContextOpts, x, y)));
+ tiledRenderer.reset(new sk_tools::CopyTilesRenderer(grContextOpts, x, y));
#else
- tiledRenderer.reset(SkNEW_ARGS(sk_tools::CopyTilesRenderer, (x, y)));
+ tiledRenderer.reset(new sk_tools::CopyTilesRenderer(x, y));
#endif
} else {
- tiledRenderer.reset(SkNEW_ARGS(sk_tools::TiledPictureRenderer, RENDERER_ARGS));
+ tiledRenderer.reset(new sk_tools::TiledPictureRenderer RENDERER_ARGS);
}
if (isPowerOf2Mode) {
@@ -241,12 +241,12 @@
error.printf("Pipe is incompatible with other modes.\n");
return NULL;
}
- renderer.reset(SkNEW_ARGS(sk_tools::PipePictureRenderer, RENDERER_ARGS));
+ renderer.reset(new sk_tools::PipePictureRenderer RENDERER_ARGS);
}
}
if (NULL == renderer) {
- renderer.reset(SkNEW_ARGS(sk_tools::SimplePictureRenderer, RENDERER_ARGS));
+ renderer.reset(new sk_tools::SimplePictureRenderer RENDERER_ARGS);
}
if (FLAGS_viewport.count() > 0) {
diff --git a/tools/VisualBench/VisualBench.cpp b/tools/VisualBench/VisualBench.cpp
index b24672a..0763d5c 100644
--- a/tools/VisualBench/VisualBench.cpp
+++ b/tools/VisualBench/VisualBench.cpp
@@ -57,20 +57,20 @@
, fLoops(1)
, fState(kPreWarmLoops_State)
, fBenchmark(NULL)
- , fResults(SkNEW(ResultsWriter)) {
+ , fResults(new ResultsWriter) {
SkCommandLineFlags::Parse(argc, argv);
this->setTitle();
this->setupBackend();
- fBenchmarkStream.reset(SkNEW(VisualBenchmarkStream));
+ fBenchmarkStream.reset(new VisualBenchmarkStream);
// Print header
SkDebugf("curr/maxrss\tloops\tflushes\tmin\tmedian\tmean\tmax\tstddev\tbench\n");
// setup json logging if required
if (!FLAGS_outResultsFile.isEmpty()) {
- fResults.reset(SkNEW(NanoJSONResultsWriter(FLAGS_outResultsFile[0])));
+ fResults.reset(new NanoJSONResultsWriter(FLAGS_outResultsFile[0]));
}
if (1 == FLAGS_properties.count() % 2) {
diff --git a/tools/VisualBench/VisualBenchmarkStream.cpp b/tools/VisualBench/VisualBenchmarkStream.cpp
index e3eb44d..f8d01a1 100644
--- a/tools/VisualBench/VisualBenchmarkStream.cpp
+++ b/tools/VisualBench/VisualBenchmarkStream.cpp
@@ -93,7 +93,7 @@
if (gm->runAsBench()) {
fSourceType = "gm";
fBenchType = "micro";
- return SkNEW_ARGS(GMBench, (gm.detach()));
+ return new GMBench(gm.detach());
}
}
@@ -108,7 +108,7 @@
SkString name = SkOSPath::Basename(path.c_str());
fSourceType = "skp";
fBenchType = "playback";
- return SkNEW_ARGS(VisualSKPBench, (name.c_str(), pic.get()));
+ return new VisualSKPBench(name.c_str(), pic.get());
}
return NULL;
diff --git a/tools/bench_pictures_main.cpp b/tools/bench_pictures_main.cpp
index b29f4d1..865bb51 100644
--- a/tools/bench_pictures_main.cpp
+++ b/tools/bench_pictures_main.cpp
@@ -431,13 +431,9 @@
SkAutoTDelete<PictureJSONResultsWriter> jsonWriter;
if (FLAGS_jsonLog.count() == 1) {
SkASSERT(FLAGS_builderName.count() == 1 && FLAGS_gitHash.count() == 1);
- jsonWriter.reset(SkNEW(PictureJSONResultsWriter(
- FLAGS_jsonLog[0],
- FLAGS_builderName[0],
- FLAGS_buildNumber,
- FLAGS_timestamp,
- FLAGS_gitHash[0],
- FLAGS_gitNumber)));
+ jsonWriter.reset(new PictureJSONResultsWriter(FLAGS_jsonLog[0], FLAGS_builderName[0],
+ FLAGS_buildNumber, FLAGS_timestamp,
+ FLAGS_gitHash[0], FLAGS_gitNumber));
gWriter.add(jsonWriter.get());
}
diff --git a/tools/flags/SkCommandLineFlags.cpp b/tools/flags/SkCommandLineFlags.cpp
index ec9949b..2ea45c2 100644
--- a/tools/flags/SkCommandLineFlags.cpp
+++ b/tools/flags/SkCommandLineFlags.cpp
@@ -18,7 +18,7 @@
bool SkFlagInfo::CreateStringFlag(const char* name, const char* shortName,
SkCommandLineFlags::StringArray* pStrings,
const char* defaultValue, const char* helpString) {
- SkFlagInfo* info = SkNEW_ARGS(SkFlagInfo, (name, shortName, kString_FlagType, helpString));
+ SkFlagInfo* info = new SkFlagInfo(name, shortName, kString_FlagType, helpString);
info->fDefaultString.set(defaultValue);
info->fStrings = pStrings;
@@ -334,7 +334,7 @@
gHead = NULL;
while (flag != NULL) {
SkFlagInfo* next = flag->next();
- SkDELETE(flag);
+ delete flag;
flag = next;
}
if (helpPrinted) {
diff --git a/tools/flags/SkCommandLineFlags.h b/tools/flags/SkCommandLineFlags.h
index 465d4a0..ae504cb 100644
--- a/tools/flags/SkCommandLineFlags.h
+++ b/tools/flags/SkCommandLineFlags.h
@@ -262,7 +262,7 @@
*/
static bool CreateBoolFlag(const char* name, const char* shortName, bool* pBool,
bool defaultValue, const char* helpString) {
- SkFlagInfo* info = SkNEW_ARGS(SkFlagInfo, (name, shortName, kBool_FlagType, helpString));
+ SkFlagInfo* info = new SkFlagInfo(name, shortName, kBool_FlagType, helpString);
info->fBoolValue = pBool;
*info->fBoolValue = info->fDefaultBool = defaultValue;
return true;
@@ -283,7 +283,7 @@
*/
static bool CreateIntFlag(const char* name, int32_t* pInt,
int32_t defaultValue, const char* helpString) {
- SkFlagInfo* info = SkNEW_ARGS(SkFlagInfo, (name, NULL, kInt_FlagType, helpString));
+ SkFlagInfo* info = new SkFlagInfo(name, NULL, kInt_FlagType, helpString);
info->fIntValue = pInt;
*info->fIntValue = info->fDefaultInt = defaultValue;
return true;
@@ -294,7 +294,7 @@
*/
static bool CreateDoubleFlag(const char* name, double* pDouble,
double defaultValue, const char* helpString) {
- SkFlagInfo* info = SkNEW_ARGS(SkFlagInfo, (name, NULL, kDouble_FlagType, helpString));
+ SkFlagInfo* info = new SkFlagInfo(name, NULL, kDouble_FlagType, helpString);
info->fDoubleValue = pDouble;
*info->fDoubleValue = info->fDefaultDouble = defaultValue;
return true;
diff --git a/tools/render_pdfs_main.cpp b/tools/render_pdfs_main.cpp
index 4e13f7e..9b80ef4 100644
--- a/tools/render_pdfs_main.cpp
+++ b/tools/render_pdfs_main.cpp
@@ -115,7 +115,7 @@
static SkWStream* open_stream(const SkString& outputDir,
const SkString& inputFilename) {
if (outputDir.isEmpty()) {
- return SkNEW(NullWStream);
+ return new NullWStream;
}
SkString outputPath;
@@ -123,8 +123,7 @@
return NULL;
}
- SkAutoTDelete<SkFILEWStream> stream(
- SkNEW_ARGS(SkFILEWStream, (outputPath.c_str())));
+ SkAutoTDelete<SkFILEWStream> stream(new SkFILEWStream(outputPath.c_str()));
if (!stream.get() || !stream->isValid()) {
SkDebugf("Could not write to file %s\n", outputPath.c_str());
return NULL;
diff --git a/tools/render_pictures_main.cpp b/tools/render_pictures_main.cpp
index 3920831..8cda966 100644
--- a/tools/render_pictures_main.cpp
+++ b/tools/render_pictures_main.cpp
@@ -273,7 +273,7 @@
if (!success || ((FLAGS_validate || FLAGS_writeWholeImage) && bitmap == NULL)) {
SkDebugf("Failed to draw the picture.\n");
- SkDELETE(bitmap);
+ delete bitmap;
return false;
}
@@ -290,10 +290,9 @@
arbbh.set(referenceRenderer, sk_tools::PictureRenderer::kNone_BBoxHierarchyType);
} else {
#if SK_SUPPORT_GPU
- referenceRenderer = SkNEW_ARGS(sk_tools::SimplePictureRenderer,
- (renderer.getGrContextOptions()));
+ referenceRenderer = new sk_tools::SimplePictureRenderer(renderer.getGrContextOptions());
#else
- referenceRenderer = SkNEW(sk_tools::SimplePictureRenderer);
+ referenceRenderer = new sk_tools::SimplePictureRenderer;
#endif
}
SkAutoTUnref<sk_tools::PictureRenderer> aurReferenceRenderer(referenceRenderer);
@@ -303,23 +302,23 @@
if (!success || NULL == referenceBitmap || NULL == referenceBitmap->getPixels()) {
SkDebugf("Failed to draw the reference picture.\n");
- SkDELETE(bitmap);
- SkDELETE(referenceBitmap);
+ delete bitmap;
+ delete referenceBitmap;
return false;
}
if (success && (bitmap->width() != referenceBitmap->width())) {
SkDebugf("Expected image width: %i, actual image width %i.\n",
referenceBitmap->width(), bitmap->width());
- SkDELETE(bitmap);
- SkDELETE(referenceBitmap);
+ delete bitmap;
+ delete referenceBitmap;
return false;
}
if (success && (bitmap->height() != referenceBitmap->height())) {
SkDebugf("Expected image height: %i, actual image height %i",
referenceBitmap->height(), bitmap->height());
- SkDELETE(bitmap);
- SkDELETE(referenceBitmap);
+ delete bitmap;
+ delete referenceBitmap;
return false;
}
@@ -336,13 +335,13 @@
x, y, FLAGS_maxComponentDiff,
*referenceBitmap->getAddr32(x, y),
*bitmap->getAddr32(x, y));
- SkDELETE(bitmap);
- SkDELETE(referenceBitmap);
+ delete bitmap;
+ delete referenceBitmap;
return false;
}
}
}
- SkDELETE(referenceBitmap);
+ delete referenceBitmap;
for (int i = 1; i <= 255; ++i) {
if(diffs[i] > 0) {
@@ -373,7 +372,7 @@
success &= sk_tools::write_bitmap_to_disk(*bitmap, *writePath, NULL, outputFilename);
}
}
- SkDELETE(bitmap);
+ delete bitmap;
return success;
}
diff --git a/tools/sk_tool_utils_font.cpp b/tools/sk_tool_utils_font.cpp
index 06008c6..6d6fda9 100644
--- a/tools/sk_tool_utils_font.cpp
+++ b/tools/sk_tool_utils_font.cpp
@@ -59,13 +59,13 @@
if (fontData->fFontCache) {
font = SkSafeRef(fontData->fFontCache);
} else {
- font = SkNEW_ARGS(SkTestFont, (*fontData));
+ font = new SkTestFont(*fontData);
SkDEBUGCODE(font->fDebugName = sub->fName);
SkDEBUGCODE(font->fDebugStyle = sub->fStyle);
fontData->fFontCache = SkSafeRef(font);
}
}
- return SkNEW_ARGS(SkTestTypeface, (font, SkFontStyle(style)));
+ return new SkTestTypeface(font, SkFontStyle(style));
}
}
diff --git a/tools/skpdiff/SkDiffContext.cpp b/tools/skpdiff/SkDiffContext.cpp
index d145460..5add0df 100644
--- a/tools/skpdiff/SkDiffContext.cpp
+++ b/tools/skpdiff/SkDiffContext.cpp
@@ -28,7 +28,7 @@
SkDiffContext::~SkDiffContext() {
if (fDiffers) {
- SkDELETE_ARRAY(fDiffers);
+ delete[] fDiffers;
}
}
@@ -57,14 +57,14 @@
void SkDiffContext::setDiffers(const SkTDArray<SkImageDiffer*>& differs) {
// Delete whatever the last array of differs was
if (fDiffers) {
- SkDELETE_ARRAY(fDiffers);
+ delete[] fDiffers;
fDiffers = NULL;
fDifferCount = 0;
}
// Copy over the new differs
fDifferCount = differs.count();
- fDiffers = SkNEW_ARRAY(SkImageDiffer*, fDifferCount);
+ fDiffers = new SkImageDiffer* [fDifferCount];
differs.copy(fDiffers);
}
diff --git a/tools/skpdiff/SkPMetric.cpp b/tools/skpdiff/SkPMetric.cpp
index 392a342..3563642 100644
--- a/tools/skpdiff/SkPMetric.cpp
+++ b/tools/skpdiff/SkPMetric.cpp
@@ -1,3 +1,9 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
#include <cmath>
#include <math.h>
@@ -25,12 +31,10 @@
height(h) {
SkASSERT(w > 0);
SkASSERT(h > 0);
- image = SkNEW_ARRAY(T, w * h);
+ image = new T[w * h];
}
- ~Image2D() {
- SkDELETE_ARRAY(image);
- }
+ ~Image2D() { delete[] image; }
void readPixel(int x, int y, T* pixel) const {
SkASSERT(x >= 0);
@@ -66,17 +70,17 @@
ImageArray(int w, int h, int s)
: slices(s) {
SkASSERT(s > 0);
- image = SkNEW_ARRAY(Image2D<T>*, s);
+ image = new Image2D<T>* [s];
for (int sliceIndex = 0; sliceIndex < slices; sliceIndex++) {
- image[sliceIndex] = SkNEW_ARGS(Image2D<T>, (w, h));
+ image[sliceIndex] = new Image2D<T>(w, h);
}
}
~ImageArray() {
for (int sliceIndex = 0; sliceIndex < slices; sliceIndex++) {
- SkDELETE(image[sliceIndex]);
+ delete image[sliceIndex];
}
- SkDELETE_ARRAY(image);
+ delete[] image;
}
Image2D<T>* getLayer(int z) const {
@@ -296,9 +300,9 @@
ImageL3D baselineL(width, height, maxLevels);
ImageL3D testL(width, height, maxLevels);
ImageL scratchImageL(width, height);
- float* cyclesPerDegree = SkNEW_ARRAY(float, maxLevels);
- float* thresholdFactorFrequency = SkNEW_ARRAY(float, maxLevels - 2);
- float* contrast = SkNEW_ARRAY(float, maxLevels - 2);
+ float* cyclesPerDegree = new float[maxLevels];
+ float* thresholdFactorFrequency = new float[maxLevels - 2];
+ float* contrast = new float[maxLevels - 2];
lab_to_l(baselineLAB, baselineL.getLayer(0));
lab_to_l(testLAB, testL.getLayer(0));
@@ -311,7 +315,7 @@
// Contrast sensitivity is based on image dimensions. Therefore it cannot be statically
// generated.
- float* contrastSensitivityTable = SkNEW_ARRAY(float, maxLevels * 1000);
+ float* contrastSensitivityTable = new float[maxLevels * 1000];
for (int levelIndex = 0; levelIndex < maxLevels; levelIndex++) {
for (int csLum = 0; csLum < 1000; csLum++) {
contrastSensitivityTable[levelIndex * 1000 + csLum] =
@@ -435,10 +439,10 @@
}
}
- SkDELETE_ARRAY(cyclesPerDegree);
- SkDELETE_ARRAY(contrast);
- SkDELETE_ARRAY(thresholdFactorFrequency);
- SkDELETE_ARRAY(contrastSensitivityTable);
+ delete[] cyclesPerDegree;
+ delete[] contrast;
+ delete[] thresholdFactorFrequency;
+ delete[] contrastSensitivityTable;
return 1.0 - (double)(*poiCount) / (width * height);
}