Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Side by Side Diff: xfa/fde/tto/fde_textout.cpp

Issue 2037863002: Remove FDE_HDEVICESTATE handle type (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fde/fde_render.cpp ('k') | xfa/fxfa/app/xfa_textlayout.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 if (!m_pRenderDevice) 772 if (!m_pRenderDevice)
773 return; 773 return;
774 774
775 int32_t iLines = m_ttoLines.GetSize(); 775 int32_t iLines = m_ttoLines.GetSize();
776 if (iLines < 1) 776 if (iLines < 1)
777 return; 777 return;
778 778
779 CFDE_Brush* pBrush = new CFDE_Brush; 779 CFDE_Brush* pBrush = new CFDE_Brush;
780 pBrush->SetColor(m_TxtColor); 780 pBrush->SetColor(m_TxtColor);
781 CFDE_Pen* pPen = NULL; 781 CFDE_Pen* pPen = NULL;
782 FDE_HDEVICESTATE hDev = m_pRenderDevice->SaveState(); 782 m_pRenderDevice->SaveState();
783 if (rtClip.Width() > 0.0f && rtClip.Height() > 0.0f) { 783 if (rtClip.Width() > 0.0f && rtClip.Height() > 0.0f) {
784 m_pRenderDevice->SetClipRect(rtClip); 784 m_pRenderDevice->SetClipRect(rtClip);
785 } 785 }
786 for (int32_t i = 0; i < iLines; i++) { 786 for (int32_t i = 0; i < iLines; i++) {
787 CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(i); 787 CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(i);
788 int32_t iPieces = pLine->GetSize(); 788 int32_t iPieces = pLine->GetSize();
789 for (int32_t j = 0; j < iPieces; j++) { 789 for (int32_t j = 0; j < iPieces; j++) {
790 FDE_TTOPIECE* pPiece = pLine->GetPtrAt(j); 790 FDE_TTOPIECE* pPiece = pLine->GetPtrAt(j);
791 if (pPiece == NULL) { 791 if (pPiece == NULL) {
792 continue; 792 continue;
793 } 793 }
794 int32_t iCount = GetDisplayPos(pPiece); 794 int32_t iCount = GetDisplayPos(pPiece);
795 if (iCount > 0) { 795 if (iCount > 0) {
796 m_pRenderDevice->DrawString(pBrush, m_pFont, m_pCharPos, iCount, 796 m_pRenderDevice->DrawString(pBrush, m_pFont, m_pCharPos, iCount,
797 m_fFontSize, &m_Matrix); 797 m_fFontSize, &m_Matrix);
798 } 798 }
799 DrawLine(pPiece, pPen); 799 DrawLine(pPiece, pPen);
800 } 800 }
801 } 801 }
802 m_pRenderDevice->RestoreState(hDev); 802 m_pRenderDevice->RestoreState();
803 delete pBrush; 803 delete pBrush;
804 delete pPen; 804 delete pPen;
805 } 805 }
806 806
807 int32_t CFDE_TextOut::GetDisplayPos(FDE_TTOPIECE* pPiece) { 807 int32_t CFDE_TextOut::GetDisplayPos(FDE_TTOPIECE* pPiece) {
808 FX_TXTRUN tr = ToTextRun(pPiece); 808 FX_TXTRUN tr = ToTextRun(pPiece);
809 ExpandBuffer(tr.iLength, 2); 809 ExpandBuffer(tr.iLength, 2);
810 return m_pTxtBreak->GetDisplayPos(&tr, m_pCharPos); 810 return m_pTxtBreak->GetDisplayPos(&tr, m_pCharPos);
811 } 811 }
812 812
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 return NULL; 935 return NULL;
936 } 936 }
937 return m_pieces.GetPtrAt(index); 937 return m_pieces.GetPtrAt(index);
938 } 938 }
939 void CFDE_TTOLine::RemoveLast(int32_t iCount) { 939 void CFDE_TTOLine::RemoveLast(int32_t iCount) {
940 m_pieces.RemoveLast(iCount); 940 m_pieces.RemoveLast(iCount);
941 } 941 }
942 void CFDE_TTOLine::RemoveAll(FX_BOOL bLeaveMemory) { 942 void CFDE_TTOLine::RemoveAll(FX_BOOL bLeaveMemory) {
943 m_pieces.RemoveAll(bLeaveMemory); 943 m_pieces.RemoveAll(bLeaveMemory);
944 } 944 }
OLDNEW
« no previous file with comments | « xfa/fde/fde_render.cpp ('k') | xfa/fxfa/app/xfa_textlayout.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698