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

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

Issue 1821043003: Remove FX_WORD in favor of uint16_t. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Use stdint.h directly, bitfield minefield. Created 4 years, 9 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/fxcodec/lgif/fx_gif.cpp ('k') | core/fxcrt/fx_basic_wstring.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 "core/fxcrt/fx_arabic.h" 7 #include "core/fxcrt/fx_arabic.h"
8 #include "core/include/fxcrt/fx_ucd.h" 8 #include "core/include/fxcrt/fx_ucd.h"
9 9
10 namespace { 10 namespace {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 143 }
144 } 144 }
145 return shadda; 145 return shadda;
146 } 146 }
147 147
148 IFX_ArabicChar* IFX_ArabicChar::Create() { 148 IFX_ArabicChar* IFX_ArabicChar::Create() {
149 return new CFX_ArabicChar; 149 return new CFX_ArabicChar;
150 } 150 }
151 FX_BOOL CFX_ArabicChar::IsArabicChar(FX_WCHAR wch) const { 151 FX_BOOL CFX_ArabicChar::IsArabicChar(FX_WCHAR wch) const {
152 FX_DWORD dwRet = 152 FX_DWORD dwRet =
153 kTextLayoutCodeProperties[(FX_WORD)wch] & FX_CHARTYPEBITSMASK; 153 kTextLayoutCodeProperties[(uint16_t)wch] & FX_CHARTYPEBITSMASK;
154 return dwRet >= FX_CHARTYPE_ArabicAlef; 154 return dwRet >= FX_CHARTYPE_ArabicAlef;
155 } 155 }
156 FX_BOOL CFX_ArabicChar::IsArabicFormChar(FX_WCHAR wch) const { 156 FX_BOOL CFX_ArabicChar::IsArabicFormChar(FX_WCHAR wch) const {
157 return (kTextLayoutCodeProperties[(FX_WORD)wch] & FX_CHARTYPEBITSMASK) == 157 return (kTextLayoutCodeProperties[(uint16_t)wch] & FX_CHARTYPEBITSMASK) ==
158 FX_CHARTYPE_ArabicForm; 158 FX_CHARTYPE_ArabicForm;
159 } 159 }
160 FX_WCHAR CFX_ArabicChar::GetFormChar(FX_WCHAR wch, 160 FX_WCHAR CFX_ArabicChar::GetFormChar(FX_WCHAR wch,
161 FX_WCHAR prev, 161 FX_WCHAR prev,
162 FX_WCHAR next) const { 162 FX_WCHAR next) const {
163 CFX_Char c(wch, kTextLayoutCodeProperties[(FX_WORD)wch]); 163 CFX_Char c(wch, kTextLayoutCodeProperties[(uint16_t)wch]);
164 CFX_Char p(prev, kTextLayoutCodeProperties[(FX_WORD)prev]); 164 CFX_Char p(prev, kTextLayoutCodeProperties[(uint16_t)prev]);
165 CFX_Char n(next, kTextLayoutCodeProperties[(FX_WORD)next]); 165 CFX_Char n(next, kTextLayoutCodeProperties[(uint16_t)next]);
166 return GetFormChar(&c, &p, &n); 166 return GetFormChar(&c, &p, &n);
167 } 167 }
168 FX_WCHAR CFX_ArabicChar::GetFormChar(const CFX_Char* cur, 168 FX_WCHAR CFX_ArabicChar::GetFormChar(const CFX_Char* cur,
169 const CFX_Char* prev, 169 const CFX_Char* prev,
170 const CFX_Char* next) const { 170 const CFX_Char* next) const {
171 FX_CHARTYPE eCur; 171 FX_CHARTYPE eCur;
172 FX_WCHAR wCur; 172 FX_WCHAR wCur;
173 const FX_ARBFORMTABLE* ft = ParseChar(cur, wCur, eCur); 173 const FX_ARBFORMTABLE* ft = ParseChar(cur, wCur, eCur);
174 if (eCur < FX_CHARTYPE_ArabicAlef || eCur >= FX_CHARTYPE_ArabicNormal) { 174 if (eCur < FX_CHARTYPE_ArabicAlef || eCur >= FX_CHARTYPE_ArabicNormal) {
175 return wCur; 175 return wCur;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 FX_BOOL bWS) { 255 FX_BOOL bWS) {
256 FXSYS_assert(wsText.GetLength() == classes.GetSize()); 256 FXSYS_assert(wsText.GetLength() == classes.GetSize());
257 int32_t iCount = wsText.GetLength(); 257 int32_t iCount = wsText.GetLength();
258 const FX_WCHAR* pwsStart = (const FX_WCHAR*)wsText; 258 const FX_WCHAR* pwsStart = (const FX_WCHAR*)wsText;
259 FX_WCHAR wch; 259 FX_WCHAR wch;
260 int32_t iCls; 260 int32_t iCls;
261 if (bWS) { 261 if (bWS) {
262 for (int32_t i = 0; i < iCount; i++) { 262 for (int32_t i = 0; i < iCount; i++) {
263 wch = *pwsStart++; 263 wch = *pwsStart++;
264 iCls = 264 iCls =
265 ((kTextLayoutCodeProperties[(FX_WORD)wch] & FX_BIDICLASSBITSMASK) >> 265 ((kTextLayoutCodeProperties[(uint16_t)wch] & FX_BIDICLASSBITSMASK) >>
266 FX_BIDICLASSBITS); 266 FX_BIDICLASSBITS);
267 classes.SetAt(i, iCls); 267 classes.SetAt(i, iCls);
268 } 268 }
269 } else { 269 } else {
270 for (int32_t i = 0; i < iCount; i++) { 270 for (int32_t i = 0; i < iCount; i++) {
271 wch = *pwsStart++; 271 wch = *pwsStart++;
272 iCls = 272 iCls =
273 ((kTextLayoutCodeProperties[(FX_WORD)wch] & FX_BIDICLASSBITSMASK) >> 273 ((kTextLayoutCodeProperties[(uint16_t)wch] & FX_BIDICLASSBITSMASK) >>
274 FX_BIDICLASSBITS); 274 FX_BIDICLASSBITS);
275 classes.SetAt(i, gc_FX_BidiNTypes[iCls]); 275 classes.SetAt(i, gc_FX_BidiNTypes[iCls]);
276 } 276 }
277 } 277 }
278 } 278 }
279 int32_t FX_BidiResolveExplicit(int32_t iBaseLevel, 279 int32_t FX_BidiResolveExplicit(int32_t iBaseLevel,
280 int32_t iDirection, 280 int32_t iDirection,
281 CFX_Int32Array& classes, 281 CFX_Int32Array& classes,
282 CFX_Int32Array& levels, 282 CFX_Int32Array& levels,
283 int32_t iStart, 283 int32_t iStart,
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 } 961 }
962 }; 962 };
963 void FX_BidiLine(CFX_TxtCharArray& chars, int32_t iCount, int32_t iBaseLevel) { 963 void FX_BidiLine(CFX_TxtCharArray& chars, int32_t iCount, int32_t iBaseLevel) {
964 CFX_BidiLineTemplate<CFX_TxtChar> blt; 964 CFX_BidiLineTemplate<CFX_TxtChar> blt;
965 blt.FX_BidiLine(chars, iCount, iBaseLevel); 965 blt.FX_BidiLine(chars, iCount, iBaseLevel);
966 } 966 }
967 void FX_BidiLine(CFX_RTFCharArray& chars, int32_t iCount, int32_t iBaseLevel) { 967 void FX_BidiLine(CFX_RTFCharArray& chars, int32_t iCount, int32_t iBaseLevel) {
968 CFX_BidiLineTemplate<CFX_RTFChar> blt; 968 CFX_BidiLineTemplate<CFX_RTFChar> blt;
969 blt.FX_BidiLine(chars, iCount, iBaseLevel); 969 blt.FX_BidiLine(chars, iCount, iBaseLevel);
970 } 970 }
OLDNEW
« no previous file with comments | « core/fxcodec/lgif/fx_gif.cpp ('k') | core/fxcrt/fx_basic_wstring.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698