From bef88e87a3de24a2b6d777fb6ba53f46ce5a451d Mon Sep 17 00:00:00 2001 From: Mark Yao Date: Mon, 29 Dec 2014 15:03:49 +0800 Subject: [PATCH] rk_fb: bmp_helper: copy bmp data with memcpy Signed-off-by: Mark Yao --- drivers/video/rockchip/bmp_helper.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/video/rockchip/bmp_helper.c b/drivers/video/rockchip/bmp_helper.c index aa4f4f072917..413b0d342d3a 100755 --- a/drivers/video/rockchip/bmp_helper.c +++ b/drivers/video/rockchip/bmp_helper.c @@ -339,7 +339,7 @@ int bmpdecoder(void *bmp_addr, void *pdst, int *width, int *height, int *bits) uint16_t linesize; char *src = bmp_addr; char *dst = pdst; - int i, j; + int i; bool flip = false; memcpy(&header, src, sizeof(header)); @@ -388,13 +388,9 @@ int bmpdecoder(void *bmp_addr, void *pdst, int *width, int *height, int *bits) src += (*width) * (*height - 1) * 3; for (i = 0; i < *height; i++) { - for (j = 0; j < *width; j++) { - dst[0] = src[2]; - dst[1] = src[1]; - dst[2] = src[0]; - dst += 3; - src += 3; - } + memcpy(dst, src, 3 * (*width)); + dst += *width * 3; + src += *width * 3; if (flip) src -= *width * 3 * 2; } -- 2.34.1