From 16fccc51456dbab7e392c3952cc367723f9694f6 Mon Sep 17 00:00:00 2001 From: weili Date: Tue, 9 Aug 2016 10:33:10 -0700 Subject: Use smart pointers for class owned pointers For classes under xfa/fxfa/fm2js, and xfa/fxgraphics, use smart pointers instead of raw pointer to make memory management easier. Also fix some styling issues along the changes. BUG=pdfium:518 Review-Url: https://codereview.chromium.org/2222203002 --- xfa/fxgraphics/cfx_graphics.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'xfa/fxgraphics/cfx_graphics.cpp') diff --git a/xfa/fxgraphics/cfx_graphics.cpp b/xfa/fxgraphics/cfx_graphics.cpp index 90225d4e19..0e18d65e2d 100644 --- a/xfa/fxgraphics/cfx_graphics.cpp +++ b/xfa/fxgraphics/cfx_graphics.cpp @@ -567,9 +567,7 @@ const FX_HATCHDATA hatchBitmapData[FX_HATCHSTYLE_Total] = { } // namespace CFX_Graphics::CFX_Graphics() - : m_type(FX_CONTEXT_None), - m_renderDevice(nullptr), - m_aggGraphics(nullptr) {} + : m_type(FX_CONTEXT_None), m_renderDevice(nullptr) {} FWL_Error CFX_Graphics::Create(CFX_RenderDevice* renderDevice, FX_BOOL isAntialiasing) { @@ -596,13 +594,11 @@ FWL_Error CFX_Graphics::Create(int32_t width, m_type = FX_CONTEXT_Device; m_info.isAntialiasing = isAntialiasing; - m_aggGraphics = new CAGG_Graphics; + m_aggGraphics.reset(new CAGG_Graphics); return m_aggGraphics->Create(this, width, height, format); } -CFX_Graphics::~CFX_Graphics() { - delete m_aggGraphics; -} +CFX_Graphics::~CFX_Graphics() {} FWL_Error CFX_Graphics::GetDeviceCap(const int32_t capID, FX_DeviceCap& capVal) { -- cgit v1.2.3