1.1 --- a/stage2/lcd.c Sat Feb 27 16:53:47 2016 +0100
1.2 +++ b/stage2/lcd.c Sat Feb 27 16:59:27 2016 +0100
1.3 @@ -69,72 +69,72 @@
1.4 return (div(r, 255, rmax) << rshift) | (div(g, 255, gmax) << gshift) | (div(b, 255, bmax) << bshift);
1.5 }
1.6
1.7 -static void get_colour(unsigned short h, unsigned short v, u8 rgb[])
1.8 +static void get_colour(unsigned short h, unsigned short v, u8 rgb[], unsigned short pixel_type)
1.9 {
1.10 unsigned short v_max = panel_info.vl_row;
1.11 unsigned short h_max = panel_info.vl_col;
1.12
1.13 - rgb[0] = div(h, h_max, 255);
1.14 - rgb[1] = div(v, v_max, 255);
1.15 - rgb[2] = (rgb[0] + rgb[1]) / 2;
1.16 + rgb[(pixel_type - 1) % 3] = div(h, h_max, 255);
1.17 + rgb[pixel_type % 3] = div(v, v_max, 255);
1.18 + rgb[(pixel_type + 1) % 3] = (rgb[0] + rgb[1]) / 2;
1.19 }
1.20
1.21 -static void test_pixel32(unsigned short h, unsigned short v)
1.22 +static void test_pixel32(unsigned short h, unsigned short v, unsigned short pixel_type)
1.23 {
1.24 u32 *pix = get_pixel32(h, v);
1.25 u8 rgb[3];
1.26
1.27 - get_colour(h, v, rgb);
1.28 + get_colour(h, v, rgb, pixel_type);
1.29 *pix = (u32) pixel(rgb[0], rgb[1], rgb[2], 255, 255, 255, 16, 8, 0);
1.30 }
1.31
1.32 -static void test_pixel16_565(unsigned short h, unsigned short v)
1.33 +static void test_pixel16_565(unsigned short h, unsigned short v, unsigned short pixel_type)
1.34 {
1.35 u16 *pix = get_pixel16(h, v);
1.36 u8 rgb[3];
1.37
1.38 - get_colour(h, v, rgb);
1.39 + get_colour(h, v, rgb, pixel_type);
1.40 *pix = (u16) pixel(rgb[0], rgb[1], rgb[2], 31, 63, 31, 11, 5, 0);
1.41 }
1.42
1.43 -static void test_pixel8(unsigned short h, unsigned short v)
1.44 +static void test_pixel8(unsigned short h, unsigned short v, unsigned short pixel_type)
1.45 {
1.46 u8 *pix = get_pixel8(h, v);
1.47 u8 rgb[3];
1.48
1.49 - get_colour(h, v, rgb);
1.50 + get_colour(h, v, rgb, pixel_type);
1.51 *pix = (u8) pixel(rgb[0], rgb[1], rgb[2], 7, 7, 3, 5, 2, 0);
1.52 }
1.53
1.54 -static void test_pixel4(unsigned short h, unsigned short v)
1.55 +static void test_pixel4(unsigned short h, unsigned short v, unsigned short pixel_type)
1.56 {
1.57 u8 *pix = get_pixel4(h, v);
1.58 u8 mask = h & 1 ? 0xf0 : 0x0f;
1.59 u8 rgb[3];
1.60
1.61 - get_colour(h, v, rgb);
1.62 + get_colour(h, v, rgb, pixel_type);
1.63 *pix = (*pix & mask) | ((u8) pixel(rgb[0], rgb[1], rgb[2], 1, 2, 1, 3, 1, 0) << (h & 1 ? 0 : 4));
1.64 }
1.65
1.66 -void test_pixel(unsigned short h, unsigned short v)
1.67 +void test_pixel(unsigned short h, unsigned short v, unsigned short pixel_type)
1.68 {
1.69 switch (panel_info.vl_bpix)
1.70 {
1.71 case LCD_COLOR32:
1.72 - test_pixel32(h, v);
1.73 + test_pixel32(h, v, pixel_type);
1.74 break;
1.75
1.76 case LCD_COLOR8:
1.77 - test_pixel8(h, v);
1.78 + test_pixel8(h, v, pixel_type);
1.79 break;
1.80
1.81 case LCD_COLOR4:
1.82 - test_pixel4(h, v);
1.83 + test_pixel4(h, v, pixel_type);
1.84 break;
1.85
1.86 case LCD_COLOR16:
1.87 default:
1.88 - test_pixel16_565(h, v);
1.89 + test_pixel16_565(h, v, pixel_type);
1.90 break;
1.91 }
1.92 }
1.93 @@ -195,7 +195,7 @@
1.94
1.95 for (v = 0; v < v_max; v += 1) {
1.96 for (h = 0; h < h_max; h += 1) {
1.97 - test_pixel(h, v);
1.98 + test_pixel(h, v, 1);
1.99 }
1.100 }
1.101 }