From cddf8253692d3beaa97a502c8b60c1d18f81664a Mon Sep 17 00:00:00 2001 From: weili Date: Thu, 4 Aug 2016 15:43:59 -0700 Subject: Use smart pointers for class owned pointers under xfa/fde Use smart pointer to replace raw pointer type for class owned member variables so that memory management will be easier. BUG=pdfium:518 Review-Url: https://codereview.chromium.org/2208423002 --- xfa/fde/tto/fde_textout.h | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'xfa/fde/tto/fde_textout.h') diff --git a/xfa/fde/tto/fde_textout.h b/xfa/fde/tto/fde_textout.h index 14ca5e19bb..8d2c0fe8a0 100644 --- a/xfa/fde/tto/fde_textout.h +++ b/xfa/fde/tto/fde_textout.h @@ -8,6 +8,7 @@ #define XFA_FDE_TTO_FDE_TEXTOUT_H_ #include +#include #include "core/fxge/include/fx_dib.h" #include "core/fxge/include/fx_ge.h" @@ -131,7 +132,7 @@ class CFDE_TextOut : public CFX_Target { void LoadText(const FX_WCHAR* pwsStr, int32_t iLength, const CFX_RectF& rect); void LoadEllipsis(); void ExpandBuffer(int32_t iSize, int32_t iType); - void RetrieveEllPieces(int32_t*& pCharWidths); + void RetrieveEllPieces(std::vector* pCharWidths); void Reload(const CFX_RectF& rect); void ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect); @@ -152,18 +153,16 @@ class CFDE_TextOut : public CFX_Target { FX_TXTRUN ToTextRun(const FDE_TTOPIECE* pPiece); void DrawLine(const FDE_TTOPIECE* pPiece, CFDE_Pen*& pPen); - CFX_TxtBreak* m_pTxtBreak; - CFGAS_GEFont* m_pFont; + std::unique_ptr m_pTxtBreak; + CFGAS_GEFont* m_pFont; // not owned. FX_FLOAT m_fFontSize; FX_FLOAT m_fLineSpace; FX_FLOAT m_fLinePos; FX_FLOAT m_fTolerance; int32_t m_iAlignment; int32_t m_iTxtBkAlignment; - int32_t* m_pCharWidths; - int32_t m_iChars; - int32_t* m_pEllCharWidths; - int32_t m_iEllChars; + std::vector m_CharWidths; + std::vector m_EllCharWidths; FX_WCHAR m_wParagraphBkChar; FX_ARGB m_TxtColor; uint32_t m_dwStyles; @@ -179,8 +178,7 @@ class CFDE_TextOut : public CFX_Target { int32_t m_iCurLine; int32_t m_iCurPiece; int32_t m_iTotalLines; - FXTEXT_CHARPOS* m_pCharPos; - int32_t m_iCharPosSize; + std::vector m_CharPos; std::unique_ptr m_pRenderDevice; CFX_Int32Array m_hotKeys; CFX_RectFArray m_rectArray; -- cgit v1.2.3