Index: xfa/fde/tto/fde_textout.cpp |
diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp |
index d9ada61d770352c2d21b8a967de13fcf24dc653c..52bb80545ac2654fb60d4d06353f3a274106b49d 100644 |
--- a/xfa/fde/tto/fde_textout.cpp |
+++ b/xfa/fde/tto/fde_textout.cpp |
@@ -18,16 +18,16 @@ |
#include "xfa/fgas/layout/fgas_textbreak.h" |
CFDE_TextOut::CFDE_TextOut() |
- : m_pFont(NULL), |
+ : m_pFont(nullptr), |
m_fFontSize(12.0f), |
m_fLineSpace(m_fFontSize), |
m_fLinePos(0.0f), |
m_fTolerance(0.0f), |
m_iAlignment(0), |
m_iTxtBkAlignment(0), |
- m_pCharWidths(NULL), |
+ m_pCharWidths(nullptr), |
m_iChars(0), |
- m_pEllCharWidths(NULL), |
+ m_pEllCharWidths(nullptr), |
m_iEllChars(0), |
m_wParagraphBkChar(L'\n'), |
m_TxtColor(0xFF000000), |
@@ -39,7 +39,7 @@ CFDE_TextOut::CFDE_TextOut() |
m_iCurLine(0), |
m_iCurPiece(0), |
m_iTotalLines(0), |
- m_pCharPos(NULL), |
+ m_pCharPos(nullptr), |
m_iCharPosSize(0) { |
m_pTxtBreak = new CFX_TxtBreak(FX_TXTBREAKPOLICY_None); |
m_Matrix.SetIdentity(); |
@@ -191,7 +191,7 @@ void CFDE_TextOut::CalcSize(const FX_WCHAR* pwsStr, |
void CFDE_TextOut::CalcSize(const FX_WCHAR* pwsStr, |
int32_t iLength, |
CFX_RectF& rect) { |
- if (pwsStr == NULL || iLength < 1) { |
+ if (!pwsStr || iLength < 1) { |
rect.width = 0.0f; |
rect.height = 0.0f; |
} else { |
@@ -214,7 +214,7 @@ void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr, |
void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr, |
int32_t iLength, |
CFX_RectF& rect) { |
- if (pwsStr == NULL || iLength < 1) { |
+ if (!pwsStr || iLength < 1) { |
rect.width = 0.0f; |
rect.height = 0.0f; |
} else { |
@@ -224,7 +224,7 @@ void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr, |
void CFDE_TextOut::CalcTextSize(const FX_WCHAR* pwsStr, |
int32_t iLength, |
CFX_RectF& rect) { |
- ASSERT(m_pFont != NULL && m_fFontSize >= 1.0f); |
+ ASSERT(m_pFont && m_fFontSize >= 1.0f); |
SetLineWidth(rect); |
m_iTotalLines = 0; |
const FX_WCHAR* pStr = pwsStr; |
@@ -386,10 +386,10 @@ void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, |
int32_t iLength, |
const CFX_RectF& rect, |
const CFX_RectF& rtClip) { |
- ASSERT(m_pFont != NULL && m_fFontSize >= 1.0f); |
- if (pwsStr == NULL || iLength < 1) { |
+ ASSERT(m_pFont && m_fFontSize >= 1.0f); |
+ if (!pwsStr || iLength < 1) |
return; |
- } |
+ |
if (rect.width < m_fFontSize || rect.height < m_fFontSize) { |
return; |
} |
@@ -431,7 +431,7 @@ void CFDE_TextOut::ExpandBuffer(int32_t iSize, int32_t iType) { |
FXSYS_memset(m_pEllCharWidths, 0, iSize * sizeof(int32_t)); |
break; |
case 2: |
- if (m_pCharPos == NULL) { |
+ if (!m_pCharPos) { |
m_pCharPos = FX_Alloc(FXTEXT_CHARPOS, iSize); |
m_iCharPosSize = iSize; |
} else if (m_iCharPosSize < iSize) { |
@@ -513,7 +513,7 @@ void CFDE_TextOut::LoadText(const FX_WCHAR* pwsStr, |
FX_BOOL bRet = FALSE; |
while (iTxtLength-- > 0) { |
wch = *pwsStr++; |
- if (wch == L'&' && bHotKey && (pStr - 1) != NULL && *(pStr - 1) != L'&') { |
+ if (wch == L'&' && bHotKey && pStr - 1 && *(pStr - 1) != L'&') { |
if (iTxtLength > 0) { |
m_hotKeys.Add(iChars); |
} |
@@ -565,7 +565,7 @@ FX_BOOL CFDE_TextOut::RetriecePieces(uint32_t dwBreakStatus, |
if (bVertical) { |
fLineStep = -fLineStep; |
} |
- CFX_Char* pTC = NULL; |
+ CFX_Char* pTC = nullptr; |
FX_BOOL bNeedReload = FALSE; |
FX_FLOAT fLineWidth = bVertical ? rect.Height() : rect.Width(); |
int32_t iLineWidth = FXSYS_round(fLineWidth * 20000.0f); |
@@ -663,9 +663,9 @@ void CFDE_TextOut::ReplaceWidthEllipsis() { |
int32_t iPiece = pLine->GetSize(); |
while (iPiece-- > 0) { |
FDE_TTOPIECE* pPiece = pLine->GetPtrAt(iPiece); |
- if (pPiece == NULL) { |
+ if (!pPiece) |
break; |
- } |
+ |
for (int32_t j = pPiece->iChars - 1; j >= 0; j--) { |
if (iEllipsisCharIndex < 0) { |
break; |
@@ -692,9 +692,9 @@ void CFDE_TextOut::Reload(const CFX_RectF& rect) { |
int32_t iCount = m_ttoLines.GetSize(); |
for (int32_t i = 0; i < iCount; i++) { |
CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(i); |
- if (pLine == NULL || !pLine->m_bNewReload) { |
+ if (!pLine || !pLine->m_bNewReload) |
continue; |
- } |
+ |
m_iCurLine = i; |
m_iCurPiece = 0; |
ReloadLinePiece(pLine, rect); |
@@ -774,7 +774,7 @@ void CFDE_TextOut::OnDraw(const CFX_RectF& rtClip) { |
CFDE_Brush* pBrush = new CFDE_Brush; |
pBrush->SetColor(m_TxtColor); |
- CFDE_Pen* pPen = NULL; |
+ CFDE_Pen* pPen = nullptr; |
m_pRenderDevice->SaveState(); |
if (rtClip.Width() > 0.0f && rtClip.Height() > 0.0f) { |
m_pRenderDevice->SetClipRect(rtClip); |
@@ -784,9 +784,9 @@ void CFDE_TextOut::OnDraw(const CFX_RectF& rtClip) { |
int32_t iPieces = pLine->GetSize(); |
for (int32_t j = 0; j < iPieces; j++) { |
FDE_TTOPIECE* pPiece = pLine->GetPtrAt(j); |
- if (pPiece == NULL) { |
+ if (!pPiece) |
continue; |
- } |
+ |
int32_t iCount = GetDisplayPos(pPiece); |
if (iCount > 0) { |
m_pRenderDevice->DrawString(pBrush, m_pFont, m_pCharPos, iCount, |
@@ -928,7 +928,7 @@ int32_t CFDE_TTOLine::GetSize() const { |
} |
FDE_TTOPIECE* CFDE_TTOLine::GetPtrAt(int32_t index) { |
if (index >= m_iPieceCount) { |
- return NULL; |
+ return nullptr; |
} |
return m_pieces.GetPtrAt(index); |
} |