aboutsummaryrefslogtreecommitdiff
path: root/lpg/libqr/code-create.c
diff options
context:
space:
mode:
authorLeo Howell <leo@lwh.jp>2009-09-27 16:31:03 +0900
committerLeo Howell <leo@lwh.jp>2009-09-27 16:31:03 +0900
commit559eb9633e1f97d70112f02538ae5e9a0e46f4d5 (patch)
tree78d3ce4998fc9cf60f55162c16323a415d47a57b /lpg/libqr/code-create.c
parent24e968c84075344de2b6b31dc054bfe988eacd04 (diff)
downloadpdf-simple-sign-559eb9633e1f97d70112f02538ae5e9a0e46f4d5.tar.gz
pdf-simple-sign-559eb9633e1f97d70112f02538ae5e9a0e46f4d5.tar.xz
pdf-simple-sign-559eb9633e1f97d70112f02538ae5e9a0e46f4d5.zip
bitmap handling routines
Diffstat (limited to 'lpg/libqr/code-create.c')
-rw-r--r--lpg/libqr/code-create.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lpg/libqr/code-create.c b/lpg/libqr/code-create.c
index a462ea3..5c0f2b7 100644
--- a/lpg/libqr/code-create.c
+++ b/lpg/libqr/code-create.c
@@ -29,10 +29,10 @@ static void x_dump(struct bitstream * bits)
static void setpx(struct qr_code * code, int x, int y)
{
- size_t off = y * code->line_stride + x / CHAR_BIT;
+ size_t off = y * code->modules->stride + x / CHAR_BIT;
unsigned char bit = 1 << (x % CHAR_BIT);
- code->modules[off] |= bit;
+ code->modules->bits[off] |= bit;
}
static void draw_locator(struct qr_code * code, int x, int y)
@@ -209,8 +209,7 @@ struct qr_code * qr_code_create(enum qr_ec_level ec,
dim = code_side_length(data->format);
code->format = data->format;
- code->line_stride = dim / CHAR_BIT + ((dim % CHAR_BIT) ? 1 : 0);
- code->modules = calloc(dim * code->line_stride, sizeof(unsigned char));
+ code->modules = qr_bitmap_create(dim, dim, 0);
if (!code->modules)
goto fail;