diff options
author | dan sinclair <dsinclair@chromium.org> | 2017-03-13 12:30:42 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-13 17:05:04 +0000 |
commit | 8f03b422ed85180ac24fc76ba0fcf7de3556679f (patch) | |
tree | 146204fe83b87eb4789f5f957e3a3256b21a8cb7 /xfa/fgas/layout/fgas_rtfbreak.cpp | |
parent | 8da79203b32d1a0df05a23da83044bdaf71c320d (diff) | |
download | pdfium-8f03b422ed85180ac24fc76ba0fcf7de3556679f.tar.xz |
Simplify TxtBreak line handling.
This Cl moves the two lines into an array and uses m_iReady to index
the array.
Change-Id: Ibecfb35fb72603433a6ed1efa6ec8ae609caebf7
Reviewed-on: https://pdfium-review.googlesource.com/2951
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'xfa/fgas/layout/fgas_rtfbreak.cpp')
-rw-r--r-- | xfa/fgas/layout/fgas_rtfbreak.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp index 8f1761dea8..c725dfb268 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.cpp +++ b/xfa/fgas/layout/fgas_rtfbreak.cpp @@ -34,7 +34,7 @@ CFX_RTFBreak::CFX_RTFBreak(uint32_t dwLayoutStyles) m_dwIdentity(0), m_pCurLine(nullptr), m_iTolerance(0), - m_iReady(-1) { + m_iReadyLineIndex(-1) { m_pCurLine = &m_RTFLine[0]; SetBreakStatus(); @@ -386,10 +386,10 @@ CFX_BreakType CFX_RTFBreak::EndBreak(CFX_BreakType dwStatus) { } if (HasRTFLine()) { - if (!m_RTFLine[m_iReady].m_LinePieces.empty()) { + if (!m_RTFLine[m_iReadyLineIndex].m_LinePieces.empty()) { if (dwStatus != CFX_BreakType::Piece) - m_RTFLine[m_iReady].m_LinePieces.back().m_dwStatus = dwStatus; - return m_RTFLine[m_iReady].m_LinePieces.back().m_dwStatus; + m_RTFLine[m_iReadyLineIndex].m_LinePieces.back().m_dwStatus = dwStatus; + return m_RTFLine[m_iReadyLineIndex].m_LinePieces.back().m_dwStatus; } return CFX_BreakType::None; } @@ -403,8 +403,8 @@ CFX_BreakType CFX_RTFBreak::EndBreak(CFX_BreakType dwStatus) { if (dwStatus == CFX_BreakType::Piece) return dwStatus; - m_iReady = m_pCurLine == &m_RTFLine[0] ? 0 : 1; - CFX_RTFLine* pNextLine = &m_RTFLine[1 - m_iReady]; + m_iReadyLineIndex = m_pCurLine == &m_RTFLine[0] ? 0 : 1; + CFX_RTFLine* pNextLine = &m_RTFLine[1 - m_iReadyLineIndex]; bool bAllChars = m_iAlignment == CFX_RTFLineAlignment::Justified || m_iAlignment == CFX_RTFLineAlignment::Distributed; @@ -794,9 +794,9 @@ void CFX_RTFBreak::SplitTextLine(CFX_RTFLine* pCurLine, } int32_t CFX_RTFBreak::CountBreakPieces() const { - return HasRTFLine() - ? pdfium::CollectionSize<int32_t>(m_RTFLine[m_iReady].m_LinePieces) - : 0; + return HasRTFLine() ? pdfium::CollectionSize<int32_t>( + m_RTFLine[m_iReadyLineIndex].m_LinePieces) + : 0; } const CFX_RTFPiece* CFX_RTFBreak::GetBreakPieceUnstable(int32_t index) const { @@ -804,7 +804,7 @@ const CFX_RTFPiece* CFX_RTFBreak::GetBreakPieceUnstable(int32_t index) const { return nullptr; const std::vector<CFX_RTFPiece>& pRTFPieces = - m_RTFLine[m_iReady].m_LinePieces; + m_RTFLine[m_iReadyLineIndex].m_LinePieces; if (index < 0 || index >= pdfium::CollectionSize<int32_t>(pRTFPieces)) return nullptr; return &pRTFPieces[index]; @@ -812,9 +812,9 @@ const CFX_RTFPiece* CFX_RTFBreak::GetBreakPieceUnstable(int32_t index) const { void CFX_RTFBreak::ClearBreakPieces() { if (HasRTFLine()) - m_RTFLine[m_iReady].Clear(); + m_RTFLine[m_iReadyLineIndex].Clear(); - m_iReady = -1; + m_iReadyLineIndex = -1; } void CFX_RTFBreak::Reset() { |