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

Side by Side Diff: xfa/src/fxbarcode/src/BC_QRCoderMatrixUtil.cpp

Issue 842043002: Organize barcode codes into modules. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: rebase Created 5 years, 11 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 | « xfa/src/fxbarcode/src/BC_QRCoderMaskUtil.cpp ('k') | xfa/src/fxbarcode/src/BC_QRCoderMode.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 // Original code is licensed as follows:
7 /*
8 * Copyright 2008 ZXing authors
9 *
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 */
22
23 #include "barcode.h"
24 #include "include/BC_CommonByteMatrix.h"
25 #include "include/BC_QRCoderErrorCorrectionLevel.h"
26 #include "include/BC_QRCoder.h"
27 #include "include/BC_QRCoderMaskUtil.h"
28 #include "include/BC_QRCoderMatrixUtil.h"
29 #include "include/BC_QRCoderBitVector.h"
30 const FX_INT32 CBC_QRCoderMatrixUtil::POSITION_DETECTION_PATTERN[7][7] = {
31 1, 1, 1, 1, 1, 1, 1,
32 1, 0, 0, 0, 0, 0, 1,
33 1, 0, 1, 1, 1, 0, 1,
34 1, 0, 1, 1, 1, 0, 1,
35 1, 0, 1, 1, 1, 0, 1,
36 1, 0, 0, 0, 0, 0, 1,
37 1, 1, 1, 1, 1, 1, 1
38 };
39 const FX_INT32 CBC_QRCoderMatrixUtil::HORIZONTAL_SEPARATION_PATTERN[1][8] = {
40 0, 0, 0, 0, 0, 0, 0, 0
41 };
42 const FX_INT32 CBC_QRCoderMatrixUtil::VERTICAL_SEPARATION_PATTERN[7][1] = {
43 0, 0, 0, 0, 0, 0, 0
44 };
45 const FX_INT32 CBC_QRCoderMatrixUtil::POSITION_ADJUSTMENT_PATTERN[5][5] = {
46 1, 1, 1, 1, 1,
47 1, 0, 0, 0, 1,
48 1, 0, 1, 0, 1,
49 1, 0, 0, 0, 1,
50 1, 1, 1, 1, 1
51 };
52 const FX_INT32 CBC_QRCoderMatrixUtil::POSITION_ADJUSTMENT_PATTERN_COORDINATE_TAB LE[40][7] = {
53 { -1, -1, -1, -1, -1, -1, -1},
54 { 6, 18, -1, -1, -1, -1, -1},
55 { 6, 22, -1, -1, -1, -1, -1},
56 { 6, 26, -1, -1, -1, -1, -1},
57 { 6, 30, -1, -1, -1, -1, -1},
58 { 6, 34, -1, -1, -1, -1, -1},
59 { 6, 22, 38, -1, -1, -1, -1},
60 { 6, 24, 42, -1, -1, -1, -1},
61 { 6, 26, 46, -1, -1, -1, -1},
62 { 6, 28, 50, -1, -1, -1, -1},
63 { 6, 30, 54, -1, -1, -1, -1},
64 { 6, 32, 58, -1, -1, -1, -1},
65 { 6, 34, 62, -1, -1, -1, -1},
66 { 6, 26, 46, 66, -1, -1, -1},
67 { 6, 26, 48, 70, -1, -1, -1},
68 { 6, 26, 50, 74, -1, -1, -1},
69 { 6, 30, 54, 78, -1, -1, -1},
70 { 6, 30, 56, 82, -1, -1, -1},
71 { 6, 30, 58, 86, -1, -1, -1},
72 { 6, 34, 62, 90, -1, -1, -1},
73 { 6, 28, 50, 72, 94, -1, -1},
74 { 6, 26, 50, 74, 98, -1, -1},
75 { 6, 30, 54, 78, 102, -1, -1},
76 { 6, 28, 54, 80, 106, -1, -1},
77 { 6, 32, 58, 84, 110, -1, -1},
78 { 6, 30, 58, 86, 114, -1, -1},
79 { 6, 34, 62, 90, 118, -1, -1},
80 { 6, 26, 50, 74, 98, 122, -1},
81 { 6, 30, 54, 78, 102, 126, -1},
82 { 6, 26, 52, 78, 104, 130, -1},
83 { 6, 30, 56, 82, 108, 134, -1},
84 { 6, 34, 60, 86, 112, 138, -1},
85 { 6, 30, 58, 86, 114, 142, -1},
86 { 6, 34, 62, 90, 118, 146, -1},
87 { 6, 30, 54, 78, 102, 126, 150},
88 { 6, 24, 50, 76, 102, 128, 154},
89 { 6, 28, 54, 80, 106, 132, 158},
90 { 6, 32, 58, 84, 110, 136, 162},
91 { 6, 26, 54, 82, 110, 138, 166},
92 { 6, 30, 58, 86, 114, 142, 170},
93 };
94 const FX_INT32 CBC_QRCoderMatrixUtil::TYPE_INFO_COORDINATES[15][2] = {
95 {8, 0},
96 {8, 1},
97 {8, 2},
98 {8, 3},
99 {8, 4},
100 {8, 5},
101 {8, 7},
102 {8, 8},
103 {7, 8},
104 {5, 8},
105 {4, 8},
106 {3, 8},
107 {2, 8},
108 {1, 8},
109 {0, 8},
110 };
111 const FX_INT32 CBC_QRCoderMatrixUtil::VERSION_INFO_POLY = 0x1f25;
112 const FX_INT32 CBC_QRCoderMatrixUtil::TYPE_INFO_POLY = 0x0537;
113 const FX_INT32 CBC_QRCoderMatrixUtil::TYPE_INFO_MASK_PATTERN = 0x5412;
114 void CBC_QRCoderMatrixUtil::ClearMatrix(CBC_CommonByteMatrix* matrix, FX_INT32 & e)
115 {
116 if(matrix == NULL) {
117 e = BCExceptionNullPointer;
118 BC_EXCEPTION_CHECK_ReturnVoid(e);
119 }
120 matrix->clear((FX_BYTE) - 1);
121 }
122 void CBC_QRCoderMatrixUtil::BuildMatrix(CBC_QRCoderBitVector* dataBits,
123 CBC_QRCoderErrorCorrectionLevel* ecLevel ,
124 FX_INT32 version, FX_INT32 maskPattern,
125 CBC_CommonByteMatrix* matrix, FX_INT32 & e)
126 {
127 if(matrix == NULL) {
128 e = BCExceptionNullPointer;
129 BC_EXCEPTION_CHECK_ReturnVoid(e);
130 }
131 ClearMatrix(matrix, e);
132 BC_EXCEPTION_CHECK_ReturnVoid(e);
133 EmbedBasicPatterns(version, matrix, e);
134 BC_EXCEPTION_CHECK_ReturnVoid(e);
135 EmbedTypeInfo(ecLevel, maskPattern, matrix, e);
136 BC_EXCEPTION_CHECK_ReturnVoid(e);
137 MaybeEmbedVersionInfo(version, matrix, e);
138 BC_EXCEPTION_CHECK_ReturnVoid(e);
139 EmbedDataBits(dataBits, maskPattern, matrix, e);
140 BC_EXCEPTION_CHECK_ReturnVoid(e);
141 }
142 void CBC_QRCoderMatrixUtil::EmbedBasicPatterns(FX_INT32 version, CBC_CommonByteM atrix* matrix, FX_INT32 &e)
143 {
144 if(matrix == NULL) {
145 e = BCExceptionNullPointer;
146 BC_EXCEPTION_CHECK_ReturnVoid(e);
147 }
148 EmbedPositionDetectionPatternsAndSeparators(matrix, e);
149 BC_EXCEPTION_CHECK_ReturnVoid(e);
150 EmbedDarkDotAtLeftBottomCorner(matrix, e);
151 BC_EXCEPTION_CHECK_ReturnVoid(e);
152 MaybeEmbedPositionAdjustmentPatterns(version, matrix, e);
153 BC_EXCEPTION_CHECK_ReturnVoid(e);
154 EmbedTimingPatterns(matrix, e);
155 BC_EXCEPTION_CHECK_ReturnVoid(e);
156 }
157 void CBC_QRCoderMatrixUtil::EmbedTypeInfo(CBC_QRCoderErrorCorrectionLevel* ecLev el,
158 FX_INT32 maskPattern, CBC_CommonByteMatrix *matrix, FX_INT32 &e)
159 {
160 if(matrix == NULL) {
161 e = BCExceptionNullPointer;
162 BC_EXCEPTION_CHECK_ReturnVoid(e);
163 }
164 CBC_QRCoderBitVector typeInfoBits;
165 typeInfoBits.Init();
166 MakeTypeInfoBits(ecLevel, maskPattern, &typeInfoBits, e);
167 BC_EXCEPTION_CHECK_ReturnVoid(e);
168 for(FX_INT32 i = 0; i < typeInfoBits.Size(); i++) {
169 FX_INT32 bit = typeInfoBits.At(typeInfoBits.Size() - 1 - i, e);
170 BC_EXCEPTION_CHECK_ReturnVoid(e);
171 FX_INT32 x1 = TYPE_INFO_COORDINATES[i][0];
172 FX_INT32 y1 = TYPE_INFO_COORDINATES[i][1];
173 matrix->Set(x1, y1, bit);
174 if(i < 8) {
175 FX_INT32 x2 = matrix->GetWidth() - i - 1;
176 FX_INT32 y2 = 8;
177 matrix->Set(x2, y2, bit);
178 } else {
179 FX_INT32 x2 = 8;
180 FX_INT32 y2 = matrix->GetHeight() - 7 + (i - 8);
181 matrix->Set(x2, y2, bit);
182 }
183 }
184 }
185 void CBC_QRCoderMatrixUtil::MaybeEmbedVersionInfo(FX_INT32 version, CBC_CommonBy teMatrix* matrix, FX_INT32 &e)
186 {
187 if(matrix == NULL) {
188 e = BCExceptionNullPointer;
189 BC_EXCEPTION_CHECK_ReturnVoid(e);
190 }
191 if(version < 7) {
192 return;
193 }
194 CBC_QRCoderBitVector versionInfoBits;
195 versionInfoBits.Init();
196 MakeVersionInfoBits(version, &versionInfoBits, e);
197 BC_EXCEPTION_CHECK_ReturnVoid(e);
198 FX_INT32 bitIndex = 6 * 3 - 1;
199 for(FX_INT32 i = 0; i < 6; i++) {
200 for(FX_INT32 j = 0; j < 3; j++) {
201 FX_INT32 bit = versionInfoBits.At(bitIndex, e);
202 BC_EXCEPTION_CHECK_ReturnVoid(e);
203 bitIndex--;
204 matrix->Set(i, matrix->GetHeight() - 11 + j, bit);
205 matrix->Set(matrix->GetHeight() - 11 + j, i, bit);
206 }
207 }
208 }
209 void CBC_QRCoderMatrixUtil::EmbedDataBits(CBC_QRCoderBitVector* dataBits,
210 FX_INT32 maskPattern, CBC_CommonByteMatrix* matrix, FX_INT32 &e)
211 {
212 if(matrix == NULL || dataBits == NULL) {
213 e = BCExceptionNullPointer;
214 BC_EXCEPTION_CHECK_ReturnVoid(e);
215 }
216 FX_INT32 bitIndex = 0;
217 FX_INT32 direction = -1;
218 FX_INT32 x = matrix->GetWidth() - 1;
219 FX_INT32 y = matrix->GetHeight() - 1;
220 while(x > 0) {
221 if (x == 6) {
222 x -= 1;
223 }
224 while(y >= 0 && y < matrix->GetHeight()) {
225 if (y == 6) {
226 y += direction;
227 continue;
228 }
229 for(FX_INT32 i = 0; i < 2; i++) {
230 FX_INT32 xx = x - i;
231 if(!IsEmpty(matrix->Get(xx, y))) {
232 continue;
233 }
234 FX_INT32 bit;
235 if(bitIndex < dataBits->Size()) {
236 bit = dataBits->At(bitIndex, e);
237 BC_EXCEPTION_CHECK_ReturnVoid(e);
238 bitIndex++;
239 } else {
240 bit = 0;
241 }
242 if( maskPattern != -1) {
243 FX_BOOL bol = CBC_QRCoderMaskUtil::GetDataMaskBit(maskPatter n, xx, y, e);
244 BC_EXCEPTION_CHECK_ReturnVoid(e);
245 if(bol) {
246 bit ^= 0x01;
247 }
248 }
249 matrix->Set(xx, y, bit);
250 }
251 y += direction;
252 }
253 direction = -direction;
254 y += direction;
255 x -= 2;
256 }
257 if(bitIndex != dataBits->Size()) {
258 return;
259 }
260 }
261 FX_INT32 CBC_QRCoderMatrixUtil::CalculateBCHCode(FX_INT32 value, FX_INT32 poly)
262 {
263 FX_INT32 msbSetInPoly = FindMSBSet(poly);
264 value <<= msbSetInPoly - 1;
265 while(FindMSBSet(value) >= msbSetInPoly) {
266 value ^= poly << (FindMSBSet(value) - msbSetInPoly);
267 }
268 return value;
269 }
270 void CBC_QRCoderMatrixUtil::MakeTypeInfoBits(CBC_QRCoderErrorCorrectionLevel* ec Level,
271 FX_INT32 maskPattern, CBC_QRCoderBitVector* bits, FX_INT32 &e)
272 {
273 if(bits == NULL) {
274 e = BCExceptionNullPointer;
275 BC_EXCEPTION_CHECK_ReturnVoid(e);
276 }
277 if(!CBC_QRCoder::IsValidMaskPattern(maskPattern)) {
278 e = BCExceptionBadMask;
279 BC_EXCEPTION_CHECK_ReturnVoid(e);
280 }
281 FX_INT32 typeInfo = (ecLevel->GetBits() << 3) | maskPattern;
282 BC_EXCEPTION_CHECK_ReturnVoid(e);
283 bits->AppendBits(typeInfo, 5, e);
284 FX_INT32 bchCode = CalculateBCHCode(typeInfo, TYPE_INFO_POLY);
285 BC_EXCEPTION_CHECK_ReturnVoid(e);
286 bits->AppendBits(bchCode, 10, e);
287 CBC_QRCoderBitVector maskBits;
288 maskBits.Init();
289 maskBits.AppendBits(TYPE_INFO_MASK_PATTERN, 15, e);
290 BC_EXCEPTION_CHECK_ReturnVoid(e);
291 bits->XOR(&maskBits, e);
292 BC_EXCEPTION_CHECK_ReturnVoid(e);
293 if(bits->Size() != 15) {
294 e = BCExceptionBitSizeNot15;
295 BC_EXCEPTION_CHECK_ReturnVoid(e);
296 }
297 }
298 void CBC_QRCoderMatrixUtil::MakeVersionInfoBits(FX_INT32 version, CBC_QRCoderBit Vector* bits, FX_INT32 &e)
299 {
300 if(bits == NULL) {
301 e = BCExceptionNullPointer;
302 BC_EXCEPTION_CHECK_ReturnVoid(e);
303 }
304 bits->AppendBits(version, 6, e);
305 BC_EXCEPTION_CHECK_ReturnVoid(e);
306 FX_INT32 bchCode = CalculateBCHCode(version, VERSION_INFO_POLY);
307 bits->AppendBits(bchCode, 12, e);
308 BC_EXCEPTION_CHECK_ReturnVoid(e);
309 if(bits->Size() != 18) {
310 e = BCExceptionBitSizeNot18;
311 BC_EXCEPTION_CHECK_ReturnVoid(e);
312 }
313 }
314 FX_BOOL CBC_QRCoderMatrixUtil::IsEmpty(FX_INT32 value)
315 {
316 return (FX_BYTE)value == 0xff;
317 }
318 FX_BOOL CBC_QRCoderMatrixUtil::IsValidValue(FX_INT32 value)
319 {
320 return ((FX_BYTE)value == 0xff || (FX_BYTE)value == 0x00 || (FX_BYTE)value = = 0x01);
321 }
322 void CBC_QRCoderMatrixUtil::EmbedTimingPatterns(CBC_CommonByteMatrix* matrix, FX _INT32 &e)
323 {
324 if(matrix == NULL) {
325 e = BCExceptionNullPointer;
326 BC_EXCEPTION_CHECK_ReturnVoid(e);
327 }
328 for(FX_INT32 i = 8; i < matrix->GetWidth() - 8; i++) {
329 FX_INT32 bit = (i + 1) % 2;
330 if(!IsValidValue(matrix->Get(i, 6))) {
331 e = BCExceptionInvalidateImageData;
332 BC_EXCEPTION_CHECK_ReturnVoid(e);
333 }
334 if(IsEmpty(matrix->Get(i , 6))) {
335 matrix->Set(i, 6, bit);
336 }
337 if(!IsValidValue(matrix->Get(6, i))) {
338 e = BCExceptionInvalidateImageData;
339 BC_EXCEPTION_CHECK_ReturnVoid(e);
340 }
341 if(IsEmpty(matrix->Get(6, i))) {
342 matrix->Set(6, i, bit);
343 }
344 }
345 }
346 void CBC_QRCoderMatrixUtil::EmbedDarkDotAtLeftBottomCorner(CBC_CommonByteMatrix* matrix, FX_INT32 &e)
347 {
348 if(matrix == NULL) {
349 e = BCExceptionNullPointer;
350 BC_EXCEPTION_CHECK_ReturnVoid(e);
351 }
352 if(matrix->Get(8, matrix->GetHeight() - 8) == 0) {
353 e = BCExceptionHeight_8BeZero;
354 BC_EXCEPTION_CHECK_ReturnVoid(e);
355 }
356 matrix->Set(8, matrix->GetHeight() - 8, 1);
357 }
358 void CBC_QRCoderMatrixUtil::EmbedHorizontalSeparationPattern(FX_INT32 xStart, FX _INT32 yStart,
359 CBC_CommonByteMatrix* matrix, FX_INT32 &e)
360 {
361 if(matrix == NULL) {
362 e = BCExceptionNullPointer;
363 BC_EXCEPTION_CHECK_ReturnVoid(e);
364 }
365 for(FX_INT32 x = 0; x < 8; x++) {
366 if(!IsEmpty(matrix->Get(xStart + x, yStart))) {
367 e = BCExceptionInvalidateData;
368 BC_EXCEPTION_CHECK_ReturnVoid(e)
369 }
370 matrix->Set(xStart + x, yStart, HORIZONTAL_SEPARATION_PATTERN[0][x]);
371 }
372 }
373 void CBC_QRCoderMatrixUtil::EmbedVerticalSeparationPattern(FX_INT32 xStart, FX_I NT32 yStart,
374 CBC_CommonByteMatrix* matrix, FX_INT32 &e)
375 {
376 if(matrix == NULL) {
377 e = BCExceptionNullPointer;
378 BC_EXCEPTION_CHECK_ReturnVoid(e);
379 }
380 for(FX_INT32 y = 0; y < 7; y++) {
381 if(!IsEmpty(matrix->Get(xStart, yStart + y))) {
382 e = BCExceptionInvalidateData;
383 BC_EXCEPTION_CHECK_ReturnVoid(e);
384 }
385 matrix->Set(xStart, yStart + y, VERTICAL_SEPARATION_PATTERN[y][0]);
386 }
387 }
388 void CBC_QRCoderMatrixUtil::EmbedPositionAdjustmentPattern(FX_INT32 xStart, FX_I NT32 yStart,
389 CBC_CommonByteMatrix* matrix, FX_INT32 &e)
390 {
391 if(matrix == NULL) {
392 e = BCExceptionNullPointer;
393 BC_EXCEPTION_CHECK_ReturnVoid(e);
394 }
395 for(FX_INT32 y = 0; y < 5; y++) {
396 for(FX_INT32 x = 0; x < 5; x++) {
397 if(!IsEmpty(matrix->Get(xStart + x, y + yStart))) {
398 e = BCExceptionInvalidateData;
399 BC_EXCEPTION_CHECK_ReturnVoid(e);
400 }
401 matrix->Set(xStart + x, yStart + y, POSITION_ADJUSTMENT_PATTERN[y][x ]);
402 }
403 }
404 }
405 void CBC_QRCoderMatrixUtil::EmbedPositionDetectionPattern (FX_INT32 xStart, FX_I NT32 yStart,
406 CBC_CommonByteMatrix* matrix, FX_INT32 &e)
407 {
408 if(matrix == NULL) {
409 e = BCExceptionNullPointer;
410 BC_EXCEPTION_CHECK_ReturnVoid(e);
411 }
412 for(FX_INT32 y = 0; y < 7; y++) {
413 for(FX_INT32 x = 0; x < 7; x++) {
414 if(!IsEmpty(matrix->Get(xStart + x, yStart + y))) {
415 e = BCExceptionInvalidateData;
416 BC_EXCEPTION_CHECK_ReturnVoid(e);
417 }
418 matrix->Set(xStart + x, yStart + y, POSITION_DETECTION_PATTERN[y][x] );
419 }
420 }
421 }
422 void CBC_QRCoderMatrixUtil::EmbedPositionDetectionPatternsAndSeparators(CBC_Comm onByteMatrix* matrix, FX_INT32 &e)
423 {
424 if(matrix == NULL) {
425 e = BCExceptionNullPointer;
426 BC_EXCEPTION_CHECK_ReturnVoid(e);
427 }
428 FX_INT32 pdpWidth = 7;
429 EmbedPositionDetectionPattern(0, 0, matrix, e);
430 BC_EXCEPTION_CHECK_ReturnVoid(e);
431 EmbedPositionDetectionPattern(matrix->GetWidth() - pdpWidth, 0, matrix, e);
432 BC_EXCEPTION_CHECK_ReturnVoid(e);
433 EmbedPositionDetectionPattern(0, matrix->GetWidth() - pdpWidth, matrix, e);
434 BC_EXCEPTION_CHECK_ReturnVoid(e);
435 FX_INT32 hspWidth = 8;
436 EmbedHorizontalSeparationPattern(0, hspWidth - 1, matrix, e);
437 BC_EXCEPTION_CHECK_ReturnVoid(e);
438 EmbedHorizontalSeparationPattern(matrix->GetWidth() - hspWidth, hspWidth - 1 , matrix, e);
439 BC_EXCEPTION_CHECK_ReturnVoid(e);
440 EmbedHorizontalSeparationPattern(0, matrix->GetWidth() - hspWidth, matrix, e );
441 BC_EXCEPTION_CHECK_ReturnVoid(e);
442 FX_INT32 vspSize = 7;
443 EmbedVerticalSeparationPattern(vspSize, 0, matrix, e);
444 BC_EXCEPTION_CHECK_ReturnVoid(e);
445 EmbedVerticalSeparationPattern(matrix->GetHeight() - vspSize - 1, 0, matrix, e);
446 BC_EXCEPTION_CHECK_ReturnVoid(e);
447 EmbedVerticalSeparationPattern(vspSize, matrix->GetHeight() - vspSize, matri x, e);
448 BC_EXCEPTION_CHECK_ReturnVoid(e);
449 }
450 void CBC_QRCoderMatrixUtil::MaybeEmbedPositionAdjustmentPatterns(FX_INT32 versio n, CBC_CommonByteMatrix* matrix, FX_INT32 &e)
451 {
452 if(matrix == NULL) {
453 e = BCExceptionNullPointer;
454 BC_EXCEPTION_CHECK_ReturnVoid(e);
455 }
456 if(version < 2) {
457 return;
458 }
459 FX_INT32 index = version - 1;
460 FX_INT32 const* coordinates = &(POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE [index][0]);
461 FX_INT32 numCoordinate = 7;
462 for(FX_INT32 i = 0; i < numCoordinate; i++) {
463 for(FX_INT32 j = 0; j < numCoordinate; j++) {
464 FX_INT32 y = coordinates[i];
465 FX_INT32 x = coordinates[j];
466 if(x == -1 || y == -1) {
467 continue;
468 }
469 if(IsEmpty(matrix->Get(x, y))) {
470 EmbedPositionAdjustmentPattern(x - 2, y - 2, matrix, e);
471 BC_EXCEPTION_CHECK_ReturnVoid(e);
472 }
473 }
474 }
475 }
476 FX_INT32 CBC_QRCoderMatrixUtil::FindMSBSet(FX_INT32 value)
477 {
478 FX_INT32 numDigits = 0;
479 while(value != 0) {
480 value >>= 1;
481 ++numDigits;
482 }
483 return numDigits;
484 }
485 CBC_QRCoderMatrixUtil::CBC_QRCoderMatrixUtil()
486 {
487 }
488 CBC_QRCoderMatrixUtil::~CBC_QRCoderMatrixUtil()
489 {
490 }
OLDNEW
« no previous file with comments | « xfa/src/fxbarcode/src/BC_QRCoderMaskUtil.cpp ('k') | xfa/src/fxbarcode/src/BC_QRCoderMode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698