2.1 --- a/stage2/lcd.c Sat Feb 27 16:53:47 2016 +0100
2.2 +++ b/stage2/lcd.c Sat Feb 27 16:59:27 2016 +0100
2.3 @@ -69,72 +69,72 @@
2.4 return (div(r, 255, rmax) << rshift) | (div(g, 255, gmax) << gshift) | (div(b, 255, bmax) << bshift);
2.5 }
2.6
2.7 -static void get_colour(unsigned short h, unsigned short v, u8 rgb[])
2.8 +static void get_colour(unsigned short h, unsigned short v, u8 rgb[], unsigned short pixel_type)
2.9 {
2.10 unsigned short v_max = panel_info.vl_row;
2.11 unsigned short h_max = panel_info.vl_col;
2.12
2.13 - rgb[0] = div(h, h_max, 255);
2.14 - rgb[1] = div(v, v_max, 255);
2.15 - rgb[2] = (rgb[0] + rgb[1]) / 2;
2.16 + rgb[(pixel_type - 1) % 3] = div(h, h_max, 255);
2.17 + rgb[pixel_type % 3] = div(v, v_max, 255);
2.18 + rgb[(pixel_type + 1) % 3] = (rgb[0] + rgb[1]) / 2;
2.19 }
2.20
2.21 -static void test_pixel32(unsigned short h, unsigned short v)
2.22 +static void test_pixel32(unsigned short h, unsigned short v, unsigned short pixel_type)
2.23 {
2.24 u32 *pix = get_pixel32(h, v);
2.25 u8 rgb[3];
2.26
2.27 - get_colour(h, v, rgb);
2.28 + get_colour(h, v, rgb, pixel_type);
2.29 *pix = (u32) pixel(rgb[0], rgb[1], rgb[2], 255, 255, 255, 16, 8, 0);
2.30 }
2.31
2.32 -static void test_pixel16_565(unsigned short h, unsigned short v)
2.33 +static void test_pixel16_565(unsigned short h, unsigned short v, unsigned short pixel_type)
2.34 {
2.35 u16 *pix = get_pixel16(h, v);
2.36 u8 rgb[3];
2.37
2.38 - get_colour(h, v, rgb);
2.39 + get_colour(h, v, rgb, pixel_type);
2.40 *pix = (u16) pixel(rgb[0], rgb[1], rgb[2], 31, 63, 31, 11, 5, 0);
2.41 }
2.42
2.43 -static void test_pixel8(unsigned short h, unsigned short v)
2.44 +static void test_pixel8(unsigned short h, unsigned short v, unsigned short pixel_type)
2.45 {
2.46 u8 *pix = get_pixel8(h, v);
2.47 u8 rgb[3];
2.48
2.49 - get_colour(h, v, rgb);
2.50 + get_colour(h, v, rgb, pixel_type);
2.51 *pix = (u8) pixel(rgb[0], rgb[1], rgb[2], 7, 7, 3, 5, 2, 0);
2.52 }
2.53
2.54 -static void test_pixel4(unsigned short h, unsigned short v)
2.55 +static void test_pixel4(unsigned short h, unsigned short v, unsigned short pixel_type)
2.56 {
2.57 u8 *pix = get_pixel4(h, v);
2.58 u8 mask = h & 1 ? 0xf0 : 0x0f;
2.59 u8 rgb[3];
2.60
2.61 - get_colour(h, v, rgb);
2.62 + get_colour(h, v, rgb, pixel_type);
2.63 *pix = (*pix & mask) | ((u8) pixel(rgb[0], rgb[1], rgb[2], 1, 2, 1, 3, 1, 0) << (h & 1 ? 0 : 4));
2.64 }
2.65
2.66 -void test_pixel(unsigned short h, unsigned short v)
2.67 +void test_pixel(unsigned short h, unsigned short v, unsigned short pixel_type)
2.68 {
2.69 switch (panel_info.vl_bpix)
2.70 {
2.71 case LCD_COLOR32:
2.72 - test_pixel32(h, v);
2.73 + test_pixel32(h, v, pixel_type);
2.74 break;
2.75
2.76 case LCD_COLOR8:
2.77 - test_pixel8(h, v);
2.78 + test_pixel8(h, v, pixel_type);
2.79 break;
2.80
2.81 case LCD_COLOR4:
2.82 - test_pixel4(h, v);
2.83 + test_pixel4(h, v, pixel_type);
2.84 break;
2.85
2.86 case LCD_COLOR16:
2.87 default:
2.88 - test_pixel16_565(h, v);
2.89 + test_pixel16_565(h, v, pixel_type);
2.90 break;
2.91 }
2.92 }
2.93 @@ -195,7 +195,7 @@
2.94
2.95 for (v = 0; v < v_max; v += 1) {
2.96 for (h = 0; h < h_max; h += 1) {
2.97 - test_pixel(h, v);
2.98 + test_pixel(h, v, 1);
2.99 }
2.100 }
2.101 }