aboutsummaryrefslogtreecommitdiff
path: root/lpg/libqr/qr-mask.c
diff options
context:
space:
mode:
authorLeo Howell <leo@lwh.jp>2009-11-14 20:24:57 +0900
committerLeo Howell <leo@lwh.jp>2009-11-14 20:24:57 +0900
commitc2e4639d2ebefbeb7f8b7e1826ae2391c6876a5a (patch)
tree8f208b60816aa1f7390b249c21f0771a8bce7c6e /lpg/libqr/qr-mask.c
parent2a5548351d9814a8a23eff1e43e14008ea4ae1d0 (diff)
downloadpdf-simple-sign-c2e4639d2ebefbeb7f8b7e1826ae2391c6876a5a.tar.gz
pdf-simple-sign-c2e4639d2ebefbeb7f8b7e1826ae2391c6876a5a.tar.xz
pdf-simple-sign-c2e4639d2ebefbeb7f8b7e1826ae2391c6876a5a.zip
Merge some files
Diffstat (limited to 'lpg/libqr/qr-mask.c')
-rw-r--r--lpg/libqr/qr-mask.c46
1 files changed, 0 insertions, 46 deletions
diff --git a/lpg/libqr/qr-mask.c b/lpg/libqr/qr-mask.c
deleted file mode 100644
index 7ff78a4..0000000
--- a/lpg/libqr/qr-mask.c
+++ /dev/null
@@ -1,46 +0,0 @@
-#include <limits.h>
-#include <stdlib.h>
-#include <qr/bitmap.h>
-#include "qr-mask.h"
-
-struct qr_bitmap * qr_mask_apply(const struct qr_bitmap * orig,
- unsigned int mask)
-{
- struct qr_bitmap * bmp;
- int i, j;
-
- if (mask & ~0x7)
- return 0;
-
- bmp = qr_bitmap_clone(orig);
- if (!bmp)
- return 0;
-
- /* Slow version for now; we can optimize later */
-
- for (i = 0; i < bmp->height; ++i) {
- unsigned char * p = bmp->bits + i * bmp->stride;
-
- for (j = 0; j < bmp->width; ++j) {
- int bit = j % CHAR_BIT;
- size_t off = j / CHAR_BIT;
- int t;
-
- switch (mask) {
- case 0: t = (i + j) % 2; break;
- case 1: t = i % 2; break;
- case 2: t = j % 3; break;
- case 3: t = (i + j) % 3; break;
- case 4: t = (i/2 + j/3) % 2; break;
- case 5: t = ((i*j) % 2) + ((i*j) % 3); break;
- case 6: t = (((i*j) % 2) + ((i*j) % 3)) % 2; break;
- case 7: t = (((i*j) % 3) + ((i+j) % 2)) % 2; break;
- }
-
- p[off] ^= (t == 0) << bit;
- }
- }
-
- return bmp;
-}
-