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

Side by Side Diff: core/src/fxcrt/fx_arabic.cpp

Issue 1252613002: FX_BOOL considered harmful. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Manual edits. Created 5 years, 5 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 | « core/src/fxcrt/fx_arabic.h ('k') | core/src/fxcrt/fx_basic_array.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 "../../include/fxcrt/fx_ucd.h" 7 #include "../../include/fxcrt/fx_ucd.h"
8 #include "fx_arabic.h" 8 #include "fx_arabic.h"
9 9
10 extern const FX_DWORD gs_FX_TextLayout_CodeProperties[65536]; 10 extern const FX_DWORD gs_FX_TextLayout_CodeProperties[65536];
11 IFX_BidiChar* IFX_BidiChar::Create() 11 IFX_BidiChar* IFX_BidiChar::Create()
12 { 12 {
13 return new CFX_BidiChar; 13 return new CFX_BidiChar;
14 } 14 }
15 CFX_BidiChar::CFX_BidiChar() 15 CFX_BidiChar::CFX_BidiChar()
16 : m_bSeparateNeutral(TRUE) 16 : m_bSeparateNeutral(true)
17 , m_iCurStart(0) 17 , m_iCurStart(0)
18 , m_iCurCount(0) 18 , m_iCurCount(0)
19 , m_iCurBidi(0) 19 , m_iCurBidi(0)
20 , m_iLastBidi(0) 20 , m_iLastBidi(0)
21 , m_iLastStart(0) 21 , m_iLastStart(0)
22 , m_iLastCount(0) 22 , m_iLastCount(0)
23 { 23 {
24 } 24 }
25 void CFX_BidiChar::SetPolicy(FX_BOOL bSeparateNeutral) 25 void CFX_BidiChar::SetPolicy(bool bSeparateNeutral)
26 { 26 {
27 m_bSeparateNeutral = bSeparateNeutral; 27 m_bSeparateNeutral = bSeparateNeutral;
28 } 28 }
29 29
30 FX_BOOL CFX_BidiChar::AppendChar(FX_WCHAR wch) 30 bool CFX_BidiChar::AppendChar(FX_WCHAR wch)
31 { 31 {
32 FX_DWORD dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch]; 32 FX_DWORD dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch];
33 int32_t iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; 33 int32_t iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS;
34 int32_t iContext = 0; 34 int32_t iContext = 0;
35 switch (iBidiCls) { 35 switch (iBidiCls) {
36 case FX_BIDICLASS_L: 36 case FX_BIDICLASS_L:
37 case FX_BIDICLASS_AN: 37 case FX_BIDICLASS_AN:
38 case FX_BIDICLASS_EN: 38 case FX_BIDICLASS_EN:
39 iContext = 1; 39 iContext = 1;
40 break; 40 break;
41 case FX_BIDICLASS_R: 41 case FX_BIDICLASS_R:
42 case FX_BIDICLASS_AL: 42 case FX_BIDICLASS_AL:
43 iContext = 2; 43 iContext = 2;
44 break; 44 break;
45 } 45 }
46 FX_BOOL bRet = FALSE; 46 bool bRet = false;
47 if (iContext != m_iCurBidi) { 47 if (iContext != m_iCurBidi) {
48 if (m_bSeparateNeutral) { 48 if (m_bSeparateNeutral) {
49 bRet = TRUE; 49 bRet = true;
50 } else { 50 } else {
51 if (m_iCurBidi == 0) { 51 if (m_iCurBidi == 0) {
52 bRet = (m_iCurCount > 0); 52 bRet = (m_iCurCount > 0);
53 } else { 53 } else {
54 bRet = (iContext != 0); 54 bRet = (iContext != 0);
55 } 55 }
56 } 56 }
57 if (bRet) { 57 if (bRet) {
58 m_iLastBidi = m_iCurBidi; 58 m_iLastBidi = m_iCurBidi;
59 m_iLastStart = m_iCurStart; 59 m_iLastStart = m_iCurStart;
60 m_iCurStart = m_iCurCount; 60 m_iCurStart = m_iCurCount;
61 m_iLastCount = m_iCurCount - m_iLastStart; 61 m_iLastCount = m_iCurCount - m_iLastStart;
62 } 62 }
63 if (m_bSeparateNeutral || iContext != 0) { 63 if (m_bSeparateNeutral || iContext != 0) {
64 m_iCurBidi = iContext; 64 m_iCurBidi = iContext;
65 } 65 }
66 } 66 }
67 m_iCurCount ++; 67 m_iCurCount ++;
68 return bRet; 68 return bRet;
69 } 69 }
70 FX_BOOL CFX_BidiChar::EndChar() 70 bool CFX_BidiChar::EndChar()
71 { 71 {
72 m_iLastBidi = m_iCurBidi; 72 m_iLastBidi = m_iCurBidi;
73 m_iLastStart = m_iCurStart; 73 m_iLastStart = m_iCurStart;
74 m_iCurStart = m_iCurCount; 74 m_iCurStart = m_iCurCount;
75 m_iLastCount = m_iCurCount - m_iLastStart; 75 m_iLastCount = m_iCurCount - m_iLastStart;
76 return m_iLastCount > 0; 76 return m_iLastCount > 0;
77 } 77 }
78 int32_t CFX_BidiChar::GetBidiInfo(int32_t &iStart, int32_t &iCount) 78 int32_t CFX_BidiChar::GetBidiInfo(int32_t &iStart, int32_t &iCount)
79 { 79 {
80 iStart = m_iLastStart; 80 iStart = m_iLastStart;
81 iCount = m_iLastCount; 81 iCount = m_iLastCount;
82 return m_iLastBidi; 82 return m_iLastBidi;
83 } 83 }
84 void CFX_BidiChar::Reset() 84 void CFX_BidiChar::Reset()
85 { 85 {
86 m_iCurStart = 0; 86 m_iCurStart = 0;
87 m_iCurCount = 0; 87 m_iCurCount = 0;
88 m_iCurBidi = 0; 88 m_iCurBidi = 0;
89 m_iLastBidi = 0; 89 m_iLastBidi = 0;
90 m_iLastStart = 0; 90 m_iLastStart = 0;
91 m_iLastCount = 0; 91 m_iLastCount = 0;
92 } 92 }
OLDNEW
« no previous file with comments | « core/src/fxcrt/fx_arabic.h ('k') | core/src/fxcrt/fx_basic_array.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698