rk_fb: bmp_helper: copy bmp data with memcpy
authorMark Yao <mark.yao@rock-chips.com>
Mon, 29 Dec 2014 07:03:49 +0000 (15:03 +0800)
committerMark Yao <mark.yao@rock-chips.com>
Mon, 29 Dec 2014 07:03:49 +0000 (15:03 +0800)
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
drivers/video/rockchip/bmp_helper.c

index aa4f4f072917fb9e1e2707b3b9f048497a19b907..413b0d342d3a93b9a857e503a1f2e6214c9033c8 100755 (executable)
@@ -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;
                }