OpenWrt packages
Sign in or create your account | Project List | Help
OpenWrt packages Git Source Tree
Root/
| 1 | Patch to get the fbterm 1.7 display somewhat better the gliphs on the Ben LCD. |
| 2 | |
| 3 | Author: LluĂs Batlle i Rossell |
| 4 | |
| 5 | diff --git a/src/screen_render.cpp b/src/screen_render.cpp |
| 6 | index e8f39b8..e0f90e9 100644 |
| 7 | --- a/src/screen_render.cpp |
| 8 | +++ b/src/screen_render.cpp |
| 9 | @@ -195,7 +195,40 @@ void Screen::draw##bits(u32 x, u32 y, u32 w, u8 fc, u8 bc, u8 *pixmap) \ |
| 10 | |
| 11 | drawX(15, 5, 5, 5, u16, writew) |
| 12 | drawX(16, 5, 6, 5, u16, writew) |
| 13 | -drawX(32, 8, 8, 8, u32, writel) |
| 14 | + |
| 15 | +void Screen::draw32(u32 x, u32 y, u32 w, u8 fc, u8 bc, u8 *pixmap) |
| 16 | +{ |
| 17 | + /* This code takes into account the Ben Nanonote LCD, that has the distribution: |
| 18 | + * 0: RR GG BB RR GG BB |
| 19 | + * 1: GG BB RR GG BB RR |
| 20 | + * 2: RR GG BB RR GG BB |
| 21 | + * 3: ... |
| 22 | + * |
| 23 | + * We display the odd rows as 50% green in the current pixel, 50% in the next */ |
| 24 | + u8 red, green, blue; |
| 25 | + u8 pixel; |
| 26 | + u32 color; |
| 27 | + u32 *dst = (u32 *)(mVMemBase + y * mBytesPerLine + x * bytes_per_pixel); |
| 28 | + /* To work with white background, we ensure to paint the first pixel */ |
| 29 | + u8 prevgreen = mPalette[bc].green/2; |
| 30 | + |
| 31 | + for (; w--; pixmap++, dst++) { |
| 32 | + u8 newgreen; |
| 33 | + pixel = *pixmap; |
| 34 | + |
| 35 | + red = mPalette[bc].red + (((mPalette[fc].red - mPalette[bc].red) * pixel) >> 8); |
| 36 | + newgreen = mPalette[bc].green + (((mPalette[fc].green - mPalette[bc].green) * pixel) >> 8); |
| 37 | + blue = mPalette[bc].blue + (((mPalette[fc].blue - mPalette[bc].blue) * pixel) >> 8); |
| 38 | + |
| 39 | + /* width == 0 is the special case for the last byte, where we paint full green. |
| 40 | + * That's relevant for white background, like when running 'top'. */ |
| 41 | + green = ((y & 1) == 0 || w == 0) ? newgreen : (newgreen/2 + prevgreen); |
| 42 | + color = (red << 16) | (green << 8) | (blue); |
| 43 | + writel(dst, color); |
| 44 | + prevgreen = newgreen/2; |
| 45 | + } |
| 46 | +} |
| 47 | + |
| 48 | |
| 49 | #define drawXBg(bits, lred, lgreen, lblue, type, fbwrite) \ |
| 50 | \ |
| 51 |
