Index: xfa/fde/tto/fde_textout.cpp |
diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp |
index fc97d9912588397aa63347c41f53ea250fd10731..e5bd596b0c0d55236228add4d632cc353cb7c700 100644 |
--- a/xfa/fde/tto/fde_textout.cpp |
+++ b/xfa/fde/tto/fde_textout.cpp |
@@ -40,8 +40,7 @@ CFDE_TextOut::CFDE_TextOut() |
m_iCurPiece(0), |
m_iTotalLines(0), |
m_pCharPos(NULL), |
- m_iCharPosSize(0), |
- m_pRenderDevice(NULL) { |
+ m_iCharPosSize(0) { |
m_pTxtBreak = new CFX_TxtBreak(FX_TXTBREAKPOLICY_None); |
m_Matrix.SetIdentity(); |
m_rtClip.Reset(); |
@@ -53,9 +52,6 @@ CFDE_TextOut::~CFDE_TextOut() { |
} |
FX_Free(m_pCharWidths); |
FX_Free(m_pEllCharWidths); |
- if (m_pRenderDevice) { |
- m_pRenderDevice->Release(); |
- } |
FX_Free(m_pCharPos); |
m_ttoLines.RemoveAll(); |
} |
@@ -134,21 +130,15 @@ void CFDE_TextOut::SetLineSpace(FX_FLOAT fLineSpace) { |
void CFDE_TextOut::SetDIBitmap(CFX_DIBitmap* pDIB) { |
ASSERT(pDIB); |
- if (m_pRenderDevice) |
- m_pRenderDevice->Release(); |
- |
+ m_pRenderDevice.reset(); |
CFX_FxgeDevice* device = new CFX_FxgeDevice; |
device->Attach(pDIB, 0, FALSE); |
- m_pRenderDevice = new CFDE_RenderDevice(device, FALSE); |
+ m_pRenderDevice.reset(new CFDE_RenderDevice(device, FALSE)); |
} |
void CFDE_TextOut::SetRenderDevice(CFX_RenderDevice* pDevice) { |
ASSERT(pDevice); |
- |
- if (m_pRenderDevice) |
- m_pRenderDevice->Release(); |
- |
- m_pRenderDevice = new CFDE_RenderDevice(pDevice, FALSE); |
+ m_pRenderDevice.reset(new CFDE_RenderDevice(pDevice, FALSE)); |
} |
void CFDE_TextOut::SetClipRect(const CFX_Rect& rtClip) { |
@@ -780,13 +770,13 @@ void CFDE_TextOut::DoAlignment(const CFX_RectF& rect) { |
} |
} |
void CFDE_TextOut::OnDraw(const CFX_RectF& rtClip) { |
- if (m_pRenderDevice == NULL) { |
+ if (!m_pRenderDevice) |
return; |
- } |
+ |
int32_t iLines = m_ttoLines.GetSize(); |
- if (iLines < 1) { |
+ if (iLines < 1) |
return; |
- } |
+ |
CFDE_Brush* pBrush = new CFDE_Brush; |
pBrush->SetColor(m_TxtColor); |
CFDE_Pen* pPen = NULL; |
@@ -916,7 +906,7 @@ void CFDE_TextOut::DrawLine(const FDE_TTOPIECE* pPiece, CFDE_Pen*& pPen) { |
if (iLineCount > 0) { |
m_pRenderDevice->DrawPath(pPen, 1, pPath, &m_Matrix); |
} |
- pPath->Release(); |
+ delete pPath; |
Wei Li
2016/05/06 22:01:21
Nit: why not use unique_ptr for pPath as well?
Tom Sepez
2016/05/11 17:05:39
Done.
|
} |
CFDE_TTOLine::CFDE_TTOLine() |
: m_bNewReload(FALSE), m_pieces(5), m_iPieceCount(0) {} |