From 36f38e01ddd23f332374093fa213ca08429729b1 Mon Sep 17 00:00:00 2001 From: Leo Howell Date: Mon, 28 Sep 2009 22:09:47 +0900 Subject: QR masks --- lpg/libqr/qr-bitmap.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'lpg/libqr/qr-bitmap.c') diff --git a/lpg/libqr/qr-bitmap.c b/lpg/libqr/qr-bitmap.c index e42b550..1a5ca52 100644 --- a/lpg/libqr/qr-bitmap.c +++ b/lpg/libqr/qr-bitmap.c @@ -48,6 +48,25 @@ void qr_bitmap_destroy(struct qr_bitmap * bmp) } } +struct qr_bitmap * qr_bitmap_clone(const struct qr_bitmap * src) +{ + struct qr_bitmap * bmp; + size_t size; + + bmp = qr_bitmap_create(src->width, src->height, !!src->mask); + if (!bmp) + return 0; + + assert(bmp->stride == src->stride); + + size = bmp->width * bmp->stride; + memcpy(bmp->bits, src->bits, size); + if (bmp->mask) + memcpy(bmp->mask, src->mask, size); + + return bmp; +} + void qr_bitmap_merge(struct qr_bitmap * dest, const struct qr_bitmap * src) { unsigned char * d, * s, * m; -- cgit v1.2.3-70-g09d2