From 7ecc59610de72043e9b7ebaf1ef45c43425e54fc Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Wed, 2 Nov 2016 17:07:33 -0400 Subject: [PATCH] Remove SkAutoTDeleteArray This class is already just an alias for std::unique_ptr, so replace all uses with that and delete the class. CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-ASAN-Trybot,Test-Ubuntu-Clang-Golo-GPU-GT610-x86_64-Debug-ASAN-Trybot Change-Id: I40668d398356a22da071ee791666c7f728b59266 Reviewed-on: https://skia-review.googlesource.com/4362 Reviewed-by: Mike Reed Reviewed-by: Mike Klein --- bench/ImageCacheBudgetBench.cpp | 2 +- gm/convex_all_line_paths.cpp | 2 +- gm/imagetoyuvplanes.cpp | 6 +++--- include/private/SkTemplates.h | 5 ----- src/codec/SkBmpCodec.cpp | 8 ++++---- src/codec/SkBmpMaskCodec.h | 2 +- src/codec/SkBmpRLECodec.cpp | 2 +- src/codec/SkBmpRLECodec.h | 2 +- src/codec/SkBmpStandardCodec.cpp | 2 +- src/codec/SkBmpStandardCodec.h | 2 +- src/codec/SkIcoCodec.cpp | 6 +++--- src/effects/GrCircleBlurFragmentProcessor.cpp | 2 +- src/effects/SkBlurMask.cpp | 2 +- src/effects/SkBlurMaskFilter.cpp | 2 +- src/effects/SkMergeImageFilter.cpp | 4 ++-- src/gpu/GrTessellator.cpp | 2 +- src/gpu/GrTestUtils.cpp | 2 +- src/gpu/SkGpuDevice.cpp | 2 +- src/gpu/SkGr.cpp | 2 +- src/gpu/effects/GrMatrixConvolutionEffect.cpp | 2 +- src/gpu/gl/GrGLGpu.cpp | 2 +- src/gpu/vk/GrVkDescriptorSetManager.cpp | 2 +- src/image/SkImage_Gpu.cpp | 2 +- src/ports/SkFontHost_win.cpp | 2 +- src/sfnt/SkOTUtils.cpp | 2 +- src/sfnt/SkOTUtils.h | 2 +- src/views/mac/SkOptionsTableView.mm | 2 +- tests/ClearTest.cpp | 2 +- tests/ImageTest.cpp | 2 +- tests/PathOpsSkpClipTest.cpp | 6 +++--- tests/ReadWriteAlphaTest.cpp | 4 ++-- tests/SurfaceTest.cpp | 8 ++++---- tests/SwizzlerTest.cpp | 2 +- tools/sk_tool_utils.cpp | 2 +- 34 files changed, 47 insertions(+), 52 deletions(-) diff --git a/bench/ImageCacheBudgetBench.cpp b/bench/ImageCacheBudgetBench.cpp index 11b4c50968..12e579060e 100644 --- a/bench/ImageCacheBudgetBench.cpp +++ b/bench/ImageCacheBudgetBench.cpp @@ -145,7 +145,7 @@ private: bool fShuffle; SkString fName; sk_sp fImages[kImagesToDraw]; - SkAutoTDeleteArray fIndices; + std::unique_ptr fIndices; size_t fOldBytes; int fOldCount; diff --git a/gm/convex_all_line_paths.cpp b/gm/convex_all_line_paths.cpp index aba1ef27ce..62e8835831 100644 --- a/gm/convex_all_line_paths.cpp +++ b/gm/convex_all_line_paths.cpp @@ -170,7 +170,7 @@ protected: }; static_assert(SK_ARRAY_COUNT(gSizes) == SK_ARRAY_COUNT(gPoints), "array_mismatch"); - SkAutoTDeleteArray data(nullptr); + std::unique_ptr data(nullptr); const SkPoint* points; int numPts; if (index < (int) SK_ARRAY_COUNT(gPoints)) { diff --git a/gm/imagetoyuvplanes.cpp b/gm/imagetoyuvplanes.cpp index d08257295a..2ba26967b1 100644 --- a/gm/imagetoyuvplanes.cpp +++ b/gm/imagetoyuvplanes.cpp @@ -72,9 +72,9 @@ DEF_SIMPLE_GM(image_to_yuv_planes, canvas, 120, 525) { for (int i = 0; i < 3; ++i) { realRowBytes[i] = kRowBytes[s][i] ? kRowBytes[s][i] : kSizes[s][i].fWidth; } - SkAutoTDeleteArray yPlane(new uint8_t[realRowBytes[0] * sizes[0].fHeight]); - SkAutoTDeleteArray uPlane(new uint8_t[realRowBytes[1] * sizes[1].fHeight]); - SkAutoTDeleteArray vPlane(new uint8_t[realRowBytes[2] * sizes[2].fHeight]); + std::unique_ptr yPlane(new uint8_t[realRowBytes[0] * sizes[0].fHeight]); + std::unique_ptr uPlane(new uint8_t[realRowBytes[1] * sizes[1].fHeight]); + std::unique_ptr vPlane(new uint8_t[realRowBytes[2] * sizes[2].fHeight]); void *planes[3] = {yPlane.get(), uPlane.get(), vPlane.get()}; diff --git a/include/private/SkTemplates.h b/include/private/SkTemplates.h index 01a8ec0c3b..4c72897a02 100644 --- a/include/private/SkTemplates.h +++ b/include/private/SkTemplates.h @@ -103,11 +103,6 @@ public: #endif }; -template class SkAutoTDeleteArray : public std::unique_ptr { -public: - SkAutoTDeleteArray(T array[]) : std::unique_ptr(array) {} -}; - /** Allocate an array of T elements, and free the array in the destructor */ template class SkAutoTArray : SkNoncopyable { diff --git a/src/codec/SkBmpCodec.cpp b/src/codec/SkBmpCodec.cpp index 18e2be4009..b0ef8ad1d8 100644 --- a/src/codec/SkBmpCodec.cpp +++ b/src/codec/SkBmpCodec.cpp @@ -111,7 +111,7 @@ bool SkBmpCodec::ReadHeader(SkStream* stream, bool inIco, SkCodec** codecOut) { // Bmps embedded in Icos skip the first Bmp header if (!inIco) { // Read the first header and the size of the second header - SkAutoTDeleteArray hBuffer(new uint8_t[kBmpHeaderBytesPlusFour]); + std::unique_ptr hBuffer(new uint8_t[kBmpHeaderBytesPlusFour]); if (stream->read(hBuffer.get(), kBmpHeaderBytesPlusFour) != kBmpHeaderBytesPlusFour) { SkCodecPrintf("Error: unable to read first bitmap header.\n"); @@ -145,7 +145,7 @@ bool SkBmpCodec::ReadHeader(SkStream* stream, bool inIco, SkCodec** codecOut) { offset = 0; // Read the size of the second header - SkAutoTDeleteArray hBuffer(new uint8_t[4]); + std::unique_ptr 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; @@ -161,7 +161,7 @@ bool SkBmpCodec::ReadHeader(SkStream* stream, bool inIco, SkCodec** codecOut) { const uint32_t infoBytesRemaining = infoBytes - 4; // Read the second header - SkAutoTDeleteArray iBuffer(new uint8_t[infoBytesRemaining]); + std::unique_ptr iBuffer(new uint8_t[infoBytesRemaining]); if (stream->read(iBuffer.get(), infoBytesRemaining) != infoBytesRemaining) { SkCodecPrintf("Error: unable to read second bitmap header.\n"); return false; @@ -320,7 +320,7 @@ bool SkBmpCodec::ReadHeader(SkStream* stream, bool inIco, SkCodec** codecOut) { switch (headerType) { case kInfoV1_BmpHeaderType: { // The V1 header stores the bit masks after the header - SkAutoTDeleteArray mBuffer(new uint8_t[kBmpMaskBytes]); + std::unique_ptr mBuffer(new uint8_t[kBmpMaskBytes]); if (stream->read(mBuffer.get(), kBmpMaskBytes) != kBmpMaskBytes) { SkCodecPrintf("Error: unable to read bit inputMasks.\n"); diff --git a/src/codec/SkBmpMaskCodec.h b/src/codec/SkBmpMaskCodec.h index cc8af856e8..4cfd4d2531 100644 --- a/src/codec/SkBmpMaskCodec.h +++ b/src/codec/SkBmpMaskCodec.h @@ -54,7 +54,7 @@ private: SkAutoTDelete fMasks; // owned SkAutoTDelete fMaskSwizzler; - SkAutoTDeleteArray fSrcBuffer; + std::unique_ptr fSrcBuffer; typedef SkBmpCodec INHERITED; }; diff --git a/src/codec/SkBmpRLECodec.cpp b/src/codec/SkBmpRLECodec.cpp index dc5d689235..33ba851ec6 100644 --- a/src/codec/SkBmpRLECodec.cpp +++ b/src/codec/SkBmpRLECodec.cpp @@ -89,7 +89,7 @@ SkCodec::Result SkBmpRLECodec::onGetPixels(const SkImageInfo& dstInfo, // Read the color table from the stream colorBytes = numColorsToRead * fBytesPerColor; - SkAutoTDeleteArray cBuffer(new uint8_t[colorBytes]); + std::unique_ptr cBuffer(new uint8_t[colorBytes]); if (stream()->read(cBuffer.get(), colorBytes) != colorBytes) { SkCodecPrintf("Error: unable to read color table.\n"); return false; diff --git a/src/codec/SkBmpRLECodec.h b/src/codec/SkBmpRLECodec.h index c5236a8100..1291e9f617 100644 --- a/src/codec/SkBmpRLECodec.h +++ b/src/codec/SkBmpRLECodec.h @@ -99,7 +99,7 @@ private: const uint32_t fNumColors; const uint32_t fBytesPerColor; const uint32_t fOffset; - SkAutoTDeleteArray fStreamBuffer; + std::unique_ptr fStreamBuffer; size_t fRLEBytes; const size_t fOrigRLEBytes; uint32_t fCurrRLEByte; diff --git a/src/codec/SkBmpStandardCodec.cpp b/src/codec/SkBmpStandardCodec.cpp index 7d67d18c8f..2dbb338a07 100644 --- a/src/codec/SkBmpStandardCodec.cpp +++ b/src/codec/SkBmpStandardCodec.cpp @@ -88,7 +88,7 @@ SkCodec::Result SkBmpStandardCodec::onGetPixels(const SkImageInfo& dstInfo, // Read the color table from the stream colorBytes = numColorsToRead * fBytesPerColor; - SkAutoTDeleteArray cBuffer(new uint8_t[colorBytes]); + std::unique_ptr cBuffer(new uint8_t[colorBytes]); if (stream()->read(cBuffer.get(), colorBytes) != colorBytes) { SkCodecPrintf("Error: unable to read color table.\n"); return false; diff --git a/src/codec/SkBmpStandardCodec.h b/src/codec/SkBmpStandardCodec.h index 7039cf7efe..edb88acd0c 100644 --- a/src/codec/SkBmpStandardCodec.h +++ b/src/codec/SkBmpStandardCodec.h @@ -90,7 +90,7 @@ private: const uint32_t fBytesPerColor; const uint32_t fOffset; SkAutoTDelete fSwizzler; - SkAutoTDeleteArray fSrcBuffer; + std::unique_ptr fSrcBuffer; const bool fIsOpaque; const bool fInIco; const size_t fAndMaskRowBytes; // only used for fInIco decodes diff --git a/src/codec/SkIcoCodec.cpp b/src/codec/SkIcoCodec.cpp index bfbe91311a..e4fce4c8ec 100644 --- a/src/codec/SkIcoCodec.cpp +++ b/src/codec/SkIcoCodec.cpp @@ -40,7 +40,7 @@ SkCodec* SkIcoCodec::NewFromStream(SkStream* stream) { static const uint32_t kIcoDirEntryBytes = 16; // Read the directory header - SkAutoTDeleteArray dirBuffer(new uint8_t[kIcoDirectoryBytes]); + std::unique_ptr dirBuffer(new uint8_t[kIcoDirectoryBytes]); if (inputStream.get()->read(dirBuffer.get(), kIcoDirectoryBytes) != kIcoDirectoryBytes) { SkCodecPrintf("Error: unable to read ico directory header.\n"); @@ -55,7 +55,7 @@ SkCodec* SkIcoCodec::NewFromStream(SkStream* stream) { } // Ensure that we can read all of indicated directory entries - SkAutoTDeleteArray entryBuffer(new uint8_t[numImages * kIcoDirEntryBytes]); + std::unique_ptr 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"); @@ -69,7 +69,7 @@ SkCodec* SkIcoCodec::NewFromStream(SkStream* stream) { uint32_t offset; uint32_t size; }; - SkAutoTDeleteArray directoryEntries(new Entry[numImages]); + std::unique_ptr directoryEntries(new Entry[numImages]); // Iterate over directory entries for (uint32_t i = 0; i < numImages; i++) { diff --git a/src/effects/GrCircleBlurFragmentProcessor.cpp b/src/effects/GrCircleBlurFragmentProcessor.cpp index 3e80ef517c..eaa8ba9ac1 100644 --- a/src/effects/GrCircleBlurFragmentProcessor.cpp +++ b/src/effects/GrCircleBlurFragmentProcessor.cpp @@ -310,7 +310,7 @@ static GrTexture* create_profile_texture(GrTextureProvider* textureProvider, con texDesc.fHeight = 1; texDesc.fConfig = kAlpha_8_GrPixelConfig; - SkAutoTDeleteArray profile(nullptr); + std::unique_ptr profile(nullptr); if (useHalfPlaneApprox) { profile.reset(create_half_plane_profile(kProfileTextureWidth)); } else { diff --git a/src/effects/SkBlurMask.cpp b/src/effects/SkBlurMask.cpp index d22881aa9e..ce3c504759 100644 --- a/src/effects/SkBlurMask.cpp +++ b/src/effects/SkBlurMask.cpp @@ -769,7 +769,7 @@ bool SkBlurMask::BlurRect(SkScalar sigma, SkMask *dst, return true; } - SkAutoTDeleteArray profile(ComputeBlurProfile(sigma)); + std::unique_ptr profile(ComputeBlurProfile(sigma)); size_t dstSize = dst->computeImageSize(); if (0 == dstSize) { diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp index e7f660148a..dcacf82afc 100644 --- a/src/effects/SkBlurMaskFilter.cpp +++ b/src/effects/SkBlurMaskFilter.cpp @@ -959,7 +959,7 @@ GrTexture* GrRectBlurEffect::CreateBlurProfileTexture(GrTextureProvider* texture GrTexture *blurProfile = textureProvider->findAndRefTextureByUniqueKey(key); if (!blurProfile) { - SkAutoTDeleteArray profile(SkBlurMask::ComputeBlurProfile(sigma)); + std::unique_ptr profile(SkBlurMask::ComputeBlurProfile(sigma)); blurProfile = textureProvider->createTexture(texDesc, SkBudgeted::kYes, profile.get(), 0); if (blurProfile) { diff --git a/src/effects/SkMergeImageFilter.cpp b/src/effects/SkMergeImageFilter.cpp index 9043620b4c..c2c18acef7 100644 --- a/src/effects/SkMergeImageFilter.cpp +++ b/src/effects/SkMergeImageFilter.cpp @@ -82,8 +82,8 @@ sk_sp SkMergeImageFilter::onFilterImage(SkSpecialImage* source, SkIRect bounds; bounds.setEmpty(); - SkAutoTDeleteArray> inputs(new sk_sp[inputCount]); - SkAutoTDeleteArray offsets(new SkIPoint[inputCount]); + std::unique_ptr[]> inputs(new sk_sp[inputCount]); + std::unique_ptr offsets(new SkIPoint[inputCount]); // Filter all of the inputs. for (int i = 0; i < inputCount; ++i) { diff --git a/src/gpu/GrTessellator.cpp b/src/gpu/GrTessellator.cpp index 7d8db23811..e75e1bbd9f 100644 --- a/src/gpu/GrTessellator.cpp +++ b/src/gpu/GrTessellator.cpp @@ -1699,7 +1699,7 @@ Poly* path_to_polys(const SkPath& path, SkScalar tolerance, const SkRect& clipBo if (SkPath::IsInverseFillType(fillType)) { contourCnt++; } - SkAutoTDeleteArray contours(new Vertex* [contourCnt]); + std::unique_ptr contours(new Vertex* [contourCnt]); path_to_contours(path, tolerance, clipBounds, contours.get(), alloc, isLinear); return contours_to_polys(contours.get(), contourCnt, path.getFillType(), path.getBounds(), diff --git a/src/gpu/GrTestUtils.cpp b/src/gpu/GrTestUtils.cpp index 20f92f0bb3..704b1281f1 100644 --- a/src/gpu/GrTestUtils.cpp +++ b/src/gpu/GrTestUtils.cpp @@ -253,7 +253,7 @@ void TestStyle(SkRandom* random, GrStyle* style) { sk_sp pe; if (random->nextBool()) { int cnt = random->nextRangeU(1, 50) * 2; - SkAutoTDeleteArray intervals(new SkScalar[cnt]); + std::unique_ptr intervals(new SkScalar[cnt]); SkScalar sum = 0; for (int i = 0; i < cnt; i++) { intervals[i] = random->nextRangeScalar(SkDoubleToScalar(0.01), diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index b49687f2cc..a65d6e8d89 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -1605,7 +1605,7 @@ void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode, //number of indices for lines per triangle with kLines indexCount = triangleCount * 6; - SkAutoTDeleteArray lineIndices(new uint16_t[indexCount]); + std::unique_ptr lineIndices(new uint16_t[indexCount]); int i = 0; while (vertProc(&state)) { lineIndices[i] = state.f0; diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index 270be46f4e..d0a35b52a2 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -391,7 +391,7 @@ GrTexture* GrGenerateMipMapsAndUploadToTexture(GrContext* ctx, const SkBitmap& b const bool isMipMapped = mipLevelCount > 1; desc.fIsMipMapped = isMipMapped; - SkAutoTDeleteArray texels(new GrMipLevel[mipLevelCount]); + std::unique_ptr texels(new GrMipLevel[mipLevelCount]); texels[0].fPixels = pixmap.addr(); texels[0].fRowBytes = pixmap.rowBytes(); diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp index a07b67128b..56174973e1 100644 --- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp +++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp @@ -241,7 +241,7 @@ sk_sp GrMatrixConvolutionEffect::TestCreate(GrProcessorTest int width = d->fRandom->nextRangeU(1, MAX_KERNEL_SIZE); int height = d->fRandom->nextRangeU(1, MAX_KERNEL_SIZE / width); SkISize kernelSize = SkISize::Make(width, height); - SkAutoTDeleteArray kernel(new SkScalar[width * height]); + std::unique_ptr kernel(new SkScalar[width * height]); for (int i = 0; i < width * height; i++) { kernel.get()[i] = d->fRandom->nextSScalar1(); } diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 6d50ee29c4..e1ea96540e 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -2484,7 +2484,7 @@ bool GrGLGpu::onReadPixels(GrSurface* surface, } if (kAlpha_8_GrPixelConfig == config && this->readPixelsSupported(renderTarget, tempConfig)) { - SkAutoTDeleteArray temp(new uint32_t[width * height * 4]); + std::unique_ptr temp(new uint32_t[width * height * 4]); if (this->onReadPixels(renderTarget, left, top, width, height, tempConfig, temp.get(), width*4)) { uint8_t* dst = reinterpret_cast(buffer); diff --git a/src/gpu/vk/GrVkDescriptorSetManager.cpp b/src/gpu/vk/GrVkDescriptorSetManager.cpp index 868a5ce96c..d05a11c49f 100644 --- a/src/gpu/vk/GrVkDescriptorSetManager.cpp +++ b/src/gpu/vk/GrVkDescriptorSetManager.cpp @@ -180,7 +180,7 @@ void GrVkDescriptorSetManager::DescriptorPoolManager::init(GrVkGpu* gpu, numSamplers = (uint32_t)visibilities->count(); } - SkAutoTDeleteArray dsSamplerBindings( + std::unique_ptr dsSamplerBindings( new VkDescriptorSetLayoutBinding[numSamplers]); for (uint32_t i = 0; i < numSamplers; ++i) { uint32_t visibility; diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index d7bdc9c958..d80b187eaa 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -682,7 +682,7 @@ sk_sp SkImage::MakeFromDeferredTextureImageData(GrContext* context, con dti->fMipMapLevelData[0].fRowBytes, colorTable.get()); return SkImage::MakeTextureFromPixmap(context, pixmap, budgeted); } else { - SkAutoTDeleteArray texels(new GrMipLevel[mipLevelCount]); + std::unique_ptr texels(new GrMipLevel[mipLevelCount]); for (int i = 0; i < mipLevelCount; i++) { texels[i].fPixels = dti->fMipMapLevelData[i].fPixelData; texels[i].fRowBytes = dti->fMipMapLevelData[i].fRowBytes; diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp index 380b502a30..19eff6f8f9 100644 --- a/src/ports/SkFontHost_win.cpp +++ b/src/ports/SkFontHost_win.cpp @@ -363,7 +363,7 @@ static void populate_glyph_to_unicode(HDC fontHdc, const unsigned glyphCount, return; } - SkAutoTDeleteArray glyphSetBuffer(new BYTE[glyphSetBufferSize]); + std::unique_ptr glyphSetBuffer(new BYTE[glyphSetBufferSize]); GLYPHSET* glyphSet = reinterpret_cast(glyphSetBuffer.get()); if (GetFontUnicodeRanges(fontHdc, glyphSet) != glyphSetBufferSize) { diff --git a/src/sfnt/SkOTUtils.cpp b/src/sfnt/SkOTUtils.cpp index cb533ff3f2..4d8c023ea4 100644 --- a/src/sfnt/SkOTUtils.cpp +++ b/src/sfnt/SkOTUtils.cpp @@ -168,7 +168,7 @@ SkOTUtils::LocalizedStrings_NameTable::CreateForFamilyNames(const SkTypeface& ty if (0 == nameTableSize) { return nullptr; } - SkAutoTDeleteArray nameTableData(new uint8_t[nameTableSize]); + std::unique_ptr nameTableData(new uint8_t[nameTableSize]); size_t copied = typeface.getTableData(nameTag, 0, nameTableSize, nameTableData.get()); if (copied != nameTableSize) { return nullptr; diff --git a/src/sfnt/SkOTUtils.h b/src/sfnt/SkOTUtils.h index 1773e69ab6..4708a7bb78 100644 --- a/src/sfnt/SkOTUtils.h +++ b/src/sfnt/SkOTUtils.h @@ -61,7 +61,7 @@ struct SkOTUtils { SkOTTableName::Record::NameID::Predefined::Value* fTypes; int fTypesCount; int fTypesIndex; - SkAutoTDeleteArray fNameTableData; + std::unique_ptr fNameTableData; SkOTTableName::Iterator fFamilyNameIter; }; diff --git a/src/views/mac/SkOptionsTableView.mm b/src/views/mac/SkOptionsTableView.mm index b4cdbf4119..51d4864833 100644 --- a/src/views/mac/SkOptionsTableView.mm +++ b/src/views/mac/SkOptionsTableView.mm @@ -96,7 +96,7 @@ int index = 0, count = 0; SkOSMenu::FindListItemCount(*item->getEvent(), &count); NSMutableArray* optionstrs = [[NSMutableArray alloc] initWithCapacity:count]; - SkAutoTDeleteArray ada(new SkString[count]); + std::unique_ptr ada(new SkString[count]); SkString* options = ada.get(); SkOSMenu::FindListItems(*item->getEvent(), options); for (int i = 0; i < count; ++i) diff --git a/tests/ClearTest.cpp b/tests/ClearTest.cpp index 4a6e26c86a..d83fb92b53 100644 --- a/tests/ClearTest.cpp +++ b/tests/ClearTest.cpp @@ -20,7 +20,7 @@ static bool check_rect(GrRenderTargetContext* rtc, const SkIRect& rect, uint32_t GrRenderTarget* rt = rtc->accessRenderTarget(); int w = rect.width(); int h = rect.height(); - SkAutoTDeleteArray pixels(new uint32_t[w * h]); + std::unique_ptr pixels(new uint32_t[w * h]); memset(pixels.get(), ~expectedValue, sizeof(uint32_t) * w * h); rt->readPixels(rect.fLeft, rect.fTop, w, h, kRGBA_8888_GrPixelConfig, pixels.get()); for (int y = 0; y < h; ++y) { diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp index a0ce16fcab..58576251fe 100644 --- a/tests/ImageTest.cpp +++ b/tests/ImageTest.cpp @@ -799,7 +799,7 @@ struct TextureReleaseChecker { DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkImage_NewFromTextureRelease, reporter, ctxInfo) { const int kWidth = 10; const int kHeight = 10; - SkAutoTDeleteArray pixels(new uint32_t[kWidth * kHeight]); + std::unique_ptr pixels(new uint32_t[kWidth * kHeight]); GrBackendTextureDesc backendDesc; backendDesc.fConfig = kRGBA_8888_GrPixelConfig; backendDesc.fFlags = kRenderTarget_GrBackendTextureFlag; diff --git a/tests/PathOpsSkpClipTest.cpp b/tests/PathOpsSkpClipTest.cpp index 3c958f1bec..e16be4c8f3 100644 --- a/tests/PathOpsSkpClipTest.cpp +++ b/tests/PathOpsSkpClipTest.cpp @@ -882,8 +882,8 @@ DEF_TEST(PathOpsSkpClipUberThreaded) { const int firstDirNo = gDirs.next(); const int lastDirNo = gDirs.last(); int dirCount = lastDirNo - firstDirNo + 1; - SkAutoTDeleteArray > tests(new SkTDArray[dirCount]); - SkAutoTDeleteArray > sorted(new SkTDArray[dirCount]); + std::unique_ptr[]> tests(new SkTDArray[dirCount]); + std::unique_ptr[]> sorted(new SkTDArray[dirCount]); if (!buildTests(tests.get(), sorted.get())) { return; } @@ -921,7 +921,7 @@ DEF_TEST(PathOpsSkpClipUberThreaded) { } testRunner.render(); - SkAutoTDeleteArray > results(new SkTDArray[dirCount]); + std::unique_ptr[]> results(new SkTDArray[dirCount]); if (!buildTests(results.get(), nullptr)) { return; } diff --git a/tests/ReadWriteAlphaTest.cpp b/tests/ReadWriteAlphaTest.cpp index e5240666aa..228277a7fb 100644 --- a/tests/ReadWriteAlphaTest.cpp +++ b/tests/ReadWriteAlphaTest.cpp @@ -76,7 +76,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) { REPORTER_ASSERT_MESSAGE(reporter, result, "Initial A8 writePixels failed"); size_t nonZeroRowBytes = rowBytes ? rowBytes : X_SIZE; - SkAutoTDeleteArray readback(new uint8_t[nonZeroRowBytes * Y_SIZE]); + std::unique_ptr readback(new uint8_t[nonZeroRowBytes * Y_SIZE]); // clear readback to something non-zero so we can detect readback failures memset(readback.get(), kClearValue, nonZeroRowBytes * Y_SIZE); @@ -166,7 +166,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) { for (auto rowBytes : kRowBytes) { size_t nonZeroRowBytes = rowBytes ? rowBytes : X_SIZE; - SkAutoTDeleteArray readback(new uint8_t[nonZeroRowBytes * Y_SIZE]); + std::unique_ptr readback(new uint8_t[nonZeroRowBytes * Y_SIZE]); // Clear so we don't accidentally see values from previous iteration. memset(readback.get(), kClearValue, nonZeroRowBytes * Y_SIZE); diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp index 908dc169de..9866358dff 100644 --- a/tests/SurfaceTest.cpp +++ b/tests/SurfaceTest.cpp @@ -709,7 +709,7 @@ static sk_sp create_gpu_surface_backend_texture( GrContext* context, int sampleCnt, uint32_t color, GrBackendObject* outTexture) { const int kWidth = 10; const int kHeight = 10; - SkAutoTDeleteArray pixels(new uint32_t[kWidth * kHeight]); + std::unique_ptr pixels(new uint32_t[kWidth * kHeight]); sk_memset32(pixels.get(), color, kWidth * kHeight); GrBackendTextureDesc desc; desc.fConfig = kRGBA_8888_GrPixelConfig; @@ -732,7 +732,7 @@ static sk_sp create_gpu_surface_backend_texture_as_render_target( GrContext* context, int sampleCnt, uint32_t color, GrBackendObject* outTexture) { const int kWidth = 10; const int kHeight = 10; - SkAutoTDeleteArray pixels(new uint32_t[kWidth * kHeight]); + std::unique_ptr pixels(new uint32_t[kWidth * kHeight]); sk_memset32(pixels.get(), color, kWidth * kHeight); GrBackendTextureDesc desc; desc.fConfig = kRGBA_8888_GrPixelConfig; @@ -761,7 +761,7 @@ static void test_surface_clear(skiatest::Reporter* reporter, sk_sp su } int w = surface->width(); int h = surface->height(); - SkAutoTDeleteArray pixels(new uint32_t[w * h]); + std::unique_ptr pixels(new uint32_t[w * h]); sk_memset32(pixels.get(), ~expectedValue, w * h); SkAutoTUnref grSurface(SkSafeRef(grSurfaceGetter(surface.get()))); @@ -830,7 +830,7 @@ static void test_surface_draw_partially( paint.setColor(kRectColor); surface->getCanvas()->drawRect(SkRect::MakeWH(SkIntToScalar(kW), SkIntToScalar(kH)/2), paint); - SkAutoTDeleteArray pixels(new uint32_t[kW * kH]); + std::unique_ptr pixels(new uint32_t[kW * kH]); sk_memset32(pixels.get(), ~origColor, kW * kH); // Read back RGBA to avoid format conversions that may not be supported on all platforms. SkImageInfo readInfo = SkImageInfo::Make(kW, kH, kRGBA_8888_SkColorType, kPremul_SkAlphaType); diff --git a/tests/SwizzlerTest.cpp b/tests/SwizzlerTest.cpp index 1b34669f97..4626a47662 100644 --- a/tests/SwizzlerTest.cpp +++ b/tests/SwizzlerTest.cpp @@ -32,7 +32,7 @@ static void check_fill(skiatest::Reporter* r, const size_t totalBytes = imageInfo.getSafeSize(rowBytes) + offset; // Create fake image data where every byte has a value of 0 - SkAutoTDeleteArray storage(new uint8_t[totalBytes]); + std::unique_ptr 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/tools/sk_tool_utils.cpp b/tools/sk_tool_utils.cpp index 49afd543b8..fcc8d4c725 100644 --- a/tools/sk_tool_utils.cpp +++ b/tools/sk_tool_utils.cpp @@ -457,7 +457,7 @@ SkBitmap slow_blur(const SkBitmap& src, float sigma) { dst.allocN32Pixels(src.width(), src.height(), true); int wh; - SkAutoTDeleteArray kernel(create_2d_kernel(sigma, &wh)); + std::unique_ptr kernel(create_2d_kernel(sigma, &wh)); for (int y = 0; y < src.height(); ++y) { for (int x = 0; x < src.width(); ++x) {