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