1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

fix(qrcode): replace memcpy() with lv_memcpy() and delete useless macros (#2827)

* fix(qrcode):Replace memcpy() with lv_memcpy()

* chore(qrcode):Delete useless macros
This commit is contained in:
guoweilkd 2021-11-23 17:51:40 +08:00 committed by GitHub
parent b911b72f4b
commit 8b709936b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,7 +15,6 @@
* DEFINES
*********************/
#define MY_CLASS &lv_qrcode_class
#define QR_SIZE 140
/**********************
* TYPEDEFS
@ -106,7 +105,7 @@ lv_res_t lv_qrcode_update(lv_obj_t * qrcode, const void * data, uint32_t data_le
LV_ASSERT_MALLOC(qr0);
uint8_t * data_tmp = lv_mem_alloc(qrcodegen_BUFFER_LEN_FOR_VERSION(qr_version));
LV_ASSERT_MALLOC(data_tmp);
memcpy(data_tmp, data, data_len);
lv_memcpy(data_tmp, data, data_len);
bool ok = qrcodegen_encodeBinary(data_tmp, data_len,
qr0, qrcodegen_Ecc_MEDIUM,
@ -170,7 +169,7 @@ lv_res_t lv_qrcode_update(lv_obj_t * qrcode, const void * data, uint32_t data_le
int s;
const uint8_t * row_ori = buf_u8 + row_byte_cnt * y;
for(s = 1; s < scale; s++) {
memcpy((uint8_t *)buf_u8 + row_byte_cnt * (y + s), row_ori, row_byte_cnt);
lv_memcpy((uint8_t *)buf_u8 + row_byte_cnt * (y + s), row_ori, row_byte_cnt);
}
}
@ -201,8 +200,6 @@ static void lv_qrcode_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj
lv_canvas_set_buffer(obj, buf, size_param, size_param, LV_IMG_CF_INDEXED_1BIT);
lv_canvas_set_palette(obj, 0, dark_color_param);
lv_canvas_set_palette(obj, 1, light_color_param);
}
static void lv_qrcode_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj)