1 [PATCH] fbv: support bgr555 format
3 Signed-off-by: Josh.Wu <josh.wu@atmel.com>
4 diff -Naur fbv-1.0b-ori/fb_display.c fbv-1.0b/fb_display.c
5 --- fbv-1.0b-ori/fb_display.c 2010-04-02 09:38:15.000000000 +0800
6 +++ fbv-1.0b/fb_display.c 2010-04-01 18:54:15.000000000 +0800
11 +inline static unsigned short make15color_bgr(unsigned char r, unsigned char g, unsigned char b)
14 + (((b >> 3) & 31) << 10) |
15 + (((g >> 3) & 31) << 5) |
19 inline static unsigned short make16color(unsigned char r, unsigned char g, unsigned char b)
27 + struct fb_var_screeninfo var;
28 + getVarScreenInfo(fh, &var);
29 + if(var.red.offset == 0 &&
30 + var.green.offset == 5 &&
31 + var.blue.offset == 10)
40 s_fbbuff = (unsigned short *) malloc(count * sizeof(unsigned short));
41 - for(i = 0; i < count ; i++)
42 - s_fbbuff[i] = make15color(rgbbuff[i*3], rgbbuff[i*3+1], rgbbuff[i*3+2]);
44 + for(i = 0; i < count ; i++)
45 + s_fbbuff[i] = make15color_bgr(rgbbuff[i*3], rgbbuff[i*3+1], rgbbuff[i*3+2]);
47 + for(i = 0; i < count ; i++)
48 + s_fbbuff[i] = make15color(rgbbuff[i*3], rgbbuff[i*3+1], rgbbuff[i*3+2]);
49 fbbuff = (void *) s_fbbuff;
53 s_fbbuff = (unsigned short *) malloc(count * sizeof(unsigned short));
54 - for(i = 0; i < count ; i++)
55 - s_fbbuff[i] = make16color(rgbbuff[i*3], rgbbuff[i*3+1], rgbbuff[i*3+2]);
57 + for(i = 0; i < count ; i++)
58 + s_fbbuff[i] = make15color_bgr(rgbbuff[i*3], rgbbuff[i*3+1], rgbbuff[i*3+2]);
60 + for(i = 0; i < count ; i++)
61 + s_fbbuff[i] = make16color(rgbbuff[i*3], rgbbuff[i*3+1], rgbbuff[i*3+2]);
62 fbbuff = (void *) s_fbbuff;