diff options
author | Ben Wagner <bungeman@google.com> | 2016-11-03 14:40:50 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-11-03 19:03:40 +0000 |
commit | 145dbcd165d9d27298eb8888bc240e2d06a95464 (patch) | |
tree | 461ac2a3fe607bdf1d72fd72ae9451a58490a1bc /tools | |
parent | b1c7f88df9ec40b4efb52d314304adfbaf95697c (diff) |
Remove SkAutoTDelete.
Replace with std::unique_ptr.
Change-Id: I5806cfbb30515fcb20e5e66ce13fb5f3b8728176
Reviewed-on: https://skia-review.googlesource.com/4381
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Resources.cpp | 6 | ||||
-rw-r--r-- | tools/debugger/SkDrawCommand.cpp | 10 | ||||
-rw-r--r-- | tools/flags/SkCommonFlagsConfig.h | 2 | ||||
-rw-r--r-- | tools/get_images_from_skps.cpp | 2 | ||||
-rw-r--r-- | tools/gpu/GrContextFactory.cpp | 2 | ||||
-rw-r--r-- | tools/gpu/GrContextFactory.h | 2 | ||||
-rw-r--r-- | tools/gpu/TestContext.h | 8 | ||||
-rw-r--r-- | tools/gpu/gl/GLTestContext.cpp | 28 | ||||
-rw-r--r-- | tools/gpu/gl/GLTestContext.h | 4 | ||||
-rw-r--r-- | tools/gpu/gl/angle/GLTestContext_angle.cpp | 15 | ||||
-rw-r--r-- | tools/gpu/gl/angle/GLTestContext_angle.h | 2 | ||||
-rw-r--r-- | tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp | 14 | ||||
-rw-r--r-- | tools/gpu/vk/VkTestContext.cpp | 4 | ||||
-rw-r--r-- | tools/skdiff/skdiff_utils.cpp | 2 | ||||
-rw-r--r-- | tools/skiaserve/Request.cpp | 4 | ||||
-rw-r--r-- | tools/viewer/ImageSlide.cpp | 2 | ||||
-rw-r--r-- | tools/viewer/Viewer.cpp | 2 | ||||
-rw-r--r-- | tools/visualize_color_gamut.cpp | 2 |
18 files changed, 58 insertions, 53 deletions
diff --git a/tools/Resources.cpp b/tools/Resources.cpp index 9c12a67c20..dcca202e42 100644 --- a/tools/Resources.cpp +++ b/tools/Resources.cpp @@ -28,7 +28,7 @@ void SetResourcePath(const char* resource) { bool GetResourceAsBitmap(const char* resource, SkBitmap* dst) { SkString resourcePath = GetResourcePath(resource); sk_sp<SkData> resourceData(SkData::MakeFromFileName(resourcePath.c_str())); - SkAutoTDelete<SkImageGenerator> gen(SkImageGenerator::NewFromEncoded(resourceData.get())); + std::unique_ptr<SkImageGenerator> gen(SkImageGenerator::NewFromEncoded(resourceData.get())); return gen && gen->tryGenerateBitmap(dst); } @@ -40,7 +40,7 @@ sk_sp<SkImage> GetResourceAsImage(const char* resource) { SkStreamAsset* GetResourceAsStream(const char* resource) { SkString resourcePath = GetResourcePath(resource); - SkAutoTDelete<SkFILEStream> stream(new SkFILEStream(resourcePath.c_str())); + std::unique_ptr<SkFILEStream> stream(new SkFILEStream(resourcePath.c_str())); if (!stream->isValid()) { SkDebugf("Resource %s not found.\n", resource); return nullptr; @@ -49,7 +49,7 @@ SkStreamAsset* GetResourceAsStream(const char* resource) { } sk_sp<SkTypeface> MakeResourceAsTypeface(const char* resource) { - SkAutoTDelete<SkStreamAsset> stream(GetResourceAsStream(resource)); + std::unique_ptr<SkStreamAsset> stream(GetResourceAsStream(resource)); if (!stream) { return nullptr; } diff --git a/tools/debugger/SkDrawCommand.cpp b/tools/debugger/SkDrawCommand.cpp index 4c34b87bbf..3ee5cdb7f4 100644 --- a/tools/debugger/SkDrawCommand.cpp +++ b/tools/debugger/SkDrawCommand.cpp @@ -847,9 +847,9 @@ static SkBitmap* load_bitmap(const Json::Value& jsonBitmap, UrlDataManager& urlD sk_sp<SkData> encoded(SkData::MakeWithoutCopy(data, size)); sk_sp<SkImage> image(SkImage::MakeFromEncoded(std::move(encoded), nullptr)); - SkAutoTDelete<SkBitmap> bitmap(new SkBitmap()); + std::unique_ptr<SkBitmap> bitmap(new SkBitmap()); if (nullptr != image) { - if (!image->asLegacyBitmap(bitmap, SkImage::kRW_LegacyBitmapMode)) { + if (!image->asLegacyBitmap(bitmap.get(), SkImage::kRW_LegacyBitmapMode)) { SkDebugf("image decode failed\n"); return nullptr; } @@ -2791,18 +2791,18 @@ SkDrawTextBlobCommand::SkDrawTextBlobCommand(sk_sp<SkTextBlob> blob, SkScalar x, , fYPos(y) , fPaint(paint) { - SkAutoTDelete<SkString> runsStr(new SkString); + std::unique_ptr<SkString> runsStr(new SkString); fInfo.push(SkObjectParser::ScalarToString(x, "XPOS: ")); fInfo.push(SkObjectParser::ScalarToString(y, "YPOS: ")); fInfo.push(SkObjectParser::RectToString(fBlob->bounds(), "Bounds: ")); - fInfo.push(runsStr); + fInfo.push(runsStr.get()); fInfo.push(SkObjectParser::PaintToString(paint)); unsigned runs = 0; SkPaint runPaint(paint); SkTextBlobRunIterator iter(fBlob.get()); while (!iter.done()) { - SkAutoTDelete<SkString> tmpStr(new SkString); + std::unique_ptr<SkString> tmpStr(new SkString); tmpStr->printf("==== Run [%d] ====", runs++); fInfo.push(tmpStr.release()); diff --git a/tools/flags/SkCommonFlagsConfig.h b/tools/flags/SkCommonFlagsConfig.h index 9abf4cb5df..2b80397a2a 100644 --- a/tools/flags/SkCommonFlagsConfig.h +++ b/tools/flags/SkCommonFlagsConfig.h @@ -75,7 +75,7 @@ class SkCommandLineConfigGpu : public SkCommandLineConfig { }; #endif -typedef SkTArray<SkAutoTDelete<SkCommandLineConfig>, true> SkCommandLineConfigArray; +typedef SkTArray<std::unique_ptr<SkCommandLineConfig>, true> SkCommandLineConfigArray; void ParseConfigs(const SkCommandLineFlags::StringArray& configList, SkCommandLineConfigArray* outResult); diff --git a/tools/get_images_from_skps.cpp b/tools/get_images_from_skps.cpp index e38a245915..b8a893001b 100644 --- a/tools/get_images_from_skps.cpp +++ b/tools/get_images_from_skps.cpp @@ -54,7 +54,7 @@ struct Sniffer : public SkPixelSerializer { gSeen.add(digest); sk_sp<SkData> data(SkData::MakeWithoutCopy(ptr, len)); - SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(data)); + std::unique_ptr<SkCodec> codec(SkCodec::NewFromData(data)); if (!codec) { // FIXME: This code is currently unreachable because we create an empty generator when // we fail to create a codec. diff --git a/tools/gpu/GrContextFactory.cpp b/tools/gpu/GrContextFactory.cpp index 4f189942bd..79489f4590 100644 --- a/tools/gpu/GrContextFactory.cpp +++ b/tools/gpu/GrContextFactory.cpp @@ -101,7 +101,7 @@ ContextInfo GrContextFactory::getContextInfo(ContextType type, ContextOptions op return ContextInfo(context.fBackend, context.fTestContext, context.fGrContext); } } - SkAutoTDelete<TestContext> testCtx; + std::unique_ptr<TestContext> testCtx; sk_sp<GrContext> grCtx; GrBackendContext backendContext = 0; sk_sp<const GrGLInterface> glInterface; diff --git a/tools/gpu/GrContextFactory.h b/tools/gpu/GrContextFactory.h index d6baffc0ea..54b6611e0f 100644 --- a/tools/gpu/GrContextFactory.h +++ b/tools/gpu/GrContextFactory.h @@ -162,7 +162,7 @@ private: bool fAbandoned; }; SkTArray<Context, true> fContexts; - SkAutoTDelete<GLTestContext> fSentinelGLContext; + std::unique_ptr<GLTestContext> fSentinelGLContext; const GrContextOptions fGlobalOptions; }; } // namespace sk_gpu_test diff --git a/tools/gpu/TestContext.h b/tools/gpu/TestContext.h index 8722a337b3..ecb61e3b2a 100644 --- a/tools/gpu/TestContext.h +++ b/tools/gpu/TestContext.h @@ -28,10 +28,10 @@ public: virtual bool isValid() const = 0; bool fenceSyncSupport() const { return fFenceSync != nullptr; } - FenceSync* fenceSync() { SkASSERT(fFenceSync); return fFenceSync; } + FenceSync* fenceSync() { SkASSERT(fFenceSync); return fFenceSync.get(); } bool gpuTimingSupport() const { return fGpuTimer != nullptr; } - GpuTimer* gpuTimer() const { SkASSERT(fGpuTimer); return fGpuTimer; } + GpuTimer* gpuTimer() const { SkASSERT(fGpuTimer); return fGpuTimer.get(); } bool getMaxGpuFrameLag(int *maxFrameLag) const { if (!fFenceSync) { @@ -81,8 +81,8 @@ public: virtual void finish() = 0; protected: - SkAutoTDelete<FenceSync> fFenceSync; - SkAutoTDelete<GpuTimer> fGpuTimer; + std::unique_ptr<FenceSync> fFenceSync; + std::unique_ptr<GpuTimer> fGpuTimer; TestContext(); diff --git a/tools/gpu/gl/GLTestContext.cpp b/tools/gpu/gl/GLTestContext.cpp index 20a9908381..e6d0e40db8 100644 --- a/tools/gpu/gl/GLTestContext.cpp +++ b/tools/gpu/gl/GLTestContext.cpp @@ -14,7 +14,7 @@ namespace { class GLFenceSync : public sk_gpu_test::FenceSync { public: - static GLFenceSync* CreateIfSupported(const sk_gpu_test::GLTestContext*); + static std::unique_ptr<GLFenceSync> MakeIfSupported(const sk_gpu_test::GLTestContext*); sk_gpu_test::PlatformFence SK_WARN_UNUSED_RESULT insertFence() const override; bool waitFence(sk_gpu_test::PlatformFence fence) const override; @@ -43,8 +43,8 @@ private: typedef FenceSync INHERITED; }; -GLFenceSync* GLFenceSync::CreateIfSupported(const sk_gpu_test::GLTestContext* ctx) { - SkAutoTDelete<GLFenceSync> ret; +std::unique_ptr<GLFenceSync> GLFenceSync::MakeIfSupported(const sk_gpu_test::GLTestContext* ctx) { + std::unique_ptr<GLFenceSync> ret; if (kGL_GrGLStandard == ctx->gl()->fStandard) { if (GrGLGetVersion(ctx->gl()) < GR_GL_VER(3,2) && !ctx->gl()->hasExtension("GL_ARB_sync")) { return nullptr; @@ -56,7 +56,10 @@ GLFenceSync* GLFenceSync::CreateIfSupported(const sk_gpu_test::GLTestContext* ct } ret.reset(new GLFenceSync(ctx, "APPLE")); } - return ret->validate() ? ret.release() : nullptr; + if (!ret->validate()) { + ret = nullptr; + } + return ret; } GLFenceSync::GLFenceSync(const sk_gpu_test::GLTestContext* ctx, const char* ext) { @@ -82,7 +85,7 @@ void GLFenceSync::deleteFence(sk_gpu_test::PlatformFence fence) const { class GLGpuTimer : public sk_gpu_test::GpuTimer { public: - static GLGpuTimer* CreateIfSupported(const sk_gpu_test::GLTestContext*); + static std::unique_ptr<GLGpuTimer> MakeIfSupported(const sk_gpu_test::GLTestContext*); QueryStatus checkQueryStatus(sk_gpu_test::PlatformTimerQuery) override; std::chrono::nanoseconds getTimeElapsed(sk_gpu_test::PlatformTimerQuery) override; @@ -121,8 +124,8 @@ private: typedef sk_gpu_test::GpuTimer INHERITED; }; -GLGpuTimer* GLGpuTimer::CreateIfSupported(const sk_gpu_test::GLTestContext* ctx) { - SkAutoTDelete<GLGpuTimer> ret; +std::unique_ptr<GLGpuTimer> GLGpuTimer::MakeIfSupported(const sk_gpu_test::GLTestContext* ctx) { + std::unique_ptr<GLGpuTimer> ret; const GrGLInterface* gl = ctx->gl(); if (gl->fExtensions.has("GL_EXT_disjoint_timer_query")) { ret.reset(new GLGpuTimer(true, ctx, "EXT")); @@ -132,7 +135,10 @@ GLGpuTimer* GLGpuTimer::CreateIfSupported(const sk_gpu_test::GLTestContext* ctx) } else if (gl->fExtensions.has("GL_EXT_timer_query")) { ret.reset(new GLGpuTimer(false, ctx, "EXT")); } - return ret && ret->validate() ? ret.release() : nullptr; + if (ret && !ret->validate()) { + ret = nullptr; + } + return ret; } GLGpuTimer::GLGpuTimer(bool disjointSupport, const sk_gpu_test::GLTestContext* ctx, const char* ext) @@ -219,11 +225,11 @@ GLTestContext::~GLTestContext() { SkASSERT(nullptr == fGL.get()); } -void GLTestContext::init(const GrGLInterface* gl, FenceSync* fenceSync) { +void GLTestContext::init(const GrGLInterface* gl, std::unique_ptr<FenceSync> fenceSync) { SkASSERT(!fGL.get()); fGL.reset(gl); - fFenceSync = fenceSync ? fenceSync : GLFenceSync::CreateIfSupported(this); - fGpuTimer = GLGpuTimer::CreateIfSupported(this); + fFenceSync = fenceSync ? std::move(fenceSync) : GLFenceSync::MakeIfSupported(this); + fGpuTimer = GLGpuTimer::MakeIfSupported(this); } void GLTestContext::teardown() { diff --git a/tools/gpu/gl/GLTestContext.h b/tools/gpu/gl/GLTestContext.h index 0cd9762f8b..a2b04553d3 100644 --- a/tools/gpu/gl/GLTestContext.h +++ b/tools/gpu/gl/GLTestContext.h @@ -57,7 +57,7 @@ public: * Creates a new GL context of the same type and makes the returned context current * (if not null). */ - virtual GLTestContext *createNew() const { return nullptr; } + virtual std::unique_ptr<GLTestContext> makeNew() const { return nullptr; } template<typename Ret, typename... Args> void getGLProcAddress(Ret(GR_GL_FUNCTION_TYPE** out)(Args...), @@ -81,7 +81,7 @@ protected: /* * Methods that sublcasses must call from their constructors and destructors. */ - void init(const GrGLInterface *, FenceSync* = nullptr); + void init(const GrGLInterface *, std::unique_ptr<FenceSync> = nullptr); void teardown() override; diff --git a/tools/gpu/gl/angle/GLTestContext_angle.cpp b/tools/gpu/gl/angle/GLTestContext_angle.cpp index 449e14c8f8..aa55bf3475 100644 --- a/tools/gpu/gl/angle/GLTestContext_angle.cpp +++ b/tools/gpu/gl/angle/GLTestContext_angle.cpp @@ -82,7 +82,7 @@ public: GrEGLImage texture2DToEGLImage(GrGLuint texID) const override; void destroyEGLImage(GrEGLImage) const override; GrGLuint eglImageToExternalTexture(GrEGLImage) const override; - sk_gpu_test::GLTestContext* createNew() const override; + std::unique_ptr<sk_gpu_test::GLTestContext> makeNew() const override; private: void destroyGLContext(); @@ -216,8 +216,9 @@ GrGLuint ANGLEGLContext::eglImageToExternalTexture(GrEGLImage image) const { return texID; } -sk_gpu_test::GLTestContext* ANGLEGLContext::createNew() const { - sk_gpu_test::GLTestContext* ctx = sk_gpu_test::CreateANGLETestContext(fType, fVersion); +std::unique_ptr<sk_gpu_test::GLTestContext> ANGLEGLContext::makeNew() const { + std::unique_ptr<sk_gpu_test::GLTestContext> ctx = + sk_gpu_test::MakeANGLETestContext(fType, fVersion); if (ctx) { ctx->makeCurrent(); } @@ -286,12 +287,10 @@ const GrGLInterface* CreateANGLEGLInterface() { return GrGLAssembleGLESInterface(&gLibs, angle_get_gl_proc); } -GLTestContext* CreateANGLETestContext(ANGLEBackend type, - ANGLEContextVersion version) { - ANGLEGLContext* ctx = new ANGLEGLContext(type, version); +std::unique_ptr<GLTestContext> MakeANGLETestContext(ANGLEBackend type, ANGLEContextVersion version){ + std::unique_ptr<ANGLEGLContext> ctx(new ANGLEGLContext(type, version)); if (!ctx->isValid()) { - delete ctx; - return NULL; + return nullptr; } return ctx; } diff --git a/tools/gpu/gl/angle/GLTestContext_angle.h b/tools/gpu/gl/angle/GLTestContext_angle.h index 0da747f30f..9314710276 100644 --- a/tools/gpu/gl/angle/GLTestContext_angle.h +++ b/tools/gpu/gl/angle/GLTestContext_angle.h @@ -30,7 +30,7 @@ enum class ANGLEContextVersion { }; /** Creates a GLTestContext backed by ANGLE. */ -GLTestContext* CreateANGLETestContext(ANGLEBackend, ANGLEContextVersion); +std::unique_ptr<GLTestContext> MakeANGLETestContext(ANGLEBackend, ANGLEContextVersion); } // namespace sk_gpu_test #endif diff --git a/tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp b/tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp index 06bd70f852..b2517f090e 100644 --- a/tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp +++ b/tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp @@ -22,7 +22,7 @@ namespace { // TODO: Share this class with ANGLE if/when it gets support for EGL_KHR_fence_sync. class EGLFenceSync : public sk_gpu_test::FenceSync { public: - static EGLFenceSync* CreateIfSupported(EGLDisplay); + static std::unique_ptr<EGLFenceSync> MakeIfSupported(EGLDisplay); sk_gpu_test::PlatformFence SK_WARN_UNUSED_RESULT insertFence() const override; bool waitFence(sk_gpu_test::PlatformFence fence) const override; @@ -44,7 +44,7 @@ public: GrEGLImage texture2DToEGLImage(GrGLuint texID) const override; void destroyEGLImage(GrEGLImage) const override; GrGLuint eglImageToExternalTexture(GrEGLImage) const override; - sk_gpu_test::GLTestContext* createNew() const override; + std::unique_ptr<sk_gpu_test::GLTestContext> makeNew() const override; private: void destroyGLContext(); @@ -180,7 +180,7 @@ EGLGLTestContext::EGLGLTestContext(GrGLStandard forcedGpuAPI) continue; } - this->init(gl.release(), EGLFenceSync::CreateIfSupported(fDisplay)); + this->init(gl.release(), EGLFenceSync::MakeIfSupported(fDisplay)); break; } } @@ -255,8 +255,8 @@ GrGLuint EGLGLTestContext::eglImageToExternalTexture(GrEGLImage image) const { return texID; } -sk_gpu_test::GLTestContext* EGLGLTestContext::createNew() const { - sk_gpu_test::GLTestContext* ctx = new EGLGLTestContext(this->gl()->fStandard); +std::unique_ptr<sk_gpu_test::GLTestContext> EGLGLTestContext::makeNew() const { + std::unique_ptr<sk_gpu_test::GLTestContext> ctx(new EGLGLTestContext(this->gl()->fStandard)); if (ctx) { ctx->makeCurrent(); } @@ -294,11 +294,11 @@ static bool supports_egl_extension(EGLDisplay display, const char* extension) { return false; } -EGLFenceSync* EGLFenceSync::CreateIfSupported(EGLDisplay display) { +std::unique_ptr<EGLFenceSync> EGLFenceSync::MakeIfSupported(EGLDisplay display) { if (!display || !supports_egl_extension(display, "EGL_KHR_fence_sync")) { return nullptr; } - return new EGLFenceSync(display); + return std::unique_ptr<EGLFenceSync>(new EGLFenceSync(display)); } sk_gpu_test::PlatformFence EGLFenceSync::insertFence() const { diff --git a/tools/gpu/vk/VkTestContext.cpp b/tools/gpu/vk/VkTestContext.cpp index 92bef7cf46..502dea86d0 100644 --- a/tools/gpu/vk/VkTestContext.cpp +++ b/tools/gpu/vk/VkTestContext.cpp @@ -134,8 +134,8 @@ protected: private: VkTestContextImpl(sk_sp<const GrVkBackendContext> backendContext) : VkTestContext(std::move(backendContext)) { - fFenceSync = new VkFenceSync(sk_ref_sp(fVk->fInterface.get()), fVk->fDevice, fVk->fQueue, - fVk->fGraphicsQueueIndex); + fFenceSync.reset(new VkFenceSync(fVk->fInterface, fVk->fDevice, fVk->fQueue, + fVk->fGraphicsQueueIndex)); } void onPlatformMakeCurrent() const override {} diff --git a/tools/skdiff/skdiff_utils.cpp b/tools/skdiff/skdiff_utils.cpp index 609d75d265..f788ec8cef 100644 --- a/tools/skdiff/skdiff_utils.cpp +++ b/tools/skdiff/skdiff_utils.cpp @@ -34,7 +34,7 @@ sk_sp<SkData> read_file(const char* file_path) { } bool get_bitmap(sk_sp<SkData> fileBits, DiffResource& resource, bool sizeOnly) { - SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(fileBits)); + std::unique_ptr<SkCodec> codec(SkCodec::NewFromData(fileBits)); if (!codec) { SkDebugf("ERROR: could not create codec for <%s>\n", resource.fFullPath.c_str()); resource.fStatus = DiffResource::kCouldNotDecode_Status; diff --git a/tools/skiaserve/Request.cpp b/tools/skiaserve/Request.cpp index 9da9f0f859..134fdf03c2 100644 --- a/tools/skiaserve/Request.cpp +++ b/tools/skiaserve/Request.cpp @@ -55,7 +55,7 @@ SkBitmap* Request::getBitmapFromCanvas(SkCanvas* canvas) { sk_sp<SkData> Request::writeCanvasToPng(SkCanvas* canvas) { // capture pixels - SkAutoTDelete<SkBitmap> bmp(this->getBitmapFromCanvas(canvas)); + std::unique_ptr<SkBitmap> bmp(this->getBitmapFromCanvas(canvas)); SkASSERT(bmp); // Convert to format suitable for PNG output @@ -302,7 +302,7 @@ sk_sp<SkData> Request::getJsonInfo(int n) { SkColor Request::getPixel(int x, int y) { SkCanvas* canvas = this->getCanvas(); canvas->flush(); - SkAutoTDelete<SkBitmap> bitmap(this->getBitmapFromCanvas(canvas)); + std::unique_ptr<SkBitmap> bitmap(this->getBitmapFromCanvas(canvas)); SkASSERT(bitmap); // Convert to format suitable for inspection diff --git a/tools/viewer/ImageSlide.cpp b/tools/viewer/ImageSlide.cpp index e70f618487..0ffd4ea080 100644 --- a/tools/viewer/ImageSlide.cpp +++ b/tools/viewer/ImageSlide.cpp @@ -37,7 +37,7 @@ void ImageSlide::draw(SkCanvas* canvas) { void ImageSlide::load(SkScalar, SkScalar) { sk_sp<SkData> encoded = SkData::MakeFromFileName(fPath.c_str()); - SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded)); + std::unique_ptr<SkCodec> codec(SkCodec::NewFromData(encoded)); if (!codec) { return; } diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp index 739882d7d2..d92b80139d 100644 --- a/tools/viewer/Viewer.cpp +++ b/tools/viewer/Viewer.cpp @@ -252,7 +252,7 @@ void Viewer::initSlides() { const skiagm::GMRegistry* gms(skiagm::GMRegistry::Head()); while (gms) { - SkAutoTDelete<skiagm::GM> gm(gms->factory()(nullptr)); + std::unique_ptr<skiagm::GM> gm(gms->factory()(nullptr)); if (!SkCommandLineFlags::ShouldSkip(FLAGS_match, gm->getName())) { sk_sp<Slide> slide(new GMSlide(gm.release())); diff --git a/tools/visualize_color_gamut.cpp b/tools/visualize_color_gamut.cpp index 9e9ed96314..ee4c2a5ce4 100644 --- a/tools/visualize_color_gamut.cpp +++ b/tools/visualize_color_gamut.cpp @@ -124,7 +124,7 @@ int main(int argc, char** argv) { SkDebugf("Cannot find input image.\n"); return -1; } - SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(data)); + std::unique_ptr<SkCodec> codec(SkCodec::NewFromData(data)); if (!codec) { SkDebugf("Invalid input image.\n"); return -1; |