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

Side by Side Diff: xfa/fee/fde_txtedtpage.cpp

Issue 1900743004: Store WideString, not raw pointer, in FX_TXTRUN (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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/tto/fde_textout.cpp ('k') | xfa/fgas/layout/fgas_textbreak.h » ('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/fee/fde_txtedtpage.h" 7 #include "xfa/fee/fde_txtedtpage.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 if (nLength < 1) { 74 if (nLength < 1) {
75 return 0; 75 return 0;
76 } 76 }
77 CFDE_TxtEdtEngine* pEngine = (CFDE_TxtEdtEngine*)(m_pPage->GetEngine()); 77 CFDE_TxtEdtEngine* pEngine = (CFDE_TxtEdtEngine*)(m_pPage->GetEngine());
78 const FDE_TXTEDTPARAMS* pTextParams = pEngine->GetEditParams(); 78 const FDE_TXTEDTPARAMS* pTextParams = pEngine->GetEditParams();
79 CFX_TxtBreak* pBreak = pEngine->GetTextBreak(); 79 CFX_TxtBreak* pBreak = pEngine->GetTextBreak();
80 uint32_t dwLayoutStyle = pBreak->GetLayoutStyles(); 80 uint32_t dwLayoutStyle = pBreak->GetLayoutStyles();
81 FX_TXTRUN tr; 81 FX_TXTRUN tr;
82 tr.pAccess = m_pPage; 82 tr.pAccess = m_pPage;
83 tr.pIdentity = (void*)hText; 83 tr.pIdentity = (void*)hText;
84 tr.pStr = NULL;
85 tr.pWidths = NULL;
86 tr.iLength = nLength; 84 tr.iLength = nLength;
87 tr.pFont = pTextParams->pFont; 85 tr.pFont = pTextParams->pFont;
88 tr.fFontSize = pTextParams->fFontSize; 86 tr.fFontSize = pTextParams->fFontSize;
89 tr.dwStyles = dwLayoutStyle; 87 tr.dwStyles = dwLayoutStyle;
90 tr.iCharRotation = pTextParams->nCharRotation; 88 tr.iCharRotation = pTextParams->nCharRotation;
91 tr.dwCharStyles = pPiece->dwCharStyles; 89 tr.dwCharStyles = pPiece->dwCharStyles;
92 tr.pRect = &(pPiece->rtPiece); 90 tr.pRect = &(pPiece->rtPiece);
93 tr.wLineBreakChar = pTextParams->wLineBreakChar; 91 tr.wLineBreakChar = pTextParams->wLineBreakChar;
94 return pBreak->GetDisplayPos(&tr, pCharPos, bCharCode, pWSForms); 92 return pBreak->GetDisplayPos(&tr, pCharPos, bCharCode, pWSForms);
95 } 93 }
(...skipping 11 matching lines...) Expand all
107 CFDE_TxtEdtEngine* pEngine = (CFDE_TxtEdtEngine*)(m_pPage->GetEngine()); 105 CFDE_TxtEdtEngine* pEngine = (CFDE_TxtEdtEngine*)(m_pPage->GetEngine());
108 int32_t nLength = pPiece->nCount; 106 int32_t nLength = pPiece->nCount;
109 if (nLength < 1) { 107 if (nLength < 1) {
110 return 0; 108 return 0;
111 } 109 }
112 const FDE_TXTEDTPARAMS* pTextParams = pEngine->GetEditParams(); 110 const FDE_TXTEDTPARAMS* pTextParams = pEngine->GetEditParams();
113 uint32_t dwLayoutStyle = pEngine->GetTextBreak()->GetLayoutStyles(); 111 uint32_t dwLayoutStyle = pEngine->GetTextBreak()->GetLayoutStyles();
114 FX_TXTRUN tr; 112 FX_TXTRUN tr;
115 tr.pAccess = m_pPage; 113 tr.pAccess = m_pPage;
116 tr.pIdentity = (void*)hText; 114 tr.pIdentity = (void*)hText;
117 tr.pStr = NULL;
118 tr.pWidths = NULL;
119 tr.iLength = nLength; 115 tr.iLength = nLength;
120 tr.pFont = pTextParams->pFont; 116 tr.pFont = pTextParams->pFont;
121 tr.fFontSize = pTextParams->fFontSize; 117 tr.fFontSize = pTextParams->fFontSize;
122 tr.dwStyles = dwLayoutStyle; 118 tr.dwStyles = dwLayoutStyle;
123 tr.iCharRotation = pTextParams->nCharRotation; 119 tr.iCharRotation = pTextParams->nCharRotation;
124 tr.dwCharStyles = pPiece->dwCharStyles; 120 tr.dwCharStyles = pPiece->dwCharStyles;
125 tr.pRect = &(pPiece->rtPiece); 121 tr.pRect = &(pPiece->rtPiece);
126 tr.wLineBreakChar = pTextParams->wLineBreakChar; 122 tr.wLineBreakChar = pTextParams->wLineBreakChar;
127 return pEngine->GetTextBreak()->GetCharRects(&tr, rtArray, bBBox); 123 return pEngine->GetTextBreak()->GetCharRects(&tr, rtArray, bBBox);
128 } 124 }
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 ptF.x = rtF.left; 637 ptF.x = rtF.left;
642 } else if (ptF.x >= rtF.right()) { 638 } else if (ptF.x >= rtF.right()) {
643 ptF.x = rtF.right() - fTolerance; 639 ptF.x = rtF.right() - fTolerance;
644 } 640 }
645 if (ptF.y < rtF.top) { 641 if (ptF.y < rtF.top) {
646 ptF.y = rtF.top; 642 ptF.y = rtF.top;
647 } else if (ptF.y >= rtF.bottom()) { 643 } else if (ptF.y >= rtF.bottom()) {
648 ptF.y = rtF.bottom() - fTolerance; 644 ptF.y = rtF.bottom() - fTolerance;
649 } 645 }
650 } 646 }
OLDNEW
« no previous file with comments | « xfa/fde/tto/fde_textout.cpp ('k') | xfa/fgas/layout/fgas_textbreak.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698