| 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 |
| 11 #include "core/fxcrt/include/fx_coordinates.h" | 11 #include "core/fxcrt/include/fx_coordinates.h" |
| 12 #include "core/fxcrt/include/fx_system.h" | 12 #include "core/fxcrt/include/fx_system.h" |
| 13 #include "xfa/fde/fde_brush.h" | 13 #include "xfa/fde/fde_brush.h" |
| 14 #include "xfa/fde/fde_pen.h" | 14 #include "xfa/fde/fde_pen.h" |
| 15 #include "xfa/fde/fde_renderdevice.h" | 15 #include "xfa/fde/fde_renderdevice.h" |
| 16 #include "xfa/fgas/crt/fgas_memory.h" | 16 #include "xfa/fgas/crt/fgas_memory.h" |
| 17 #include "xfa/fgas/crt/fgas_utils.h" | 17 #include "xfa/fgas/crt/fgas_utils.h" |
| 18 #include "xfa/fgas/layout/fgas_textbreak.h" | 18 #include "xfa/fgas/layout/fgas_textbreak.h" |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 struct FDE_TTOPIECE { | 22 struct FDE_TTOPIECE { |
| 23 public: | 23 public: |
| 24 int32_t iStartChar; | 24 int32_t iStartChar; |
| 25 int32_t iChars; | 25 int32_t iChars; |
| 26 FX_DWORD dwCharStyles; | 26 uint32_t dwCharStyles; |
| 27 CFX_RectF rtPiece; | 27 CFX_RectF rtPiece; |
| 28 }; | 28 }; |
| 29 typedef FDE_TTOPIECE* FDE_LPTTOPIECE; | 29 typedef FDE_TTOPIECE* FDE_LPTTOPIECE; |
| 30 typedef CFX_MassArrayTemplate<FDE_TTOPIECE> CFDE_TTOPieceArray; | 30 typedef CFX_MassArrayTemplate<FDE_TTOPIECE> CFDE_TTOPieceArray; |
| 31 | 31 |
| 32 class CFDE_TTOLine : public CFX_Target { | 32 class CFDE_TTOLine : public CFX_Target { |
| 33 public: | 33 public: |
| 34 CFDE_TTOLine(); | 34 CFDE_TTOLine(); |
| 35 CFDE_TTOLine(const CFDE_TTOLine& ttoLine); | 35 CFDE_TTOLine(const CFDE_TTOLine& ttoLine); |
| 36 ~CFDE_TTOLine(); | 36 ~CFDE_TTOLine(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 48 typedef CFX_ObjectMassArrayTemplate<CFDE_TTOLine> CFDE_TTOLineArray; | 48 typedef CFX_ObjectMassArrayTemplate<CFDE_TTOLine> CFDE_TTOLineArray; |
| 49 | 49 |
| 50 class CFDE_TextOut : public IFDE_TextOut, public CFX_Target { | 50 class CFDE_TextOut : public IFDE_TextOut, public CFX_Target { |
| 51 public: | 51 public: |
| 52 CFDE_TextOut(); | 52 CFDE_TextOut(); |
| 53 ~CFDE_TextOut(); | 53 ~CFDE_TextOut(); |
| 54 virtual void Release() { delete this; } | 54 virtual void Release() { delete this; } |
| 55 virtual void SetFont(IFX_Font* pFont); | 55 virtual void SetFont(IFX_Font* pFont); |
| 56 virtual void SetFontSize(FX_FLOAT fFontSize); | 56 virtual void SetFontSize(FX_FLOAT fFontSize); |
| 57 virtual void SetTextColor(FX_ARGB color); | 57 virtual void SetTextColor(FX_ARGB color); |
| 58 virtual void SetStyles(FX_DWORD dwStyles); | 58 virtual void SetStyles(uint32_t dwStyles); |
| 59 virtual void SetTabWidth(FX_FLOAT fTabWidth); | 59 virtual void SetTabWidth(FX_FLOAT fTabWidth); |
| 60 virtual void SetEllipsisString(const CFX_WideString& wsEllipsis); | 60 virtual void SetEllipsisString(const CFX_WideString& wsEllipsis); |
| 61 virtual void SetParagraphBreakChar(FX_WCHAR wch); | 61 virtual void SetParagraphBreakChar(FX_WCHAR wch); |
| 62 virtual void SetAlignment(int32_t iAlignment); | 62 virtual void SetAlignment(int32_t iAlignment); |
| 63 virtual void SetLineSpace(FX_FLOAT fLineSpace); | 63 virtual void SetLineSpace(FX_FLOAT fLineSpace); |
| 64 virtual void SetDIBitmap(CFX_DIBitmap* pDIB); | 64 virtual void SetDIBitmap(CFX_DIBitmap* pDIB); |
| 65 virtual void SetRenderDevice(CFX_RenderDevice* pDevice); | 65 virtual void SetRenderDevice(CFX_RenderDevice* pDevice); |
| 66 virtual void SetClipRect(const CFX_Rect& rtClip); | 66 virtual void SetClipRect(const CFX_Rect& rtClip); |
| 67 virtual void SetClipRect(const CFX_RectF& rtClip); | 67 virtual void SetClipRect(const CFX_RectF& rtClip); |
| 68 virtual void SetMatrix(const CFX_Matrix& matrix); | 68 virtual void SetMatrix(const CFX_Matrix& matrix); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 int32_t iLength, | 106 int32_t iLength, |
| 107 FX_FLOAT x, | 107 FX_FLOAT x, |
| 108 FX_FLOAT y); | 108 FX_FLOAT y); |
| 109 virtual void DrawLogicText(const FX_WCHAR* pwsStr, | 109 virtual void DrawLogicText(const FX_WCHAR* pwsStr, |
| 110 int32_t iLength, | 110 int32_t iLength, |
| 111 const CFX_RectF& rect); | 111 const CFX_RectF& rect); |
| 112 virtual int32_t GetTotalLines(); | 112 virtual int32_t GetTotalLines(); |
| 113 | 113 |
| 114 protected: | 114 protected: |
| 115 void CalcTextSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_RectF& rect); | 115 void CalcTextSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_RectF& rect); |
| 116 FX_BOOL RetrieveLineWidth(FX_DWORD dwBreakStatus, | 116 FX_BOOL RetrieveLineWidth(uint32_t dwBreakStatus, |
| 117 FX_FLOAT& fStartPos, | 117 FX_FLOAT& fStartPos, |
| 118 FX_FLOAT& fWidth, | 118 FX_FLOAT& fWidth, |
| 119 FX_FLOAT& fHeight); | 119 FX_FLOAT& fHeight); |
| 120 void SetLineWidth(CFX_RectF& rect); | 120 void SetLineWidth(CFX_RectF& rect); |
| 121 void DrawText(const FX_WCHAR* pwsStr, | 121 void DrawText(const FX_WCHAR* pwsStr, |
| 122 int32_t iLength, | 122 int32_t iLength, |
| 123 const CFX_RectF& rect, | 123 const CFX_RectF& rect, |
| 124 const CFX_RectF& rtClip); | 124 const CFX_RectF& rtClip); |
| 125 void LoadText(const FX_WCHAR* pwsStr, int32_t iLength, const CFX_RectF& rect); | 125 void LoadText(const FX_WCHAR* pwsStr, int32_t iLength, const CFX_RectF& rect); |
| 126 void LoadEllipsis(); | 126 void LoadEllipsis(); |
| 127 void ExpandBuffer(int32_t iSize, int32_t iType); | 127 void ExpandBuffer(int32_t iSize, int32_t iType); |
| 128 void RetrieveEllPieces(int32_t*& pCharWidths); | 128 void RetrieveEllPieces(int32_t*& pCharWidths); |
| 129 | 129 |
| 130 void Reload(const CFX_RectF& rect); | 130 void Reload(const CFX_RectF& rect); |
| 131 void ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect); | 131 void ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect); |
| 132 FX_BOOL RetriecePieces(FX_DWORD dwBreakStatus, | 132 FX_BOOL RetriecePieces(uint32_t dwBreakStatus, |
| 133 int32_t& iStartChar, | 133 int32_t& iStartChar, |
| 134 int32_t& iPieceWidths, | 134 int32_t& iPieceWidths, |
| 135 FX_BOOL bReload, | 135 FX_BOOL bReload, |
| 136 const CFX_RectF& rect); | 136 const CFX_RectF& rect); |
| 137 void AppendPiece(const FDE_TTOPIECE& ttoPiece, | 137 void AppendPiece(const FDE_TTOPIECE& ttoPiece, |
| 138 FX_BOOL bNeedReload, | 138 FX_BOOL bNeedReload, |
| 139 FX_BOOL bEnd); | 139 FX_BOOL bEnd); |
| 140 void ReplaceWidthEllipsis(); | 140 void ReplaceWidthEllipsis(); |
| 141 void DoAlignment(const CFX_RectF& rect); | 141 void DoAlignment(const CFX_RectF& rect); |
| 142 void OnDraw(const CFX_RectF& rtClip); | 142 void OnDraw(const CFX_RectF& rtClip); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 153 FX_FLOAT m_fLinePos; | 153 FX_FLOAT m_fLinePos; |
| 154 FX_FLOAT m_fTolerance; | 154 FX_FLOAT m_fTolerance; |
| 155 int32_t m_iAlignment; | 155 int32_t m_iAlignment; |
| 156 int32_t m_iTxtBkAlignment; | 156 int32_t m_iTxtBkAlignment; |
| 157 int32_t* m_pCharWidths; | 157 int32_t* m_pCharWidths; |
| 158 int32_t m_iChars; | 158 int32_t m_iChars; |
| 159 int32_t* m_pEllCharWidths; | 159 int32_t* m_pEllCharWidths; |
| 160 int32_t m_iEllChars; | 160 int32_t m_iEllChars; |
| 161 FX_WCHAR m_wParagraphBkChar; | 161 FX_WCHAR m_wParagraphBkChar; |
| 162 FX_ARGB m_TxtColor; | 162 FX_ARGB m_TxtColor; |
| 163 FX_DWORD m_dwStyles; | 163 uint32_t m_dwStyles; |
| 164 FX_DWORD m_dwTxtBkStyles; | 164 uint32_t m_dwTxtBkStyles; |
| 165 CFX_WideString m_wsEllipsis; | 165 CFX_WideString m_wsEllipsis; |
| 166 FX_BOOL m_bElliChanged; | 166 FX_BOOL m_bElliChanged; |
| 167 int32_t m_iEllipsisWidth; | 167 int32_t m_iEllipsisWidth; |
| 168 CFX_WideString m_wsText; | 168 CFX_WideString m_wsText; |
| 169 CFX_RectF m_rtClip; | 169 CFX_RectF m_rtClip; |
| 170 CFX_RectF m_rtLogicClip; | 170 CFX_RectF m_rtLogicClip; |
| 171 CFX_Matrix m_Matrix; | 171 CFX_Matrix m_Matrix; |
| 172 CFDE_TTOLineArray m_ttoLines; | 172 CFDE_TTOLineArray m_ttoLines; |
| 173 int32_t m_iCurLine; | 173 int32_t m_iCurLine; |
| 174 int32_t m_iCurPiece; | 174 int32_t m_iCurPiece; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 m_pTxtBreak->SetFont(pFont); | 234 m_pTxtBreak->SetFont(pFont); |
| 235 } | 235 } |
| 236 void CFDE_TextOut::SetFontSize(FX_FLOAT fFontSize) { | 236 void CFDE_TextOut::SetFontSize(FX_FLOAT fFontSize) { |
| 237 FXSYS_assert(fFontSize > 0); | 237 FXSYS_assert(fFontSize > 0); |
| 238 m_fFontSize = fFontSize; | 238 m_fFontSize = fFontSize; |
| 239 m_pTxtBreak->SetFontSize(fFontSize); | 239 m_pTxtBreak->SetFontSize(fFontSize); |
| 240 } | 240 } |
| 241 void CFDE_TextOut::SetTextColor(FX_ARGB color) { | 241 void CFDE_TextOut::SetTextColor(FX_ARGB color) { |
| 242 m_TxtColor = color; | 242 m_TxtColor = color; |
| 243 } | 243 } |
| 244 void CFDE_TextOut::SetStyles(FX_DWORD dwStyles) { | 244 void CFDE_TextOut::SetStyles(uint32_t dwStyles) { |
| 245 m_dwStyles = dwStyles; | 245 m_dwStyles = dwStyles; |
| 246 m_dwTxtBkStyles = 0; | 246 m_dwTxtBkStyles = 0; |
| 247 if (dwStyles & FDE_TTOSTYLE_SingleLine) { | 247 if (dwStyles & FDE_TTOSTYLE_SingleLine) { |
| 248 m_dwTxtBkStyles |= FX_TXTLAYOUTSTYLE_SingleLine; | 248 m_dwTxtBkStyles |= FX_TXTLAYOUTSTYLE_SingleLine; |
| 249 } | 249 } |
| 250 if (dwStyles & FDE_TTOSTYLE_ExpandTab) { | 250 if (dwStyles & FDE_TTOSTYLE_ExpandTab) { |
| 251 m_dwTxtBkStyles |= FX_TXTLAYOUTSTYLE_ExpandTab; | 251 m_dwTxtBkStyles |= FX_TXTLAYOUTSTYLE_ExpandTab; |
| 252 } | 252 } |
| 253 if (dwStyles & FDE_TTOSTYLE_ArabicShapes) { | 253 if (dwStyles & FDE_TTOSTYLE_ArabicShapes) { |
| 254 m_dwTxtBkStyles |= FX_TXTLAYOUTSTYLE_ArabicShapes; | 254 m_dwTxtBkStyles |= FX_TXTLAYOUTSTYLE_ArabicShapes; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 CFX_RectF& rect) { | 400 CFX_RectF& rect) { |
| 401 FXSYS_assert(m_pFont != NULL && m_fFontSize >= 1.0f); | 401 FXSYS_assert(m_pFont != NULL && m_fFontSize >= 1.0f); |
| 402 SetLineWidth(rect); | 402 SetLineWidth(rect); |
| 403 m_iTotalLines = 0; | 403 m_iTotalLines = 0; |
| 404 const FX_WCHAR* pStr = pwsStr; | 404 const FX_WCHAR* pStr = pwsStr; |
| 405 FX_BOOL bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey); | 405 FX_BOOL bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey); |
| 406 FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); | 406 FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); |
| 407 FX_FLOAT fWidth = 0.0f; | 407 FX_FLOAT fWidth = 0.0f; |
| 408 FX_FLOAT fHeight = 0.0f; | 408 FX_FLOAT fHeight = 0.0f; |
| 409 FX_FLOAT fStartPos = bVertical ? rect.bottom() : rect.right(); | 409 FX_FLOAT fStartPos = bVertical ? rect.bottom() : rect.right(); |
| 410 FX_DWORD dwBreakStatus = 0; | 410 uint32_t dwBreakStatus = 0; |
| 411 FX_WCHAR wPreChar = 0; | 411 FX_WCHAR wPreChar = 0; |
| 412 FX_WCHAR wch; | 412 FX_WCHAR wch; |
| 413 FX_WCHAR wBreak = 0; | 413 FX_WCHAR wBreak = 0; |
| 414 while (iLength-- > 0) { | 414 while (iLength-- > 0) { |
| 415 wch = *pStr++; | 415 wch = *pStr++; |
| 416 if (wBreak == 0 && (wch == L'\n' || wch == L'\r')) { | 416 if (wBreak == 0 && (wch == L'\n' || wch == L'\r')) { |
| 417 wBreak = wch; | 417 wBreak = wch; |
| 418 m_pTxtBreak->SetParagraphBreakChar(wch); | 418 m_pTxtBreak->SetParagraphBreakChar(wch); |
| 419 } | 419 } |
| 420 if (bHotKey && wch == L'&' && wPreChar != L'&') { | 420 if (bHotKey && wch == L'&' && wPreChar != L'&') { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 fLineWidth = rect.Height(); | 467 fLineWidth = rect.Height(); |
| 468 } else { | 468 } else { |
| 469 if (rect.Width() < 1.0f) { | 469 if (rect.Width() < 1.0f) { |
| 470 rect.width = m_fFontSize * 1000.0f; | 470 rect.width = m_fFontSize * 1000.0f; |
| 471 } | 471 } |
| 472 fLineWidth = rect.Width(); | 472 fLineWidth = rect.Width(); |
| 473 } | 473 } |
| 474 m_pTxtBreak->SetLineWidth(fLineWidth); | 474 m_pTxtBreak->SetLineWidth(fLineWidth); |
| 475 } | 475 } |
| 476 } | 476 } |
| 477 FX_BOOL CFDE_TextOut::RetrieveLineWidth(FX_DWORD dwBreakStatus, | 477 FX_BOOL CFDE_TextOut::RetrieveLineWidth(uint32_t dwBreakStatus, |
| 478 FX_FLOAT& fStartPos, | 478 FX_FLOAT& fStartPos, |
| 479 FX_FLOAT& fWidth, | 479 FX_FLOAT& fWidth, |
| 480 FX_FLOAT& fHeight) { | 480 FX_FLOAT& fHeight) { |
| 481 if (dwBreakStatus <= FX_TXTBREAK_PieceBreak) { | 481 if (dwBreakStatus <= FX_TXTBREAK_PieceBreak) { |
| 482 return FALSE; | 482 return FALSE; |
| 483 } | 483 } |
| 484 FX_FLOAT fLineStep = | 484 FX_FLOAT fLineStep = |
| 485 (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize; | 485 (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize; |
| 486 FX_BOOL bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap); | 486 FX_BOOL bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap); |
| 487 FX_FLOAT fLineWidth = 0.0f; | 487 FX_FLOAT fLineWidth = 0.0f; |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 } | 621 } |
| 622 m_bElliChanged = FALSE; | 622 m_bElliChanged = FALSE; |
| 623 m_iEllipsisWidth = 0; | 623 m_iEllipsisWidth = 0; |
| 624 int32_t iLength = m_wsEllipsis.GetLength(); | 624 int32_t iLength = m_wsEllipsis.GetLength(); |
| 625 if (iLength < 1) { | 625 if (iLength < 1) { |
| 626 return; | 626 return; |
| 627 } | 627 } |
| 628 ExpandBuffer(iLength, 1); | 628 ExpandBuffer(iLength, 1); |
| 629 const FX_WCHAR* pStr = (const FX_WCHAR*)m_wsEllipsis; | 629 const FX_WCHAR* pStr = (const FX_WCHAR*)m_wsEllipsis; |
| 630 int32_t* pCharWidths = m_pEllCharWidths; | 630 int32_t* pCharWidths = m_pEllCharWidths; |
| 631 FX_DWORD dwBreakStatus; | 631 uint32_t dwBreakStatus; |
| 632 FX_WCHAR wch; | 632 FX_WCHAR wch; |
| 633 while (iLength-- > 0) { | 633 while (iLength-- > 0) { |
| 634 wch = *pStr++; | 634 wch = *pStr++; |
| 635 dwBreakStatus = m_pTxtBreak->AppendChar(wch); | 635 dwBreakStatus = m_pTxtBreak->AppendChar(wch); |
| 636 if (dwBreakStatus > FX_TXTBREAK_PieceBreak) { | 636 if (dwBreakStatus > FX_TXTBREAK_PieceBreak) { |
| 637 RetrieveEllPieces(pCharWidths); | 637 RetrieveEllPieces(pCharWidths); |
| 638 } | 638 } |
| 639 } | 639 } |
| 640 dwBreakStatus = m_pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); | 640 dwBreakStatus = m_pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); |
| 641 if (dwBreakStatus > FX_TXTBREAK_PieceBreak) { | 641 if (dwBreakStatus > FX_TXTBREAK_PieceBreak) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize; | 675 (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize; |
| 676 FX_FLOAT fLineStop = bVertical ? rect.left : rect.bottom(); | 676 FX_FLOAT fLineStop = bVertical ? rect.left : rect.bottom(); |
| 677 m_fLinePos = bVertical ? rect.right() : rect.top; | 677 m_fLinePos = bVertical ? rect.right() : rect.top; |
| 678 if (bVertical) { | 678 if (bVertical) { |
| 679 fLineStep = -fLineStep; | 679 fLineStep = -fLineStep; |
| 680 } | 680 } |
| 681 m_hotKeys.RemoveAll(); | 681 m_hotKeys.RemoveAll(); |
| 682 int32_t iStartChar = 0; | 682 int32_t iStartChar = 0; |
| 683 int32_t iChars = 0; | 683 int32_t iChars = 0; |
| 684 int32_t iPieceWidths = 0; | 684 int32_t iPieceWidths = 0; |
| 685 FX_DWORD dwBreakStatus; | 685 uint32_t dwBreakStatus; |
| 686 FX_WCHAR wch; | 686 FX_WCHAR wch; |
| 687 FX_BOOL bRet = FALSE; | 687 FX_BOOL bRet = FALSE; |
| 688 while (iTxtLength-- > 0) { | 688 while (iTxtLength-- > 0) { |
| 689 wch = *pwsStr++; | 689 wch = *pwsStr++; |
| 690 if (wch == L'&' && bHotKey && (pStr - 1) != NULL && *(pStr - 1) != L'&') { | 690 if (wch == L'&' && bHotKey && (pStr - 1) != NULL && *(pStr - 1) != L'&') { |
| 691 if (iTxtLength > 0) { | 691 if (iTxtLength > 0) { |
| 692 m_hotKeys.Add(iChars); | 692 m_hotKeys.Add(iChars); |
| 693 } | 693 } |
| 694 continue; | 694 continue; |
| 695 } | 695 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 719 } | 719 } |
| 720 } | 720 } |
| 721 dwBreakStatus = m_pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); | 721 dwBreakStatus = m_pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); |
| 722 if (dwBreakStatus > FX_TXTBREAK_PieceBreak && !bRet) { | 722 if (dwBreakStatus > FX_TXTBREAK_PieceBreak && !bRet) { |
| 723 RetriecePieces(dwBreakStatus, iStartChar, iPieceWidths, FALSE, rect); | 723 RetriecePieces(dwBreakStatus, iStartChar, iPieceWidths, FALSE, rect); |
| 724 } | 724 } |
| 725 m_pTxtBreak->ClearBreakPieces(); | 725 m_pTxtBreak->ClearBreakPieces(); |
| 726 m_pTxtBreak->Reset(); | 726 m_pTxtBreak->Reset(); |
| 727 m_wsText.ReleaseBuffer(iLength); | 727 m_wsText.ReleaseBuffer(iLength); |
| 728 } | 728 } |
| 729 FX_BOOL CFDE_TextOut::RetriecePieces(FX_DWORD dwBreakStatus, | 729 FX_BOOL CFDE_TextOut::RetriecePieces(uint32_t dwBreakStatus, |
| 730 int32_t& iStartChar, | 730 int32_t& iStartChar, |
| 731 int32_t& iPieceWidths, | 731 int32_t& iPieceWidths, |
| 732 FX_BOOL bReload, | 732 FX_BOOL bReload, |
| 733 const CFX_RectF& rect) { | 733 const CFX_RectF& rect) { |
| 734 FX_BOOL bSingleLine = !!(m_dwStyles & FDE_TTOSTYLE_SingleLine); | 734 FX_BOOL bSingleLine = !!(m_dwStyles & FDE_TTOSTYLE_SingleLine); |
| 735 FX_BOOL bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap); | 735 FX_BOOL bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap); |
| 736 FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); | 736 FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); |
| 737 FX_FLOAT fLineStep = | 737 FX_FLOAT fLineStep = |
| 738 (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize; | 738 (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize; |
| 739 if (bVertical) { | 739 if (bVertical) { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 } | 876 } |
| 877 void CFDE_TextOut::ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect) { | 877 void CFDE_TextOut::ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect) { |
| 878 const FX_WCHAR* pwsStr = (const FX_WCHAR*)m_wsText; | 878 const FX_WCHAR* pwsStr = (const FX_WCHAR*)m_wsText; |
| 879 FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); | 879 FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); |
| 880 int32_t iPieceWidths = 0; | 880 int32_t iPieceWidths = 0; |
| 881 FDE_LPTTOPIECE pPiece = pLine->GetPtrAt(0); | 881 FDE_LPTTOPIECE pPiece = pLine->GetPtrAt(0); |
| 882 int32_t iStartChar = pPiece->iStartChar; | 882 int32_t iStartChar = pPiece->iStartChar; |
| 883 m_fLinePos = bVertical ? pPiece->rtPiece.left : pPiece->rtPiece.top; | 883 m_fLinePos = bVertical ? pPiece->rtPiece.left : pPiece->rtPiece.top; |
| 884 int32_t iPieceCount = pLine->GetSize(); | 884 int32_t iPieceCount = pLine->GetSize(); |
| 885 int32_t iPieceIndex = 0; | 885 int32_t iPieceIndex = 0; |
| 886 FX_DWORD dwBreakStatus = 0; | 886 uint32_t dwBreakStatus = 0; |
| 887 FX_WCHAR wch; | 887 FX_WCHAR wch; |
| 888 while (iPieceIndex < iPieceCount) { | 888 while (iPieceIndex < iPieceCount) { |
| 889 int32_t iStar = iStartChar; | 889 int32_t iStar = iStartChar; |
| 890 int32_t iEnd = pPiece->iChars + iStar; | 890 int32_t iEnd = pPiece->iChars + iStar; |
| 891 while (iStar < iEnd) { | 891 while (iStar < iEnd) { |
| 892 wch = *(pwsStr + iStar); | 892 wch = *(pwsStr + iStar); |
| 893 dwBreakStatus = m_pTxtBreak->AppendChar(wch); | 893 dwBreakStatus = m_pTxtBreak->AppendChar(wch); |
| 894 if (dwBreakStatus > FX_TXTBREAK_PieceBreak) { | 894 if (dwBreakStatus > FX_TXTBREAK_PieceBreak) { |
| 895 RetriecePieces(dwBreakStatus, iStartChar, iPieceWidths, TRUE, rect); | 895 RetriecePieces(dwBreakStatus, iStartChar, iPieceWidths, TRUE, rect); |
| 896 } | 896 } |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1111 return NULL; | 1111 return NULL; |
| 1112 } | 1112 } |
| 1113 return m_pieces.GetPtrAt(index); | 1113 return m_pieces.GetPtrAt(index); |
| 1114 } | 1114 } |
| 1115 void CFDE_TTOLine::RemoveLast(int32_t iCount) { | 1115 void CFDE_TTOLine::RemoveLast(int32_t iCount) { |
| 1116 m_pieces.RemoveLast(iCount); | 1116 m_pieces.RemoveLast(iCount); |
| 1117 } | 1117 } |
| 1118 void CFDE_TTOLine::RemoveAll(FX_BOOL bLeaveMemory) { | 1118 void CFDE_TTOLine::RemoveAll(FX_BOOL bLeaveMemory) { |
| 1119 m_pieces.RemoveAll(bLeaveMemory); | 1119 m_pieces.RemoveAll(bLeaveMemory); |
| 1120 } | 1120 } |
| OLD | NEW |