MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / drawVersion

Method drawVersion

Libraries/QRCode/tests/QrCode.cpp:253–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251
252
253void 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
275void qrcodegen::QrCode::drawFinderPattern(int x, int y) {

Callers

nothing calls this directly

Calls 1

setFunctionModuleFunction · 0.85

Tested by

no test coverage detected