diff options
Diffstat (limited to 'xfa/fxfa/app')
-rw-r--r-- | xfa/fxfa/app/xfa_ffdocview.cpp | 7 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffwidget.cpp | 22 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_textlayout.cpp | 57 |
3 files changed, 34 insertions, 52 deletions
diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp index beb7dec1a3..d8b65c4c5b 100644 --- a/xfa/fxfa/app/xfa_ffdocview.cpp +++ b/xfa/fxfa/app/xfa_ffdocview.cpp @@ -721,8 +721,7 @@ FX_BOOL CXFA_FFDocView::RunEventLayoutReady() { return TRUE; } void CXFA_FFDocView::RunBindItems() { - int32_t iCount = m_BindItems.GetSize(); - for (int32_t i = 0; i < iCount; i++) { + for (int32_t i = 0; i < m_BindItems.GetSize(); i++) { if (m_BindItems[i]->HasFlag(XFA_NODEFLAG_HasRemoved)) continue; @@ -757,8 +756,8 @@ void CXFA_FFDocView::RunBindItems() { CFX_WideString wsValue; CFX_WideString wsLabel; uint32_t uValueHash = FX_HashCode_GetW(wsValueRef, false); - for (int32_t i = 0; i < iCount; i++) { - CXFA_Object* refObj = rs.nodes[i]; + for (int32_t j = 0; j < iCount; j++) { + CXFA_Object* refObj = rs.nodes[j]; if (!refObj->IsNode()) { continue; } diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index 2a9638e817..8e10189f8c 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -1345,9 +1345,8 @@ static void XFA_BOX_GetFillPath(CXFA_Box box, return; } FX_BOOL bSameStyles = TRUE; - int32_t i; CXFA_Stroke stroke1 = strokes[0]; - for (i = 1; i < 8; i++) { + for (int32_t i = 1; i < 8; i++) { CXFA_Stroke stroke2 = strokes[i]; if (!stroke1.SameStyles(stroke2)) { bSameStyles = FALSE; @@ -1357,7 +1356,7 @@ static void XFA_BOX_GetFillPath(CXFA_Box box, } if (bSameStyles) { stroke1 = strokes[0]; - for (i = 2; i < 8; i += 2) { + for (int32_t i = 2; i < 8; i += 2) { CXFA_Stroke stroke2 = strokes[i]; if (!stroke1.SameStyles(stroke2, XFA_STROKE_SAMESTYLE_NoPresence | XFA_STROKE_SAMESTYLE_Corner)) { @@ -1839,9 +1838,8 @@ static void XFA_BOX_Stroke_Rect(CXFA_Box box, } FX_BOOL bClose = FALSE; FX_BOOL bSameStyles = TRUE; - int32_t i; CXFA_Stroke stroke1 = strokes[0]; - for (i = 1; i < 8; i++) { + for (int32_t i = 1; i < 8; i++) { CXFA_Stroke stroke2 = strokes[i]; if (!stroke1.SameStyles(stroke2)) { bSameStyles = FALSE; @@ -1852,7 +1850,7 @@ static void XFA_BOX_Stroke_Rect(CXFA_Box box, if (bSameStyles) { stroke1 = strokes[0]; bClose = TRUE; - for (i = 2; i < 8; i += 2) { + for (int32_t i = 2; i < 8; i += 2) { CXFA_Stroke stroke2 = strokes[i]; if (!stroke1.SameStyles(stroke2, XFA_STROKE_SAMESTYLE_NoPresence | XFA_STROKE_SAMESTYLE_Corner)) { @@ -1874,12 +1872,12 @@ static void XFA_BOX_Stroke_Rect(CXFA_Box box, FX_BOOL bStart = TRUE; CFX_Path path; path.Create(); - for (i = 0; i < 8; i++) { - CXFA_Stroke stroke1 = strokes[i]; - if ((i % 1) == 0 && stroke1.GetRadius() < 0) { + for (int32_t i = 0; i < 8; i++) { + CXFA_Stroke stroke = strokes[i]; + if ((i % 1) == 0 && stroke.GetRadius() < 0) { FX_BOOL bEmpty = path.IsEmpty(); if (!bEmpty) { - XFA_BOX_StrokePath(stroke1, &path, pGS, pMatrix); + XFA_BOX_StrokePath(stroke, &path, pGS, pMatrix); path.Clear(); } bStart = TRUE; @@ -1887,9 +1885,9 @@ static void XFA_BOX_Stroke_Rect(CXFA_Box box, } XFA_BOX_GetPath(box, strokes, rtWidget, path, i, bStart, !bSameStyles); CXFA_Stroke stroke2 = strokes[(i + 1) % 8]; - bStart = !stroke1.SameStyles(stroke2); + bStart = !stroke.SameStyles(stroke2); if (bStart) { - XFA_BOX_StrokePath(stroke1, &path, pGS, pMatrix); + XFA_BOX_StrokePath(stroke, &path, pGS, pMatrix); path.Clear(); } } diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp index fe72e29c05..fa300f1721 100644 --- a/xfa/fxfa/app/xfa_textlayout.cpp +++ b/xfa/fxfa/app/xfa_textlayout.cpp @@ -1042,12 +1042,11 @@ FX_BOOL CXFA_TextLayout::Layout(const CFX_SizeF& size, FX_FLOAT* fHeight) { } FX_BOOL CXFA_TextLayout::Layout(int32_t iBlock) { - if (m_pLoader == NULL || iBlock < 0 || iBlock >= CountBlocks()) { + if (m_pLoader == NULL || iBlock < 0 || iBlock >= CountBlocks()) return FALSE; - } - if (m_pLoader->m_fWidth < 1) { + if (m_pLoader->m_fWidth < 1) return FALSE; - } + m_pLoader->m_iTotalLines = -1; m_iLines = 0; FX_FLOAT fLinePos = 0; @@ -1056,9 +1055,8 @@ FX_BOOL CXFA_TextLayout::Layout(int32_t iBlock) { int32_t iCount = m_Blocks.GetSize(); int32_t iBlocksHeightCount = m_pLoader->m_BlocksHeight.GetSize(); iBlocksHeightCount /= 2; - if (iBlock < iBlocksHeightCount) { + if (iBlock < iBlocksHeightCount) return TRUE; - } if (iBlock == iBlocksHeightCount) { Unload(); m_pBreak.reset(CreateBreak(TRUE)); @@ -1067,18 +1065,15 @@ FX_BOOL CXFA_TextLayout::Layout(int32_t iBlock) { fLinePos -= m_pLoader->m_BlocksHeight.ElementAt(i * 2 + 1); } m_pLoader->m_iChar = 0; - if (iCount > 1) { + if (iCount > 1) m_pLoader->m_iTotalLines = m_Blocks.ElementAt(iBlock * 2 + 1); - } Loader(szText, fLinePos, TRUE); - if (iCount == 0 && m_pLoader->m_fStartLineOffset < 0.1f) { + if (iCount == 0 && m_pLoader->m_fStartLineOffset < 0.1f) UpdateAlign(szText.y, fLinePos); - } } else if (m_pTextDataNode) { iBlock *= 2; - if (iBlock < iCount - 2) { + if (iBlock < iCount - 2) m_pLoader->m_iTotalLines = m_Blocks.ElementAt(iBlock + 1); - } m_pBreak->Reset(); if (m_bRichText) { CFDE_XMLNode* pContainerNode = GetXMLContainerNode(); @@ -1086,48 +1081,40 @@ FX_BOOL CXFA_TextLayout::Layout(int32_t iBlock) { return TRUE; } CFDE_XMLNode* pXMLNode = m_pLoader->m_pXMLNode; - if (pXMLNode == NULL) { + if (!pXMLNode) return TRUE; - } CFDE_XMLNode* pSaveXMLNode = m_pLoader->m_pXMLNode; for (; pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { - FX_BOOL bFlag = LoadRichText(pXMLNode, szText, fLinePos, - m_pLoader->m_pParentStyle, TRUE); - if (!bFlag) { + if (!LoadRichText(pXMLNode, szText, fLinePos, m_pLoader->m_pParentStyle, + TRUE)) { break; } } - while (pXMLNode == NULL) { + while (!pXMLNode) { pXMLNode = pSaveXMLNode->GetNodeItem(CFDE_XMLNode::Parent); - if (pXMLNode == pContainerNode) { + if (pXMLNode == pContainerNode) break; - } - FX_BOOL bFlag = - LoadRichText(pXMLNode, szText, fLinePos, m_pLoader->m_pParentStyle, - TRUE, NULL, FALSE); - if (!bFlag) { + if (!LoadRichText(pXMLNode, szText, fLinePos, m_pLoader->m_pParentStyle, + TRUE, NULL, FALSE)) { break; } pSaveXMLNode = pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling); - if (!pXMLNode) { + if (!pXMLNode) continue; - } for (; pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { - FX_BOOL bFlag = LoadRichText(pXMLNode, szText, fLinePos, - m_pLoader->m_pParentStyle, TRUE); - if (!bFlag) { + if (!LoadRichText(pXMLNode, szText, fLinePos, + m_pLoader->m_pParentStyle, TRUE)) { break; } } } } else { pNode = m_pLoader->m_pNode; - if (pNode == NULL) { + if (!pNode) return TRUE; - } LoadText(pNode, szText, fLinePos, TRUE); } } @@ -1839,7 +1826,6 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice, if (iChars > 0) { CFX_PointF pt1, pt2; FX_FLOAT fEndY = pCharPos[0].m_OriginY + 1.05f; - int32_t i = 0; if (pPiece->iPeriod == XFA_ATTRIBUTEENUM_Word) { for (int32_t i = 0; i < pPiece->iUnderline; i++) { for (int32_t j = 0; j < iChars; j++) { @@ -1866,7 +1852,7 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice, pt1.x = pCharPos[0].m_OriginX; pt2.x = pCharPos[iChars - 1].m_OriginX + pCharPos[iChars - 1].m_FontCharWidth * pPiece->fFontSize / 1000.0f; - for (i = 0; i < pPiece->iLineThrough; i++) { + for (int32_t i = 0; i < pPiece->iLineThrough; i++) { pt1.y = pt2.y = fEndY; pPath->AddLine(pt1, pt2); fEndY += 2.0f; @@ -1917,14 +1903,13 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice, CFX_PointF pt1, pt2; pt1.x = fOrgX, pt2.x = fEndX; FX_FLOAT fEndY = pCharPos[0].m_OriginY + 1.05f; - int32_t i = 0; - for (i = 0; i < pPiece->iUnderline; i++) { + for (int32_t i = 0; i < pPiece->iUnderline; i++) { pt1.y = pt2.y = fEndY; pPath->AddLine(pt1, pt2); fEndY += 2.0f; } fEndY = pCharPos[0].m_OriginY - pPiece->rtPiece.height * 0.25f; - for (i = 0; i < pPiece->iLineThrough; i++) { + for (int32_t i = 0; i < pPiece->iLineThrough; i++) { pt1.y = pt2.y = fEndY; pPath->AddLine(pt1, pt2); fEndY += 2.0f; |