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

Side by Side Diff: xfa/fgas/layout/fgas_rtfbreak.cpp

Issue 2063463002: Trust the compiler to do array indexing and superclass promotion. (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 | « no previous file | xfa/fgas/layout/fgas_textbreak.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/fgas/layout/fgas_rtfbreak.h" 7 #include "xfa/fgas/layout/fgas_rtfbreak.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 while (iLength >= 0) { 983 while (iLength >= 0) {
984 pCur = pCharArray + iLength; 984 pCur = pCharArray + iLength;
985 nCodeProp = pCur->m_dwCharProps; 985 nCodeProp = pCur->m_dwCharProps;
986 nCur = nCodeProp & 0x003F; 986 nCur = nCodeProp & 0x003F;
987 FX_BOOL bNeedBreak = FALSE; 987 FX_BOOL bNeedBreak = FALSE;
988 if (nCur == FX_CBP_SP) { 988 if (nCur == FX_CBP_SP) {
989 bNeedBreak = !bSpaceBreak; 989 bNeedBreak = !bSpaceBreak;
990 if (nNext == FX_CBP_SP) { 990 if (nNext == FX_CBP_SP) {
991 eType = bSpaceBreak ? FX_LBT_DIRECT_BRK : FX_LBT_PROHIBITED_BRK; 991 eType = bSpaceBreak ? FX_LBT_DIRECT_BRK : FX_LBT_PROHIBITED_BRK;
992 } else { 992 } else {
993 eType = *((const FX_LINEBREAKTYPE*)gs_FX_LineBreak_PairTable + 993 eType = gs_FX_LineBreak_PairTable[nCur][nNext];
994 (nCur << 5) + nNext);
995 } 994 }
996 } else if (nCur == FX_CBP_TB) { 995 } else if (nCur == FX_CBP_TB) {
Lei Zhang 2016/06/10 21:40:47 This block looks identical to the one above. Merge
Tom Sepez 2016/06/10 21:56:57 Not quite. One sets bNeedBreak to !bSpaceBreak an
997 bNeedBreak = !bTabBreak; 996 bNeedBreak = !bTabBreak;
998 if (nNext == FX_CBP_TB) { 997 if (nNext == FX_CBP_TB) {
999 eType = bTabBreak ? FX_LBT_DIRECT_BRK : FX_LBT_PROHIBITED_BRK; 998 eType = bTabBreak ? FX_LBT_DIRECT_BRK : FX_LBT_PROHIBITED_BRK;
1000 } else { 999 } else {
1001 eType = *((const FX_LINEBREAKTYPE*)gs_FX_LineBreak_PairTable + 1000 eType = gs_FX_LineBreak_PairTable[nCur][nNext];
1002 (nCur << 5) + nNext);
1003 } 1001 }
1004 } else if (bNumberBreak && nCur == FX_CBP_NU && nNext == FX_CBP_NU) { 1002 } else if (bNumberBreak && nCur == FX_CBP_NU && nNext == FX_CBP_NU) {
1005 eType = FX_LBT_DIRECT_BRK; 1003 eType = FX_LBT_DIRECT_BRK;
1006 } else if (bInfixBreak && nCur == FX_CBP_IS && nNext == FX_CBP_IS) { 1004 } else if (bInfixBreak && nCur == FX_CBP_IS && nNext == FX_CBP_IS) {
Lei Zhang 2016/06/10 21:40:47 Merge with the one above.
Tom Sepez 2016/06/10 21:56:57 Done.
1007 eType = FX_LBT_DIRECT_BRK; 1005 eType = FX_LBT_DIRECT_BRK;
1008 } else { 1006 } else {
1009 if (nNext == FX_CBP_SP) { 1007 if (nNext == FX_CBP_SP) {
1010 eType = FX_LBT_PROHIBITED_BRK; 1008 eType = FX_LBT_PROHIBITED_BRK;
1011 } else { 1009 } else {
1012 eType = *((const FX_LINEBREAKTYPE*)gs_FX_LineBreak_PairTable + 1010 eType = gs_FX_LineBreak_PairTable[nCur][nNext];
1013 (nCur << 5) + nNext);
1014 } 1011 }
1015 } 1012 }
1016 if (bAllChars) { 1013 if (bAllChars) {
1017 pCur->m_nBreakType = eType; 1014 pCur->m_nBreakType = eType;
1018 } 1015 }
1019 if (!bOnlyBrk) { 1016 if (!bOnlyBrk) {
1020 iCharWidth = pCur->m_iCharWidth; 1017 iCharWidth = pCur->m_iCharWidth;
1021 FX_BOOL bBreak = FALSE; 1018 FX_BOOL bBreak = FALSE;
1022 if (nCur == FX_CBP_TB && bTabBreak) { 1019 if (nCur == FX_CBP_TB && bTabBreak) {
1023 bBreak = iCharWidth > 0 && iEndPos - iCharWidth <= m_iBoundaryEnd; 1020 bBreak = iCharWidth > 0 && iEndPos - iCharWidth <= m_iBoundaryEnd;
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1513 rtBBoxF.height = fHeight; 1510 rtBBoxF.height = fHeight;
1514 rtBBoxF.top = std::max(rtBBoxF.top, 0.0f); 1511 rtBBoxF.top = std::max(rtBBoxF.top, 0.0f);
1515 } 1512 }
1516 rtArray.SetAt(i, rtBBoxF); 1513 rtArray.SetAt(i, rtBBoxF);
1517 continue; 1514 continue;
1518 } 1515 }
1519 rtArray.SetAt(i, rect); 1516 rtArray.SetAt(i, rect);
1520 } 1517 }
1521 return iLength; 1518 return iLength;
1522 } 1519 }
OLDNEW
« no previous file with comments | « no previous file | xfa/fgas/layout/fgas_textbreak.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698