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

Side by Side Diff: xfa/src/fxbarcode/datamatrix/BC_DataMatrixBitMatrixParser.cpp

Issue 1172793002: Merge to XFA: Use stdint.h types throughout PDFium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 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
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 // Original code is licensed as follows: 6 // Original code is licensed as follows:
7 /* 7 /*
8 * Copyright 2007 ZXing authors 8 * Copyright 2007 ZXing authors
9 * 9 *
10 * Licensed under the Apache License, Version 2.0 (the "License"); 10 * Licensed under the Apache License, Version 2.0 (the "License");
(...skipping 12 matching lines...) Expand all
23 #include "../barcode.h" 23 #include "../barcode.h"
24 #include "../common/BC_CommonBitMatrix.h" 24 #include "../common/BC_CommonBitMatrix.h"
25 #include "BC_DataMatrixVersion.h" 25 #include "BC_DataMatrixVersion.h"
26 #include "BC_DataMatrixBitMatrixParser.h" 26 #include "BC_DataMatrixBitMatrixParser.h"
27 CBC_DataMatrixBitMatrixParser::CBC_DataMatrixBitMatrixParser() 27 CBC_DataMatrixBitMatrixParser::CBC_DataMatrixBitMatrixParser()
28 { 28 {
29 m_mappingBitMatrix = NULL; 29 m_mappingBitMatrix = NULL;
30 m_version = NULL; 30 m_version = NULL;
31 m_readMappingMatrix = NULL; 31 m_readMappingMatrix = NULL;
32 } 32 }
33 void CBC_DataMatrixBitMatrixParser::Init(CBC_CommonBitMatrix *bitMatrix, FX_INT3 2 &e) 33 void CBC_DataMatrixBitMatrixParser::Init(CBC_CommonBitMatrix *bitMatrix, int32_t &e)
34 { 34 {
35 FX_INT32 dimension = bitMatrix->GetHeight(); 35 int32_t dimension = bitMatrix->GetHeight();
36 if (dimension < 8 || dimension > 144 || (dimension & 0x01) != 0) { 36 if (dimension < 8 || dimension > 144 || (dimension & 0x01) != 0) {
37 e = BCExceptionFormatException; 37 e = BCExceptionFormatException;
38 return; 38 return;
39 } 39 }
40 m_version = ReadVersion(bitMatrix, e); 40 m_version = ReadVersion(bitMatrix, e);
41 BC_EXCEPTION_CHECK_ReturnVoid(e); 41 BC_EXCEPTION_CHECK_ReturnVoid(e);
42 m_mappingBitMatrix = ExtractDataRegion(bitMatrix, e); 42 m_mappingBitMatrix = ExtractDataRegion(bitMatrix, e);
43 BC_EXCEPTION_CHECK_ReturnVoid(e); 43 BC_EXCEPTION_CHECK_ReturnVoid(e);
44 m_readMappingMatrix = FX_NEW CBC_CommonBitMatrix(); 44 m_readMappingMatrix = FX_NEW CBC_CommonBitMatrix();
45 m_readMappingMatrix->Init(m_mappingBitMatrix->GetWidth(), m_mappingBitMatrix ->GetHeight()); 45 m_readMappingMatrix->Init(m_mappingBitMatrix->GetWidth(), m_mappingBitMatrix ->GetHeight());
46 } 46 }
47 CBC_DataMatrixBitMatrixParser::~CBC_DataMatrixBitMatrixParser() 47 CBC_DataMatrixBitMatrixParser::~CBC_DataMatrixBitMatrixParser()
48 { 48 {
49 if(m_mappingBitMatrix != NULL) { 49 if(m_mappingBitMatrix != NULL) {
50 delete m_mappingBitMatrix; 50 delete m_mappingBitMatrix;
51 } 51 }
52 m_mappingBitMatrix = NULL; 52 m_mappingBitMatrix = NULL;
53 if(m_readMappingMatrix != NULL) { 53 if(m_readMappingMatrix != NULL) {
54 delete m_readMappingMatrix; 54 delete m_readMappingMatrix;
55 } 55 }
56 m_readMappingMatrix = NULL; 56 m_readMappingMatrix = NULL;
57 } 57 }
58 CBC_DataMatrixVersion *CBC_DataMatrixBitMatrixParser::GetVersion() 58 CBC_DataMatrixVersion *CBC_DataMatrixBitMatrixParser::GetVersion()
59 { 59 {
60 return m_version; 60 return m_version;
61 } 61 }
62 CBC_DataMatrixVersion *CBC_DataMatrixBitMatrixParser::ReadVersion(CBC_CommonBitM atrix *bitMatrix, FX_INT32 &e) 62 CBC_DataMatrixVersion *CBC_DataMatrixBitMatrixParser::ReadVersion(CBC_CommonBitM atrix *bitMatrix, int32_t &e)
63 { 63 {
64 FX_INT32 rows = bitMatrix->GetHeight(); 64 int32_t rows = bitMatrix->GetHeight();
65 FX_INT32 columns = bitMatrix->GetWidth(); 65 int32_t columns = bitMatrix->GetWidth();
66 CBC_DataMatrixVersion *temp = CBC_DataMatrixVersion::GetVersionForDimensions (rows, columns, e); 66 CBC_DataMatrixVersion *temp = CBC_DataMatrixVersion::GetVersionForDimensions (rows, columns, e);
67 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); 67 BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
68 return temp; 68 return temp;
69 } 69 }
70 CFX_ByteArray *CBC_DataMatrixBitMatrixParser::ReadCodewords(FX_INT32 &e) 70 CFX_ByteArray *CBC_DataMatrixBitMatrixParser::ReadCodewords(int32_t &e)
71 { 71 {
72 CBC_AutoPtr<CFX_ByteArray> result(FX_NEW CFX_ByteArray()); 72 CBC_AutoPtr<CFX_ByteArray> result(FX_NEW CFX_ByteArray());
73 result->SetSize(m_version->GetTotalCodewords()); 73 result->SetSize(m_version->GetTotalCodewords());
74 FX_INT32 resultOffset = 0; 74 int32_t resultOffset = 0;
75 FX_INT32 row = 4; 75 int32_t row = 4;
76 FX_INT32 column = 0; 76 int32_t column = 0;
77 FX_INT32 numRows = m_mappingBitMatrix->GetHeight(); 77 int32_t numRows = m_mappingBitMatrix->GetHeight();
78 FX_INT32 numColumns = m_mappingBitMatrix->GetWidth(); 78 int32_t numColumns = m_mappingBitMatrix->GetWidth();
79 FX_BOOL corner1Read = FALSE; 79 FX_BOOL corner1Read = FALSE;
80 FX_BOOL corner2Read = FALSE; 80 FX_BOOL corner2Read = FALSE;
81 FX_BOOL corner3Read = FALSE; 81 FX_BOOL corner3Read = FALSE;
82 FX_BOOL corner4Read = FALSE; 82 FX_BOOL corner4Read = FALSE;
83 do { 83 do {
84 if ((row == numRows) && (column == 0) && !corner1Read) { 84 if ((row == numRows) && (column == 0) && !corner1Read) {
85 (*result)[resultOffset++] = (FX_BYTE) ReadCorner1(numRows, numColumn s); 85 (*result)[resultOffset++] = (uint8_t) ReadCorner1(numRows, numColumn s);
86 row -= 2; 86 row -= 2;
87 column += 2; 87 column += 2;
88 corner1Read = TRUE; 88 corner1Read = TRUE;
89 } else if ((row == numRows - 2) && (column == 0) && ((numColumns & 0x03) != 0) && !corner2Read) { 89 } else if ((row == numRows - 2) && (column == 0) && ((numColumns & 0x03) != 0) && !corner2Read) {
90 (*result)[resultOffset++] = (FX_BYTE) ReadCorner2(numRows, numColumn s); 90 (*result)[resultOffset++] = (uint8_t) ReadCorner2(numRows, numColumn s);
91 row -= 2; 91 row -= 2;
92 column += 2; 92 column += 2;
93 corner2Read = TRUE; 93 corner2Read = TRUE;
94 } else if ((row == numRows + 4) && (column == 2) && ((numColumns & 0x07) == 0) && !corner3Read) { 94 } else if ((row == numRows + 4) && (column == 2) && ((numColumns & 0x07) == 0) && !corner3Read) {
95 (*result)[resultOffset++] = (FX_BYTE) ReadCorner3(numRows, numColumn s); 95 (*result)[resultOffset++] = (uint8_t) ReadCorner3(numRows, numColumn s);
96 row -= 2; 96 row -= 2;
97 column += 2; 97 column += 2;
98 corner3Read = TRUE; 98 corner3Read = TRUE;
99 } else if ((row == numRows - 2) && (column == 0) && ((numColumns & 0x07) == 4) && !corner4Read) { 99 } else if ((row == numRows - 2) && (column == 0) && ((numColumns & 0x07) == 4) && !corner4Read) {
100 (*result)[resultOffset++] = (FX_BYTE) ReadCorner4(numRows, numColumn s); 100 (*result)[resultOffset++] = (uint8_t) ReadCorner4(numRows, numColumn s);
101 row -= 2; 101 row -= 2;
102 column += 2; 102 column += 2;
103 corner4Read = TRUE; 103 corner4Read = TRUE;
104 } else { 104 } else {
105 do { 105 do {
106 if ((row < numRows) && (column >= 0) && !m_readMappingMatrix->Ge t(column, row)) { 106 if ((row < numRows) && (column >= 0) && !m_readMappingMatrix->Ge t(column, row)) {
107 if (resultOffset < (*result).GetSize() ) { 107 if (resultOffset < (*result).GetSize() ) {
108 (*result)[resultOffset++] = (FX_BYTE) ReadUtah(row, colu mn, numRows, numColumns); 108 (*result)[resultOffset++] = (uint8_t) ReadUtah(row, colu mn, numRows, numColumns);
109 } 109 }
110 } 110 }
111 row -= 2; 111 row -= 2;
112 column += 2; 112 column += 2;
113 } while ((row >= 0) && (column < numColumns)); 113 } while ((row >= 0) && (column < numColumns));
114 row += 1; 114 row += 1;
115 column += 3; 115 column += 3;
116 do { 116 do {
117 if ((row >= 0) && (column < numColumns) && !m_readMappingMatrix- >Get(column, row)) { 117 if ((row >= 0) && (column < numColumns) && !m_readMappingMatrix- >Get(column, row)) {
118 if (resultOffset < (*result).GetSize() ) { 118 if (resultOffset < (*result).GetSize() ) {
119 (*result)[resultOffset++] = (FX_BYTE) ReadUtah(row, colu mn, numRows, numColumns); 119 (*result)[resultOffset++] = (uint8_t) ReadUtah(row, colu mn, numRows, numColumns);
120 } 120 }
121 } 121 }
122 row += 2; 122 row += 2;
123 column -= 2; 123 column -= 2;
124 } while ((row < numRows) && (column >= 0)); 124 } while ((row < numRows) && (column >= 0));
125 row += 3; 125 row += 3;
126 column += 1; 126 column += 1;
127 } 127 }
128 } while ((row < numRows) || (column < numColumns)); 128 } while ((row < numRows) || (column < numColumns));
129 if (resultOffset != m_version->GetTotalCodewords()) { 129 if (resultOffset != m_version->GetTotalCodewords()) {
130 e = BCExceptionFormatException; 130 e = BCExceptionFormatException;
131 return NULL; 131 return NULL;
132 } 132 }
133 return result.release(); 133 return result.release();
134 } 134 }
135 FX_BOOL CBC_DataMatrixBitMatrixParser::ReadModule(FX_INT32 row, FX_INT32 column, FX_INT32 numRows, FX_INT32 numColumns) 135 FX_BOOL CBC_DataMatrixBitMatrixParser::ReadModule(int32_t row, int32_t column, i nt32_t numRows, int32_t numColumns)
136 { 136 {
137 if (row < 0) { 137 if (row < 0) {
138 row += numRows; 138 row += numRows;
139 column += 4 - ((numRows + 4) & 0x07); 139 column += 4 - ((numRows + 4) & 0x07);
140 } 140 }
141 if (column < 0) { 141 if (column < 0) {
142 column += numColumns; 142 column += numColumns;
143 row += 4 - ((numColumns + 4) & 0x07); 143 row += 4 - ((numColumns + 4) & 0x07);
144 } 144 }
145 m_readMappingMatrix->Set(column, row); 145 m_readMappingMatrix->Set(column, row);
146 return m_mappingBitMatrix->Get(column, row); 146 return m_mappingBitMatrix->Get(column, row);
147 } 147 }
148 FX_INT32 CBC_DataMatrixBitMatrixParser::ReadUtah(FX_INT32 row, FX_INT32 column, FX_INT32 numRows, FX_INT32 numColumns) 148 int32_t CBC_DataMatrixBitMatrixParser::ReadUtah(int32_t row, int32_t column, int 32_t numRows, int32_t numColumns)
149 { 149 {
150 FX_INT32 currentByte = 0; 150 int32_t currentByte = 0;
151 if (ReadModule(row - 2, column - 2, numRows, numColumns)) { 151 if (ReadModule(row - 2, column - 2, numRows, numColumns)) {
152 currentByte |= 1; 152 currentByte |= 1;
153 } 153 }
154 currentByte <<= 1; 154 currentByte <<= 1;
155 if (ReadModule(row - 2, column - 1, numRows, numColumns)) { 155 if (ReadModule(row - 2, column - 1, numRows, numColumns)) {
156 currentByte |= 1; 156 currentByte |= 1;
157 } 157 }
158 currentByte <<= 1; 158 currentByte <<= 1;
159 if (ReadModule(row - 1, column - 2, numRows, numColumns)) { 159 if (ReadModule(row - 1, column - 2, numRows, numColumns)) {
160 currentByte |= 1; 160 currentByte |= 1;
(...skipping 13 matching lines...) Expand all
174 currentByte <<= 1; 174 currentByte <<= 1;
175 if (ReadModule(row, column - 1, numRows, numColumns)) { 175 if (ReadModule(row, column - 1, numRows, numColumns)) {
176 currentByte |= 1; 176 currentByte |= 1;
177 } 177 }
178 currentByte <<= 1; 178 currentByte <<= 1;
179 if (ReadModule(row, column, numRows, numColumns)) { 179 if (ReadModule(row, column, numRows, numColumns)) {
180 currentByte |= 1; 180 currentByte |= 1;
181 } 181 }
182 return currentByte; 182 return currentByte;
183 } 183 }
184 FX_INT32 CBC_DataMatrixBitMatrixParser::ReadCorner1(FX_INT32 numRows, FX_INT32 n umColumns) 184 int32_t CBC_DataMatrixBitMatrixParser::ReadCorner1(int32_t numRows, int32_t numC olumns)
185 { 185 {
186 FX_INT32 currentByte = 0; 186 int32_t currentByte = 0;
187 if (ReadModule(numRows - 1, 0, numRows, numColumns)) { 187 if (ReadModule(numRows - 1, 0, numRows, numColumns)) {
188 currentByte |= 1; 188 currentByte |= 1;
189 } 189 }
190 currentByte <<= 1; 190 currentByte <<= 1;
191 if (ReadModule(numRows - 1, 1, numRows, numColumns)) { 191 if (ReadModule(numRows - 1, 1, numRows, numColumns)) {
192 currentByte |= 1; 192 currentByte |= 1;
193 } 193 }
194 currentByte <<= 1; 194 currentByte <<= 1;
195 if (ReadModule(numRows - 1, 2, numRows, numColumns)) { 195 if (ReadModule(numRows - 1, 2, numRows, numColumns)) {
196 currentByte |= 1; 196 currentByte |= 1;
(...skipping 13 matching lines...) Expand all
210 currentByte <<= 1; 210 currentByte <<= 1;
211 if (ReadModule(2, numColumns - 1, numRows, numColumns)) { 211 if (ReadModule(2, numColumns - 1, numRows, numColumns)) {
212 currentByte |= 1; 212 currentByte |= 1;
213 } 213 }
214 currentByte <<= 1; 214 currentByte <<= 1;
215 if (ReadModule(3, numColumns - 1, numRows, numColumns)) { 215 if (ReadModule(3, numColumns - 1, numRows, numColumns)) {
216 currentByte |= 1; 216 currentByte |= 1;
217 } 217 }
218 return currentByte; 218 return currentByte;
219 } 219 }
220 FX_INT32 CBC_DataMatrixBitMatrixParser::ReadCorner2(FX_INT32 numRows, FX_INT32 n umColumns) 220 int32_t CBC_DataMatrixBitMatrixParser::ReadCorner2(int32_t numRows, int32_t numC olumns)
221 { 221 {
222 FX_INT32 currentByte = 0; 222 int32_t currentByte = 0;
223 if (ReadModule(numRows - 3, 0, numRows, numColumns)) { 223 if (ReadModule(numRows - 3, 0, numRows, numColumns)) {
224 currentByte |= 1; 224 currentByte |= 1;
225 } 225 }
226 currentByte <<= 1; 226 currentByte <<= 1;
227 if (ReadModule(numRows - 2, 0, numRows, numColumns)) { 227 if (ReadModule(numRows - 2, 0, numRows, numColumns)) {
228 currentByte |= 1; 228 currentByte |= 1;
229 } 229 }
230 currentByte <<= 1; 230 currentByte <<= 1;
231 if (ReadModule(numRows - 1, 0, numRows, numColumns)) { 231 if (ReadModule(numRows - 1, 0, numRows, numColumns)) {
232 currentByte |= 1; 232 currentByte |= 1;
(...skipping 13 matching lines...) Expand all
246 currentByte <<= 1; 246 currentByte <<= 1;
247 if (ReadModule(0, numColumns - 1, numRows, numColumns)) { 247 if (ReadModule(0, numColumns - 1, numRows, numColumns)) {
248 currentByte |= 1; 248 currentByte |= 1;
249 } 249 }
250 currentByte <<= 1; 250 currentByte <<= 1;
251 if (ReadModule(1, numColumns - 1, numRows, numColumns)) { 251 if (ReadModule(1, numColumns - 1, numRows, numColumns)) {
252 currentByte |= 1; 252 currentByte |= 1;
253 } 253 }
254 return currentByte; 254 return currentByte;
255 } 255 }
256 FX_INT32 CBC_DataMatrixBitMatrixParser::ReadCorner3(FX_INT32 numRows, FX_INT32 n umColumns) 256 int32_t CBC_DataMatrixBitMatrixParser::ReadCorner3(int32_t numRows, int32_t numC olumns)
257 { 257 {
258 FX_INT32 currentByte = 0; 258 int32_t currentByte = 0;
259 if (ReadModule(numRows - 1, 0, numRows, numColumns)) { 259 if (ReadModule(numRows - 1, 0, numRows, numColumns)) {
260 currentByte |= 1; 260 currentByte |= 1;
261 } 261 }
262 currentByte <<= 1; 262 currentByte <<= 1;
263 if (ReadModule(numRows - 1, numColumns - 1, numRows, numColumns)) { 263 if (ReadModule(numRows - 1, numColumns - 1, numRows, numColumns)) {
264 currentByte |= 1; 264 currentByte |= 1;
265 } 265 }
266 currentByte <<= 1; 266 currentByte <<= 1;
267 if (ReadModule(0, numColumns - 3, numRows, numColumns)) { 267 if (ReadModule(0, numColumns - 3, numRows, numColumns)) {
268 currentByte |= 1; 268 currentByte |= 1;
(...skipping 13 matching lines...) Expand all
282 currentByte <<= 1; 282 currentByte <<= 1;
283 if (ReadModule(1, numColumns - 2, numRows, numColumns)) { 283 if (ReadModule(1, numColumns - 2, numRows, numColumns)) {
284 currentByte |= 1; 284 currentByte |= 1;
285 } 285 }
286 currentByte <<= 1; 286 currentByte <<= 1;
287 if (ReadModule(1, numColumns - 1, numRows, numColumns)) { 287 if (ReadModule(1, numColumns - 1, numRows, numColumns)) {
288 currentByte |= 1; 288 currentByte |= 1;
289 } 289 }
290 return currentByte; 290 return currentByte;
291 } 291 }
292 FX_INT32 CBC_DataMatrixBitMatrixParser::ReadCorner4(FX_INT32 numRows, FX_INT32 n umColumns) 292 int32_t CBC_DataMatrixBitMatrixParser::ReadCorner4(int32_t numRows, int32_t numC olumns)
293 { 293 {
294 FX_INT32 currentByte = 0; 294 int32_t currentByte = 0;
295 if (ReadModule(numRows - 3, 0, numRows, numColumns)) { 295 if (ReadModule(numRows - 3, 0, numRows, numColumns)) {
296 currentByte |= 1; 296 currentByte |= 1;
297 } 297 }
298 currentByte <<= 1; 298 currentByte <<= 1;
299 if (ReadModule(numRows - 2, 0, numRows, numColumns)) { 299 if (ReadModule(numRows - 2, 0, numRows, numColumns)) {
300 currentByte |= 1; 300 currentByte |= 1;
301 } 301 }
302 currentByte <<= 1; 302 currentByte <<= 1;
303 if (ReadModule(numRows - 1, 0, numRows, numColumns)) { 303 if (ReadModule(numRows - 1, 0, numRows, numColumns)) {
304 currentByte |= 1; 304 currentByte |= 1;
(...skipping 13 matching lines...) Expand all
318 currentByte <<= 1; 318 currentByte <<= 1;
319 if (ReadModule(2, numColumns - 1, numRows, numColumns)) { 319 if (ReadModule(2, numColumns - 1, numRows, numColumns)) {
320 currentByte |= 1; 320 currentByte |= 1;
321 } 321 }
322 currentByte <<= 1; 322 currentByte <<= 1;
323 if (ReadModule(3, numColumns - 1, numRows, numColumns)) { 323 if (ReadModule(3, numColumns - 1, numRows, numColumns)) {
324 currentByte |= 1; 324 currentByte |= 1;
325 } 325 }
326 return currentByte; 326 return currentByte;
327 } 327 }
328 CBC_CommonBitMatrix *CBC_DataMatrixBitMatrixParser::ExtractDataRegion(CBC_Common BitMatrix *bitMatrix , FX_INT32 &e) 328 CBC_CommonBitMatrix *CBC_DataMatrixBitMatrixParser::ExtractDataRegion(CBC_Common BitMatrix *bitMatrix , int32_t &e)
329 { 329 {
330 FX_INT32 symbolSizeRows = m_version->GetSymbolSizeRows(); 330 int32_t symbolSizeRows = m_version->GetSymbolSizeRows();
331 FX_INT32 symbolSizeColumns = m_version->GetSymbolSizeColumns(); 331 int32_t symbolSizeColumns = m_version->GetSymbolSizeColumns();
332 if (bitMatrix->GetHeight() != symbolSizeRows) { 332 if (bitMatrix->GetHeight() != symbolSizeRows) {
333 e = BCExceptionCanNotCallGetDimensionOnNonSquareMatrix; 333 e = BCExceptionCanNotCallGetDimensionOnNonSquareMatrix;
334 return NULL; 334 return NULL;
335 } 335 }
336 FX_INT32 dataRegionSizeRows = m_version->GetDataRegionSizeRows(); 336 int32_t dataRegionSizeRows = m_version->GetDataRegionSizeRows();
337 FX_INT32 dataRegionSizeColumns = m_version->GetDataRegionSizeColumns(); 337 int32_t dataRegionSizeColumns = m_version->GetDataRegionSizeColumns();
338 FX_INT32 numDataRegionsRow = symbolSizeRows / dataRegionSizeRows; 338 int32_t numDataRegionsRow = symbolSizeRows / dataRegionSizeRows;
339 FX_INT32 numDataRegionsColumn = symbolSizeColumns / dataRegionSizeColumns; 339 int32_t numDataRegionsColumn = symbolSizeColumns / dataRegionSizeColumns;
340 FX_INT32 sizeDataRegionRow = numDataRegionsRow * dataRegionSizeRows; 340 int32_t sizeDataRegionRow = numDataRegionsRow * dataRegionSizeRows;
341 FX_INT32 sizeDataRegionColumn = numDataRegionsColumn * dataRegionSizeColumns ; 341 int32_t sizeDataRegionColumn = numDataRegionsColumn * dataRegionSizeColumns;
342 CBC_CommonBitMatrix *bitMatrixWithoutAlignment = FX_NEW CBC_CommonBitMatrix( ); 342 CBC_CommonBitMatrix *bitMatrixWithoutAlignment = FX_NEW CBC_CommonBitMatrix( );
343 bitMatrixWithoutAlignment->Init(sizeDataRegionColumn, sizeDataRegionRow); 343 bitMatrixWithoutAlignment->Init(sizeDataRegionColumn, sizeDataRegionRow);
344 FX_INT32 dataRegionRow; 344 int32_t dataRegionRow;
345 for (dataRegionRow = 0; dataRegionRow < numDataRegionsRow; ++dataRegionRow) { 345 for (dataRegionRow = 0; dataRegionRow < numDataRegionsRow; ++dataRegionRow) {
346 FX_INT32 dataRegionRowOffset = dataRegionRow * dataRegionSizeRows; 346 int32_t dataRegionRowOffset = dataRegionRow * dataRegionSizeRows;
347 FX_INT32 dataRegionColumn; 347 int32_t dataRegionColumn;
348 for (dataRegionColumn = 0; dataRegionColumn < numDataRegionsColumn; ++da taRegionColumn) { 348 for (dataRegionColumn = 0; dataRegionColumn < numDataRegionsColumn; ++da taRegionColumn) {
349 FX_INT32 dataRegionColumnOffset = dataRegionColumn * dataRegionSizeC olumns; 349 int32_t dataRegionColumnOffset = dataRegionColumn * dataRegionSizeCo lumns;
350 FX_INT32 i; 350 int32_t i;
351 for (i = 0; i < dataRegionSizeRows; ++i) { 351 for (i = 0; i < dataRegionSizeRows; ++i) {
352 FX_INT32 readRowOffset = dataRegionRow * (dataRegionSizeRows + 2 ) + 1 + i; 352 int32_t readRowOffset = dataRegionRow * (dataRegionSizeRows + 2) + 1 + i;
353 FX_INT32 writeRowOffset = dataRegionRowOffset + i; 353 int32_t writeRowOffset = dataRegionRowOffset + i;
354 FX_INT32 j; 354 int32_t j;
355 for (j = 0; j < dataRegionSizeColumns; ++j) { 355 for (j = 0; j < dataRegionSizeColumns; ++j) {
356 FX_INT32 readColumnOffset = dataRegionColumn * (dataRegionSi zeColumns + 2) + 1 + j; 356 int32_t readColumnOffset = dataRegionColumn * (dataRegionSiz eColumns + 2) + 1 + j;
357 if (bitMatrix->Get(readColumnOffset, readRowOffset)) { 357 if (bitMatrix->Get(readColumnOffset, readRowOffset)) {
358 FX_INT32 writeColumnOffset = dataRegionColumnOffset + j; 358 int32_t writeColumnOffset = dataRegionColumnOffset + j;
359 bitMatrixWithoutAlignment->Set(writeColumnOffset, writeR owOffset); 359 bitMatrixWithoutAlignment->Set(writeColumnOffset, writeR owOffset);
360 } 360 }
361 } 361 }
362 } 362 }
363 } 363 }
364 } 364 }
365 return bitMatrixWithoutAlignment; 365 return bitMatrixWithoutAlignment;
366 } 366 }
OLDNEW
« no previous file with comments | « xfa/src/fxbarcode/datamatrix/BC_DataMatrixBitMatrixParser.h ('k') | xfa/src/fxbarcode/datamatrix/BC_DataMatrixDataBlock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698