diff options
author | weili <weili@chromium.org> | 2016-08-09 10:33:10 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-09 10:33:10 -0700 |
commit | 16fccc51456dbab7e392c3952cc367723f9694f6 (patch) | |
tree | 0bd44bec6b81213db9d1dc487237164cdcaa43a4 /xfa/fxgraphics/cfx_path.cpp | |
parent | af7ab33c73f58f18d0db0c90d93fa0aab0bc83f3 (diff) | |
download | pdfium-16fccc51456dbab7e392c3952cc367723f9694f6.tar.xz |
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
Diffstat (limited to 'xfa/fxgraphics/cfx_path.cpp')
-rw-r--r-- | xfa/fxgraphics/cfx_path.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/xfa/fxgraphics/cfx_path.cpp b/xfa/fxgraphics/cfx_path.cpp index 892a339469..5adeded977 100644 --- a/xfa/fxgraphics/cfx_path.cpp +++ b/xfa/fxgraphics/cfx_path.cpp @@ -9,22 +9,17 @@ #include "core/fxge/include/cfx_pathdata.h" #include "xfa/fxgraphics/cfx_path_generator.h" -CFX_Path::CFX_Path() { - m_generator = nullptr; -} +CFX_Path::CFX_Path() {} FWL_Error CFX_Path::Create() { if (m_generator) return FWL_Error::PropertyInvalid; - m_generator = new CFX_PathGenerator; - m_generator->Create(); + m_generator.reset(new CFX_PathGenerator()); return FWL_Error::Succeeded; } -CFX_Path::~CFX_Path() { - delete m_generator; -} +CFX_Path::~CFX_Path() {} FWL_Error CFX_Path::MoveTo(FX_FLOAT x, FX_FLOAT y) { if (!m_generator) @@ -167,7 +162,7 @@ FWL_Error CFX_Path::Clear() { return FWL_Error::Succeeded; } -FX_BOOL CFX_Path::IsEmpty() { +FX_BOOL CFX_Path::IsEmpty() const { if (!m_generator) return FALSE; if (m_generator->GetPathData()->GetPointCount() == 0) @@ -175,7 +170,7 @@ FX_BOOL CFX_Path::IsEmpty() { return FALSE; } -CFX_PathData* CFX_Path::GetPathData() { +CFX_PathData* CFX_Path::GetPathData() const { if (!m_generator) return nullptr; return m_generator->GetPathData(); |