| 251 | |
| 252 | |
| 253 | void qrcodegen::QrCode::drawVersion() { |
| 254 | if (version < 7) |
| 255 | return; |
| 256 | |
| 257 | // Calculate error correction code and pack bits |
| 258 | int rem = version; // version is uint6, in the range [7, 40] |
| 259 | for (int i = 0; i < 12; i++) |
| 260 | rem = (rem << 1) ^ ((rem >> 11) * 0x1F25); |
| 261 | int data = version << 12 | rem; // uint18 |
| 262 | if (data >> 18 != 0) |
| 263 | throw "Assertion error"; |
| 264 | |
| 265 | // Draw two copies |
| 266 | for (int i = 0; i < 18; i++) { |
| 267 | bool bit = ((data >> i) & 1) != 0; |
| 268 | int a = size - 11 + i % 3, b = i / 3; |
| 269 | setFunctionModule(a, b, bit); |
| 270 | setFunctionModule(b, a, bit); |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | |
| 275 | void qrcodegen::QrCode::drawFinderPattern(int x, int y) { |
nothing calls this directly
no test coverage detected