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

Side by Side Diff: xfa/fgas/layout/fgas_textbreak.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/fgas/layout/fgas_textbreak.h ('k') | no next file » | 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/fgas/layout/fgas_textbreak.h" 7 #include "xfa/fgas/layout/fgas_textbreak.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, 1167 int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
1168 FXTEXT_CHARPOS* pCharPos, 1168 FXTEXT_CHARPOS* pCharPos,
1169 FX_BOOL bCharCode, 1169 FX_BOOL bCharCode,
1170 CFX_WideString* pWSForms, 1170 CFX_WideString* pWSForms,
1171 FX_AdjustCharDisplayPos pAdjustPos) const { 1171 FX_AdjustCharDisplayPos pAdjustPos) const {
1172 if (pTxtRun == NULL || pTxtRun->iLength < 1) { 1172 if (pTxtRun == NULL || pTxtRun->iLength < 1) {
1173 return 0; 1173 return 0;
1174 } 1174 }
1175 IFX_TxtAccess* pAccess = pTxtRun->pAccess; 1175 IFX_TxtAccess* pAccess = pTxtRun->pAccess;
1176 void* pIdentity = pTxtRun->pIdentity; 1176 void* pIdentity = pTxtRun->pIdentity;
1177 const FX_WCHAR* pStr = pTxtRun->pStr; 1177 const FX_WCHAR* pStr = pTxtRun->wsStr.c_str();
1178 int32_t* pWidths = pTxtRun->pWidths; 1178 int32_t* pWidths = pTxtRun->pWidths;
1179 int32_t iLength = pTxtRun->iLength - 1; 1179 int32_t iLength = pTxtRun->iLength - 1;
1180 IFX_Font* pFont = pTxtRun->pFont; 1180 IFX_Font* pFont = pTxtRun->pFont;
1181 uint32_t dwStyles = pTxtRun->dwStyles; 1181 uint32_t dwStyles = pTxtRun->dwStyles;
1182 CFX_RectF rtText(*pTxtRun->pRect); 1182 CFX_RectF rtText(*pTxtRun->pRect);
1183 FX_BOOL bRTLPiece = 1183 FX_BOOL bRTLPiece =
1184 (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_OddBidiLevel) != 0; 1184 (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_OddBidiLevel) != 0;
1185 FX_BOOL bArabicNumber = 1185 FX_BOOL bArabicNumber =
1186 (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_ArabicNumber) != 0; 1186 (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_ArabicNumber) != 0;
1187 FX_BOOL bArabicComma = 1187 FX_BOOL bArabicComma =
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 return iCount; 1547 return iCount;
1548 } 1548 }
1549 int32_t CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun, 1549 int32_t CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun,
1550 CFX_RectFArray& rtArray, 1550 CFX_RectFArray& rtArray,
1551 FX_BOOL bCharBBox) const { 1551 FX_BOOL bCharBBox) const {
1552 if (pTxtRun == NULL || pTxtRun->iLength < 1) { 1552 if (pTxtRun == NULL || pTxtRun->iLength < 1) {
1553 return 0; 1553 return 0;
1554 } 1554 }
1555 IFX_TxtAccess* pAccess = pTxtRun->pAccess; 1555 IFX_TxtAccess* pAccess = pTxtRun->pAccess;
1556 void* pIdentity = pTxtRun->pIdentity; 1556 void* pIdentity = pTxtRun->pIdentity;
1557 const FX_WCHAR* pStr = pTxtRun->pStr; 1557 const FX_WCHAR* pStr = pTxtRun->wsStr.c_str();
1558 int32_t* pWidths = pTxtRun->pWidths; 1558 int32_t* pWidths = pTxtRun->pWidths;
1559 int32_t iLength = pTxtRun->iLength; 1559 int32_t iLength = pTxtRun->iLength;
1560 CFX_RectF rect(*pTxtRun->pRect); 1560 CFX_RectF rect(*pTxtRun->pRect);
1561 FX_BOOL bRTLPiece = 1561 FX_BOOL bRTLPiece =
1562 (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_OddBidiLevel) != 0; 1562 (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_OddBidiLevel) != 0;
1563 FX_FLOAT fFontSize = pTxtRun->fFontSize; 1563 FX_FLOAT fFontSize = pTxtRun->fFontSize;
1564 int32_t iFontSize = FXSYS_round(fFontSize * 20.0f); 1564 int32_t iFontSize = FXSYS_round(fFontSize * 20.0f);
1565 FX_FLOAT fScale = fFontSize / 1000.0f; 1565 FX_FLOAT fScale = fFontSize / 1000.0f;
1566 IFX_Font* pFont = pTxtRun->pFont; 1566 IFX_Font* pFont = pTxtRun->pFont;
1567 if (pFont == NULL) { 1567 if (pFont == NULL) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1650 rtBBoxF.height = fHeight; 1650 rtBBoxF.height = fHeight;
1651 rtBBoxF.top = std::max(rtBBoxF.top, 0.0f); 1651 rtBBoxF.top = std::max(rtBBoxF.top, 0.0f);
1652 } 1652 }
1653 rtArray.SetAt(i, rtBBoxF); 1653 rtArray.SetAt(i, rtBBoxF);
1654 continue; 1654 continue;
1655 } 1655 }
1656 rtArray.SetAt(i, rect); 1656 rtArray.SetAt(i, rect);
1657 } 1657 }
1658 return iLength; 1658 return iLength;
1659 } 1659 }
OLDNEW
« no previous file with comments | « xfa/fgas/layout/fgas_textbreak.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698