| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "xfa/fde/tto/fde_textout.h" | 7 #include "xfa/fde/tto/fde_textout.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 if (!m_bElliChanged) { | 617 if (!m_bElliChanged) { |
| 618 return; | 618 return; |
| 619 } | 619 } |
| 620 m_bElliChanged = FALSE; | 620 m_bElliChanged = FALSE; |
| 621 m_iEllipsisWidth = 0; | 621 m_iEllipsisWidth = 0; |
| 622 int32_t iLength = m_wsEllipsis.GetLength(); | 622 int32_t iLength = m_wsEllipsis.GetLength(); |
| 623 if (iLength < 1) { | 623 if (iLength < 1) { |
| 624 return; | 624 return; |
| 625 } | 625 } |
| 626 ExpandBuffer(iLength, 1); | 626 ExpandBuffer(iLength, 1); |
| 627 const FX_WCHAR* pStr = (const FX_WCHAR*)m_wsEllipsis; | 627 const FX_WCHAR* pStr = m_wsEllipsis.c_str(); |
| 628 int32_t* pCharWidths = m_pEllCharWidths; | 628 int32_t* pCharWidths = m_pEllCharWidths; |
| 629 uint32_t dwBreakStatus; | 629 uint32_t dwBreakStatus; |
| 630 FX_WCHAR wch; | 630 FX_WCHAR wch; |
| 631 while (iLength-- > 0) { | 631 while (iLength-- > 0) { |
| 632 wch = *pStr++; | 632 wch = *pStr++; |
| 633 dwBreakStatus = m_pTxtBreak->AppendChar(wch); | 633 dwBreakStatus = m_pTxtBreak->AppendChar(wch); |
| 634 if (dwBreakStatus > FX_TXTBREAK_PieceBreak) { | 634 if (dwBreakStatus > FX_TXTBREAK_PieceBreak) { |
| 635 RetrieveEllPieces(pCharWidths); | 635 RetrieveEllPieces(pCharWidths); |
| 636 } | 636 } |
| 637 } | 637 } |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(i); | 866 CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(i); |
| 867 if (pLine == NULL || !pLine->m_bNewReload) { | 867 if (pLine == NULL || !pLine->m_bNewReload) { |
| 868 continue; | 868 continue; |
| 869 } | 869 } |
| 870 m_iCurLine = i; | 870 m_iCurLine = i; |
| 871 m_iCurPiece = 0; | 871 m_iCurPiece = 0; |
| 872 ReloadLinePiece(pLine, rect); | 872 ReloadLinePiece(pLine, rect); |
| 873 } | 873 } |
| 874 } | 874 } |
| 875 void CFDE_TextOut::ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect) { | 875 void CFDE_TextOut::ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect) { |
| 876 const FX_WCHAR* pwsStr = (const FX_WCHAR*)m_wsText; | 876 const FX_WCHAR* pwsStr = m_wsText.c_str(); |
| 877 FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); | 877 FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); |
| 878 int32_t iPieceWidths = 0; | 878 int32_t iPieceWidths = 0; |
| 879 FDE_LPTTOPIECE pPiece = pLine->GetPtrAt(0); | 879 FDE_LPTTOPIECE pPiece = pLine->GetPtrAt(0); |
| 880 int32_t iStartChar = pPiece->iStartChar; | 880 int32_t iStartChar = pPiece->iStartChar; |
| 881 m_fLinePos = bVertical ? pPiece->rtPiece.left : pPiece->rtPiece.top; | 881 m_fLinePos = bVertical ? pPiece->rtPiece.left : pPiece->rtPiece.top; |
| 882 int32_t iPieceCount = pLine->GetSize(); | 882 int32_t iPieceCount = pLine->GetSize(); |
| 883 int32_t iPieceIndex = 0; | 883 int32_t iPieceIndex = 0; |
| 884 uint32_t dwBreakStatus = 0; | 884 uint32_t dwBreakStatus = 0; |
| 885 FX_WCHAR wch; | 885 FX_WCHAR wch; |
| 886 while (iPieceIndex < iPieceCount) { | 886 while (iPieceIndex < iPieceCount) { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 } | 983 } |
| 984 int32_t CFDE_TextOut::GetCharRects(FDE_LPTTOPIECE pPiece) { | 984 int32_t CFDE_TextOut::GetCharRects(FDE_LPTTOPIECE pPiece) { |
| 985 FX_TXTRUN tr; | 985 FX_TXTRUN tr; |
| 986 ToTextRun(pPiece, tr); | 986 ToTextRun(pPiece, tr); |
| 987 m_rectArray.RemoveAll(); | 987 m_rectArray.RemoveAll(); |
| 988 return m_pTxtBreak->GetCharRects(&tr, m_rectArray); | 988 return m_pTxtBreak->GetCharRects(&tr, m_rectArray); |
| 989 } | 989 } |
| 990 void CFDE_TextOut::ToTextRun(const FDE_LPTTOPIECE pPiece, FX_TXTRUN& tr) { | 990 void CFDE_TextOut::ToTextRun(const FDE_LPTTOPIECE pPiece, FX_TXTRUN& tr) { |
| 991 tr.pAccess = NULL; | 991 tr.pAccess = NULL; |
| 992 tr.pIdentity = NULL; | 992 tr.pIdentity = NULL; |
| 993 tr.pStr = (const FX_WCHAR*)m_wsText + pPiece->iStartChar; | 993 tr.pStr = (m_wsText + pPiece->iStartChar).c_str(); |
| 994 tr.pWidths = m_pCharWidths + pPiece->iStartChar; | 994 tr.pWidths = m_pCharWidths + pPiece->iStartChar; |
| 995 tr.iLength = pPiece->iChars; | 995 tr.iLength = pPiece->iChars; |
| 996 tr.pFont = m_pFont; | 996 tr.pFont = m_pFont; |
| 997 tr.fFontSize = m_fFontSize; | 997 tr.fFontSize = m_fFontSize; |
| 998 tr.dwStyles = m_dwTxtBkStyles; | 998 tr.dwStyles = m_dwTxtBkStyles; |
| 999 tr.iCharRotation = 0; | 999 tr.iCharRotation = 0; |
| 1000 tr.dwCharStyles = pPiece->dwCharStyles; | 1000 tr.dwCharStyles = pPiece->dwCharStyles; |
| 1001 tr.wLineBreakChar = m_wParagraphBkChar; | 1001 tr.wLineBreakChar = m_wParagraphBkChar; |
| 1002 tr.pRect = &pPiece->rtPiece; | 1002 tr.pRect = &pPiece->rtPiece; |
| 1003 } | 1003 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1104 return NULL; | 1104 return NULL; |
| 1105 } | 1105 } |
| 1106 return m_pieces.GetPtrAt(index); | 1106 return m_pieces.GetPtrAt(index); |
| 1107 } | 1107 } |
| 1108 void CFDE_TTOLine::RemoveLast(int32_t iCount) { | 1108 void CFDE_TTOLine::RemoveLast(int32_t iCount) { |
| 1109 m_pieces.RemoveLast(iCount); | 1109 m_pieces.RemoveLast(iCount); |
| 1110 } | 1110 } |
| 1111 void CFDE_TTOLine::RemoveAll(FX_BOOL bLeaveMemory) { | 1111 void CFDE_TTOLine::RemoveAll(FX_BOOL bLeaveMemory) { |
| 1112 m_pieces.RemoveAll(bLeaveMemory); | 1112 m_pieces.RemoveAll(bLeaveMemory); |
| 1113 } | 1113 } |
| OLD | NEW |