Style Change: SkNEW->new; SkDELETE->delete

DOCS_PREVIEW= https://skia.org/?cl=1316123003

Review URL: https://codereview.chromium.org/1316123003
This commit is contained in:
halcanary 2015-08-26 13:07:48 -07:00 committed by Commit bot
parent 5015176adf
commit 385fe4d4b6
542 changed files with 1872 additions and 2260 deletions
bench
debugger/QT
dm
experimental/SimpleCocoaApp
gm

View File

@ -244,14 +244,14 @@ private:
////////////////////////////////////////////////////////////////////////////////
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);)

View File

@ -169,33 +169,32 @@ private:
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 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,
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 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);)

View File

@ -14,12 +14,12 @@ BenchLogger::BenchLogger()
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();
}

View File

@ -493,4 +493,4 @@ private:
// 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);

View File

@ -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 @@ private:
};
#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

View File

@ -60,4 +60,4 @@ private:
typedef Benchmark INHERITED;
};
DEF_BENCH( return SkNEW_ARGS(FSRectBench, ()); )
DEF_BENCH(return new FSRectBench();)

View File

@ -48,5 +48,5 @@ private:
///////////////////////////////////////////////////////////////////////////////
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);)

View File

@ -308,27 +308,18 @@ private:
};
// 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);)

View File

@ -45,7 +45,7 @@ static void populate_cache(GrGpu* gpu, int resourceCount, int keyData32Count) {
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();
}

View File

@ -46,7 +46,7 @@ public:
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));
}
}

View File

@ -127,12 +127,12 @@ static inline SkRect make_concentric_rects(SkRandom&, int index, int numRects) {
///////////////////////////////////////////////////////////////////////////////
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));

View File

@ -249,40 +249,35 @@ private:
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");)

View File

@ -76,10 +76,10 @@ protected:
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));
}
}

View File

@ -102,4 +102,4 @@ private:
typedef Benchmark INHERITED;
};
DEF_BENCH( return SkNEW_ARGS(RectoriBench, ()); )
DEF_BENCH(return new RectoriBench();)

View File

@ -121,12 +121,12 @@ private:
#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");)

View File

@ -64,4 +64,4 @@ private:
typedef Benchmark INHERITED;
};
DEF_BENCH( return SkNEW_ARGS(RegionContainBench, (sect_proc, "sect")); )
DEF_BENCH(return new RegionContainBench(sect_proc, "sect");)

View File

@ -71,5 +71,5 @@ private:
SKPAnimationBench::Animation* SKPAnimationBench::CreateZoomAnimation(SkScalar zoomMax,
double zoomPeriodMs) {
return SkNEW_ARGS(ZoomAnimation, (zoomMax, zoomPeriodMs));
return new ZoomAnimation(zoomMax, zoomPeriodMs);
}

View File

@ -113,5 +113,5 @@ private:
};
// 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));

View File

@ -103,17 +103,17 @@ static SkPaint paint_maker() {
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);)

View File

@ -92,4 +92,4 @@ private:
///////////////////////////////////////////////////////////////////////////////
DEF_BENCH( return SkNEW_ARGS(VertBench, ()); )
DEF_BENCH(return new VertBench();)

View File

@ -71,5 +71,5 @@ private:
//////////////////////////////////////////////////////////////////////////////
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);)

View File

@ -514,7 +514,7 @@ static bool valid_subset_bench(const SkString& path, SkColorType colorType, bool
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 bool valid_subset_bench(const SkString& path, SkColorType colorType, bool
}
static void cleanup_run(Target* target) {
SkDELETE(target);
delete target;
#if SK_SUPPORT_GPU
if (FLAGS_abandonGpuContext) {
gGrFactory->abandonContexts();
@ -676,7 +676,7 @@ public:
if (gm->runAsBench()) {
fSourceType = "gm";
fBenchType = "micro";
return SkNEW_ARGS(GMBench, (gm.detach()));
return new GMBench(gm.detach());
}
}
@ -692,7 +692,7 @@ public:
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 @@ public:
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 @@ public:
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 @@ int nanobench_main() {
#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 @@ int nanobench_main() {
}
}
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) {

View File

@ -40,7 +40,7 @@ static const char* get_color_name(SkColorType colorType) {
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);

View File

@ -67,7 +67,7 @@ void SubsetSingleBench::onDraw(const int n, SkCanvas* canvas) {
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;

View File

@ -63,7 +63,7 @@ void SubsetTranslateBench::onDraw(const int n, SkCanvas* canvas) {
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 @@ void SubsetTranslateBench::onDraw(const int n, SkCanvas* canvas) {
// 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));

View File

@ -63,7 +63,7 @@ void SubsetZoomBench::onDraw(const int n, SkCanvas* canvas) {
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;

View File

@ -725,7 +725,7 @@ void SkDebuggerGUI::setupDirectoryWidget(const QString& path) {
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);

View File

@ -134,7 +134,7 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
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 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
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 @@ Error SKPSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const
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));

View File

@ -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 @@ static SkPicture* LoadPicture(const char path[]) {
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 @@ void application_init() {
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 @@ void application_init() {
canvas.divName(filename, true);
SkPicture* pic = LoadPicture(path.c_str());
pic->draw(&canvas);
SkDELETE(pic);
delete pic;
}
SkDebugf("];\n\n");

View File

@ -105,7 +105,7 @@ private:
typedef skiagm::GM INHERITED;
};
DEF_GM( return SkNEW(AAClipGM); )
DEF_GM(return new AAClipGM;)
/////////////////////////////////////////////////////////////////////////
@ -118,7 +118,7 @@ static SkCanvas* make_canvas(const SkBitmap& bm) {
(SkPMColor*)bm.getPixels(),
bm.rowBytes());
} else {
return SkNEW_ARGS(SkCanvas, (bm));
return new SkCanvas(bm);
}
}
@ -190,7 +190,7 @@ private:
};
#if 0 // Disabled pending fix from reed@
DEF_GM( return SkNEW(CGImageGM); )
DEF_GM( return new CGImageGM; )
#endif
#endif
@ -260,5 +260,4 @@ protected:
private:
typedef skiagm::GM INHERITED;
};
DEF_GM( return SkNEW(ClipCubicGM); )
DEF_GM(return new ClipCubicGM;)

View File

@ -124,8 +124,7 @@ static SkBitmap indexed_bitmap() {
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);

View File

@ -76,4 +76,4 @@ private:
typedef skiagm::GM INHERITED;
};
DEF_GM( return SkNEW(AlphaGradientsGM); )
DEF_GM(return new AlphaGradientsGM;)

View File

@ -109,6 +109,5 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_GM( return SkNEW(AnisotropicGM); )
DEF_GM(return new AnisotropicGM;)
}

View File

@ -79,6 +79,5 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_GM( return SkNEW(ArcOfZorroGM); )
DEF_GM(return new ArcOfZorroGM;)
}

View File

@ -99,4 +99,4 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_GM( return SkNEW(skiagm::ASTCBitmapGM); )
DEF_GM(return new skiagm::ASTCBitmapGM;)

View File

@ -57,4 +57,4 @@ private:
/////////////////////////////////////////////////////////////////////////////////////
DEF_GM( return SkNEW(BadPaintGM); )
DEF_GM(return new BadPaintGM;)

View File

@ -40,7 +40,7 @@ public:
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 @@ public:
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 @@ private:
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

View File

@ -111,6 +111,5 @@ private:
typedef GM INHERITED;
};
DEF_GM( return SkNEW(BigBlursGM); )
DEF_GM(return new BigBlursGM;)
}

View File

@ -52,4 +52,4 @@ private:
typedef skiagm::GM INHERITED;
};
DEF_GM( return SkNEW(BigTextGM); )
DEF_GM(return new BigTextGM;)

View File

@ -103,6 +103,5 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_GM( return SkNEW(BigTileImageFilterGM); )
DEF_GM(return new BigTileImageFilterGM;)
}

View File

@ -82,9 +82,8 @@ private:
//////////////////////////////////////////////////////////////////////////////
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);)
}

View File

@ -77,4 +77,4 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_GM( return SkNEW(BmpFilterQualityRepeat); )
DEF_GM(return new BmpFilterQualityRepeat;)

View File

@ -67,5 +67,4 @@ private:
typedef skiagm::GM INHERITED;
};
DEF_GM( return SkNEW(ClipStrokeRectGM); )
DEF_GM(return new ClipStrokeRectGM;)

View File

@ -64,6 +64,5 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_GM(return SkNEW(ClipDrawDrawGM);)
DEF_GM(return new ClipDrawDrawGM;)
}

View File

@ -38,7 +38,7 @@ protected:
stream.rewind();
codec->setDitherImage(dither);
codec->decode(&stream, &fBitmap, kN32_SkColorType, SkImageDecoder::kDecodePixels_Mode);
SkDELETE(codec);
delete codec;
}
}

View File

@ -84,4 +84,4 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_GM( return SkNEW(ColorFiltersGM); )
DEF_GM(return new ColorFiltersGM;)

View File

@ -40,7 +40,7 @@ protected:
if (NULL == orig) {
orig = SkTypeface::RefDefault();
}
fColorType = SkNEW_ARGS(SkGTypeface, (orig, paint));
fColorType = new SkGTypeface(orig, paint);
orig->unref();
}
@ -70,4 +70,4 @@ private:
typedef skiagm::GM INHERITED;
};
DEF_GM( return SkNEW(ColorTypeGM); )
DEF_GM(return new ColorTypeGM;)

View File

@ -47,7 +47,7 @@ protected:
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,

View File

@ -200,13 +200,12 @@ private:
//////////////////////////////////////////////////////////////////////////////
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);)
}

View File

@ -35,7 +35,7 @@ static SkShader* make_shader(SkXfermode::Mode mode) {
SkAutoTUnref<SkXfermode> xfer(SkXfermode::Create(mode));
return SkNEW_ARGS(SkComposeShader, (shaderA, shaderB, xfer));
return new SkComposeShader(shaderA, shaderB, xfer);
}
class ComposeShaderGM : public skiagm::GM {

View File

@ -128,7 +128,7 @@ private:
SkPath fGiantCircle;
typedef skiagm::GM INHERITED;
};
DEF_GM( return SkNEW(ConicPathsGM); )
DEF_GM(return new ConicPathsGM;)
//////////////////////////////////////////////////////////////////////////////

View File

@ -192,7 +192,7 @@ private:
const SkScalar ConstColorProcessor::kPad = 10.f;
const SkScalar ConstColorProcessor::kRectSize = 20.f;
DEF_GM( return SkNEW(ConstColorProcessor); )
DEF_GM(return new ConstColorProcessor;)
}
#endif

View File

@ -211,7 +211,7 @@ protected:
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 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_GM( return SkNEW(ConvexLineOnlyPathsGM); )
DEF_GM(return new ConvexLineOnlyPathsGM;)
}

View File

@ -297,6 +297,5 @@ private:
typedef GM INHERITED;
};
DEF_GM( return SkNEW(ConvexPolyClip); )
DEF_GM(return new ConvexPolyClip;)
}

View File

@ -38,7 +38,7 @@ public:
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 @@ private:
typedef GM INHERITED;
};
DEF_GM( return SkNEW(ConvexPolyEffect); )
DEF_GM(return new ConvexPolyEffect;)
}
#endif

View File

@ -474,10 +474,9 @@ private:
//////////////////////////////////////////////////////////////////////////////
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);)

View File

@ -50,7 +50,7 @@ private:
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 @@ public:
}
void onSetData(const GrGLProgramDataManager&, const GrProcessor&) override {}
};
return SkNEW(DCGLFP);
return new DCGLFP;
}
const char* name() const override { return "DCFP"; }
@ -98,7 +98,7 @@ bool DCShader::asFragmentProcessor(GrContext*, const SkPaint& paint, const SkMat
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 @@ public:
~DCShaderGM() override {
for (int i = 0; i < fPrims.count(); ++i) {
SkDELETE(fPrims[i]);
delete fPrims[i];
}
}
@ -212,15 +212,15 @@ protected:
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 @@ protected:
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 @@ private:
typedef GM INHERITED;
};
DEF_GM( return SkNEW(DCShaderGM); )
DEF_GM(return new DCShaderGM;)
}
#endif

2
gm/dftext.cpp Executable file → Normal file
View File

@ -215,4 +215,4 @@ private:
typedef skiagm::GM INHERITED;
};
DEF_GM( return SkNEW(DFTextGM); )
DEF_GM(return new DFTextGM;)

View File

@ -87,7 +87,7 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_GM( return SkNEW(DiscardGM); )
DEF_GM(return new DiscardGM;)
} // end namespace

View File

@ -180,7 +180,7 @@ class DownsampleBitmapImageGM: public DownsampleBitmapGM {
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

View File

@ -58,4 +58,4 @@ private:
typedef skiagm::GM INHERITED;
};
DEF_GM( return SkNEW(EmbossGM); )
DEF_GM(return new EmbossGM;)

View File

@ -219,10 +219,10 @@ private:
//////////////////////////////////////////////////////////////////////////////
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

View File

@ -205,7 +205,7 @@ protected:
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

View File

@ -321,6 +321,5 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_GM(return SkNEW(ImageFilterFastBoundGM);)
DEF_GM(return new ImageFilterFastBoundGM;)
}

View File

@ -108,7 +108,7 @@ protected:
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

View File

@ -83,4 +83,4 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_GM( return SkNEW(FontCacheGM); )
DEF_GM(return new FontCacheGM;)

View File

@ -300,12 +300,12 @@ private:
//////////////////////////////////////////////////////////////////////////////
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

View File

@ -66,9 +66,7 @@ public:
fDoRotate = doRotate;
}
virtual ~GiantBitmapGM() {
SkDELETE(fBM);
}
virtual ~GiantBitmapGM() { delete fBM; }
protected:

12
gm/gm.h
View File

@ -24,13 +24,11 @@ struct GrContextOptions;
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 {

View File

@ -128,15 +128,15 @@ struct ColorPos {
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 @@ private:
///////////////////////////////////////////////////////////////////////////////
DEF_GM( return SkNEW(GradientsNoTextureGM));
DEF_GM( return SkNEW(GradientsManyColorsGM));
DEF_GM(return new GradientsNoTextureGM);
DEF_GM(return new GradientsManyColorsGM);

View File

@ -26,9 +26,7 @@ public:
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 @@ public:
}
};
static IdentityImageFilter* Create(SkImageFilter* input = NULL) {
return SkNEW_ARGS(IdentityImageFilter, (input));
return new IdentityImageFilter(input);
}
SK_TO_STRING_OVERRIDE()

View File

@ -34,7 +34,7 @@ public:
}
};
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,

View File

@ -169,7 +169,7 @@ private:
typedef GM INHERITED;
};
DEF_GM( return SkNEW(ImageFromYUVTextures); )
DEF_GM(return new ImageFromYUVTextures;)
}
#endif

View File

@ -72,7 +72,7 @@ private:
//////////////////////////////////////////////////////////////////////////////
static GM* MyFactory(void*) { return SkNEW(InternalLinksGM); }
static GM* MyFactory(void*) { return new InternalLinksGM; }
static GMRegistry reg(MyFactory);
}

View File

@ -65,5 +65,5 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_GM( return SkNEW(LargeGlyphBlur); )
DEF_GM(return new LargeGlyphBlur;)
}

View File

@ -60,4 +60,4 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_GM( return SkNEW(LerpXfermodeGM); )
DEF_GM(return new LerpXfermodeGM;)

View File

@ -170,6 +170,5 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_GM( return SkNEW(ImageLightingGM); )
DEF_GM(return new ImageLightingGM;)
}

View File

@ -185,6 +185,5 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_GM( return SkNEW(LightingShaderGM); )
DEF_GM(return new LightingShaderGM;)
}

View File

@ -152,4 +152,4 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_GM( return SkNEW(LumaFilterGM); )
DEF_GM(return new LumaFilterGM;)

View File

@ -163,5 +163,5 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_GM( return SkNEW(MixedTextBlobsGM); )
DEF_GM(return new MixedTextBlobsGM;)
}

View File

@ -49,8 +49,7 @@ static SkShader* make_bg_shader(int checkSize) {
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 {

View File

@ -258,7 +258,10 @@ static SkSurface* create_compat_surface(SkCanvas* canvas, int width, int height)
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 @@ static void tiled(SkCanvas* finalCanvas, SkMultiPictureDraw* mpd,
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 @@ namespace skiagm {
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);)
}

View File

@ -154,6 +154,5 @@ private:
typedef GM INHERITED;
};
DEF_GM(return SkNEW(SkPatchGM); )
DEF_GM(return new SkPatchGM;)
}

View File

@ -156,6 +156,5 @@ private:
typedef GM INHERITED;
};
DEF_GM(return SkNEW(SkPatchGridGM); )
DEF_GM(return new SkPatchGridGM;)
}

View File

@ -68,4 +68,4 @@ private:
typedef skiagm::GM INHERITED;
};
DEF_GM( return SkNEW(PeekPixelsGM); )
DEF_GM(return new PeekPixelsGM;)

View File

@ -81,4 +81,4 @@ private:
typedef skiagm::GM INHERITED;
};
DEF_GM( return SkNEW(PictureGM); )
DEF_GM(return new PictureGM;)

View File

@ -183,4 +183,4 @@ private:
typedef skiagm::GM INHERITED;
};
DEF_GM( return SkNEW(PictureGeneratorGM); )
DEF_GM(return new PictureGeneratorGM;)

View File

@ -181,7 +181,7 @@ private:
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

View File

@ -155,4 +155,4 @@ private:
typedef GM INHERITED;
};
DEF_GM( return SkNEW(PictureShaderTileGM); )
DEF_GM(return new PictureShaderTileGM;)

View File

@ -175,7 +175,7 @@ private:
};
//////////////////////////////////////////////////////////////////////////////
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;)

3
gm/smallarc.cpp Executable file → Normal file
View File

@ -50,6 +50,5 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_GM( return SkNEW(SmallArcGM); )
DEF_GM(return new SmallArcGM;)
}

View File

@ -355,6 +355,5 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_GM(return SkNEW(StrokeFillGM);)
DEF_GM(return new StrokeFillGM;)
}

View File

@ -407,4 +407,4 @@ static skiagm::GMRegistry R2(F2);
static skiagm::GMRegistry R3(F3);
static skiagm::GMRegistry R4(F4);
DEF_GM( return SkNEW(ZeroLenStrokesGM); )
DEF_GM( return new ZeroLenStrokesGM; )

View File

@ -98,4 +98,4 @@ private:
typedef skiagm::GM INHERITED;
};
DEF_GM( return SkNEW(StrokeTextGM); )
DEF_GM(return new StrokeTextGM;)

View File

@ -103,5 +103,4 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_GM(return SkNEW(TallStretchedBitmapsGM);)
DEF_GM(return new TallStretchedBitmapsGM;)

View File

@ -186,4 +186,4 @@ private:
typedef skiagm::GM INHERITED;
};
DEF_GM( return SkNEW_ARGS(TextBlobGM, ("hamburgefons")); )
DEF_GM(return new TextBlobGM("hamburgefons");)

View File

@ -97,5 +97,5 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_GM( return SkNEW(TextBlobColorTrans); )
DEF_GM(return new TextBlobColorTrans;)
}

View File

@ -77,5 +77,5 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_GM( return SkNEW(TextBlobGeometryChange); )
DEF_GM(return new TextBlobGeometryChange;)
}

View File

@ -255,5 +255,5 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_GM( return SkNEW(TextBlobLooperGM); )
DEF_GM(return new TextBlobLooperGM;)
}

View File

@ -184,8 +184,8 @@ private:
//////////////////////////////////////////////////////////////////////////////
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
}

Some files were not shown because too many files have changed in this diff Show More