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

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

Issue 453133004: clang-format all code (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 4 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
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_ext.h" 7 #include "../../include/fxcrt/fx_ext.h"
8 #include "fx_arabic.h" 8 #include "fx_arabic.h"
9 extern const FX_DWORD gs_FX_TextLayout_CodeProperties[65536]; 9 extern const FX_DWORD gs_FX_TextLayout_CodeProperties[65536];
10 IFX_BidiChar* IFX_BidiChar::Create() 10 IFX_BidiChar* IFX_BidiChar::Create() {
11 { 11 return FX_NEW CFX_BidiChar;
12 return FX_NEW CFX_BidiChar;
13 } 12 }
14 CFX_BidiChar::CFX_BidiChar() 13 CFX_BidiChar::CFX_BidiChar()
15 : m_bSeparateNeutral(TRUE) 14 : m_bSeparateNeutral(TRUE),
16 , m_iCurStart(0) 15 m_iCurStart(0),
17 , m_iCurCount(0) 16 m_iCurCount(0),
18 , m_iCurBidi(0) 17 m_iCurBidi(0),
19 , m_iLastBidi(0) 18 m_iLastBidi(0),
20 , m_iLastStart(0) 19 m_iLastStart(0),
21 , m_iLastCount(0) 20 m_iLastCount(0) {
22 {
23 } 21 }
24 FX_BOOL CFX_BidiChar::AppendChar(FX_WCHAR wch) 22 FX_BOOL CFX_BidiChar::AppendChar(FX_WCHAR wch) {
25 { 23 FX_DWORD dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch];
26 FX_DWORD dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch]; 24 FX_INT32 iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS;
27 FX_INT32 iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; 25 FX_INT32 iContext = 0;
28 FX_INT32 iContext = 0; 26 switch (iBidiCls) {
29 switch (iBidiCls) { 27 case FX_BIDICLASS_L:
30 case FX_BIDICLASS_L: 28 case FX_BIDICLASS_AN:
31 case FX_BIDICLASS_AN: 29 case FX_BIDICLASS_EN:
32 case FX_BIDICLASS_EN: 30 iContext = 1;
33 iContext = 1; 31 break;
34 break; 32 case FX_BIDICLASS_R:
35 case FX_BIDICLASS_R: 33 case FX_BIDICLASS_AL:
36 case FX_BIDICLASS_AL: 34 iContext = 2;
37 iContext = 2; 35 break;
38 break; 36 }
37 FX_BOOL bRet = FALSE;
38 if (iContext != m_iCurBidi) {
39 if (m_bSeparateNeutral) {
40 bRet = TRUE;
41 } else {
42 if (m_iCurBidi == 0) {
43 bRet = (m_iCurCount > 0);
44 } else {
45 bRet = (iContext != 0);
46 }
39 } 47 }
40 FX_BOOL bRet = FALSE; 48 if (bRet) {
41 if (iContext != m_iCurBidi) { 49 m_iLastBidi = m_iCurBidi;
42 if (m_bSeparateNeutral) { 50 m_iLastStart = m_iCurStart;
43 bRet = TRUE; 51 m_iCurStart = m_iCurCount;
44 } else { 52 m_iLastCount = m_iCurCount - m_iLastStart;
45 if (m_iCurBidi == 0) {
46 bRet = (m_iCurCount > 0);
47 } else {
48 bRet = (iContext != 0);
49 }
50 }
51 if (bRet) {
52 m_iLastBidi = m_iCurBidi;
53 m_iLastStart = m_iCurStart;
54 m_iCurStart = m_iCurCount;
55 m_iLastCount = m_iCurCount - m_iLastStart;
56 }
57 if (m_bSeparateNeutral || iContext != 0) {
58 m_iCurBidi = iContext;
59 }
60 } 53 }
61 m_iCurCount ++; 54 if (m_bSeparateNeutral || iContext != 0) {
62 return bRet; 55 m_iCurBidi = iContext;
56 }
57 }
58 m_iCurCount++;
59 return bRet;
63 } 60 }
64 FX_BOOL CFX_BidiChar::EndChar() 61 FX_BOOL CFX_BidiChar::EndChar() {
65 { 62 m_iLastBidi = m_iCurBidi;
66 m_iLastBidi = m_iCurBidi; 63 m_iLastStart = m_iCurStart;
67 m_iLastStart = m_iCurStart; 64 m_iCurStart = m_iCurCount;
68 m_iCurStart = m_iCurCount; 65 m_iLastCount = m_iCurCount - m_iLastStart;
69 m_iLastCount = m_iCurCount - m_iLastStart; 66 return m_iLastCount > 0;
70 return m_iLastCount > 0;
71 } 67 }
72 FX_INT32 CFX_BidiChar::GetBidiInfo(FX_INT32 &iStart, FX_INT32 &iCount) 68 FX_INT32 CFX_BidiChar::GetBidiInfo(FX_INT32& iStart, FX_INT32& iCount) {
73 { 69 iStart = m_iLastStart;
74 iStart = m_iLastStart; 70 iCount = m_iLastCount;
75 iCount = m_iLastCount; 71 return m_iLastBidi;
76 return m_iLastBidi;
77 } 72 }
78 void CFX_BidiChar::Reset() 73 void CFX_BidiChar::Reset() {
79 { 74 m_iCurStart = 0;
80 m_iCurStart = 0; 75 m_iCurCount = 0;
81 m_iCurCount = 0; 76 m_iCurBidi = 0;
82 m_iCurBidi = 0; 77 m_iLastBidi = 0;
83 m_iLastBidi = 0; 78 m_iLastStart = 0;
84 m_iLastStart = 0; 79 m_iLastCount = 0;
85 m_iLastCount = 0;
86 } 80 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698