| 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 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 if (!m_pRenderDevice) | 768 if (!m_pRenderDevice) |
| 769 return; | 769 return; |
| 770 | 770 |
| 771 int32_t iLines = m_ttoLines.GetSize(); | 771 int32_t iLines = m_ttoLines.GetSize(); |
| 772 if (iLines < 1) | 772 if (iLines < 1) |
| 773 return; | 773 return; |
| 774 | 774 |
| 775 CFDE_Brush* pBrush = new CFDE_Brush; | 775 CFDE_Brush* pBrush = new CFDE_Brush; |
| 776 pBrush->SetColor(m_TxtColor); | 776 pBrush->SetColor(m_TxtColor); |
| 777 CFDE_Pen* pPen = NULL; | 777 CFDE_Pen* pPen = NULL; |
| 778 FDE_HDEVICESTATE hDev = m_pRenderDevice->SaveState(); | 778 m_pRenderDevice->SaveState(); |
| 779 if (rtClip.Width() > 0.0f && rtClip.Height() > 0.0f) { | 779 if (rtClip.Width() > 0.0f && rtClip.Height() > 0.0f) { |
| 780 m_pRenderDevice->SetClipRect(rtClip); | 780 m_pRenderDevice->SetClipRect(rtClip); |
| 781 } | 781 } |
| 782 for (int32_t i = 0; i < iLines; i++) { | 782 for (int32_t i = 0; i < iLines; i++) { |
| 783 CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(i); | 783 CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(i); |
| 784 int32_t iPieces = pLine->GetSize(); | 784 int32_t iPieces = pLine->GetSize(); |
| 785 for (int32_t j = 0; j < iPieces; j++) { | 785 for (int32_t j = 0; j < iPieces; j++) { |
| 786 FDE_TTOPIECE* pPiece = pLine->GetPtrAt(j); | 786 FDE_TTOPIECE* pPiece = pLine->GetPtrAt(j); |
| 787 if (pPiece == NULL) { | 787 if (pPiece == NULL) { |
| 788 continue; | 788 continue; |
| 789 } | 789 } |
| 790 int32_t iCount = GetDisplayPos(pPiece); | 790 int32_t iCount = GetDisplayPos(pPiece); |
| 791 if (iCount > 0) { | 791 if (iCount > 0) { |
| 792 m_pRenderDevice->DrawString(pBrush, m_pFont, m_pCharPos, iCount, | 792 m_pRenderDevice->DrawString(pBrush, m_pFont, m_pCharPos, iCount, |
| 793 m_fFontSize, &m_Matrix); | 793 m_fFontSize, &m_Matrix); |
| 794 } | 794 } |
| 795 DrawLine(pPiece, pPen); | 795 DrawLine(pPiece, pPen); |
| 796 } | 796 } |
| 797 } | 797 } |
| 798 m_pRenderDevice->RestoreState(hDev); | 798 m_pRenderDevice->RestoreState(); |
| 799 delete pBrush; | 799 delete pBrush; |
| 800 delete pPen; | 800 delete pPen; |
| 801 } | 801 } |
| 802 | 802 |
| 803 int32_t CFDE_TextOut::GetDisplayPos(FDE_TTOPIECE* pPiece) { | 803 int32_t CFDE_TextOut::GetDisplayPos(FDE_TTOPIECE* pPiece) { |
| 804 FX_TXTRUN tr = ToTextRun(pPiece); | 804 FX_TXTRUN tr = ToTextRun(pPiece); |
| 805 ExpandBuffer(tr.iLength, 2); | 805 ExpandBuffer(tr.iLength, 2); |
| 806 return m_pTxtBreak->GetDisplayPos(&tr, m_pCharPos); | 806 return m_pTxtBreak->GetDisplayPos(&tr, m_pCharPos); |
| 807 } | 807 } |
| 808 | 808 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 return NULL; | 931 return NULL; |
| 932 } | 932 } |
| 933 return m_pieces.GetPtrAt(index); | 933 return m_pieces.GetPtrAt(index); |
| 934 } | 934 } |
| 935 void CFDE_TTOLine::RemoveLast(int32_t iCount) { | 935 void CFDE_TTOLine::RemoveLast(int32_t iCount) { |
| 936 m_pieces.RemoveLast(iCount); | 936 m_pieces.RemoveLast(iCount); |
| 937 } | 937 } |
| 938 void CFDE_TTOLine::RemoveAll(FX_BOOL bLeaveMemory) { | 938 void CFDE_TTOLine::RemoveAll(FX_BOOL bLeaveMemory) { |
| 939 m_pieces.RemoveAll(bLeaveMemory); | 939 m_pieces.RemoveAll(bLeaveMemory); |
| 940 } | 940 } |
| OLD | NEW |