mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
lcd-24bit: Introduce a 24-bit mid-level LCD driver
With LCD driver all calculation will be performed on RGB888 and the hardware/OS can display from our 24bit framebuffer. It is not yet as performance optimized as the existing drivers but should be good enough.The vast number of small changes is due to the fact that fb_data can be a struct type now, while most of the code expected a scalar type. lcd-as-memframe ASM code does not work with 24bit currently so the with 24bit it enforces the generic C code. All plugins are ported over. Except for rockpaint. It uses so much memory that it wouldnt fit into the 512k plugin buffer anymore (patches welcome). Change-Id: Ibb1964545028ce0d8ff9833ccc3ab66be3ee0754
This commit is contained in:
parent
0250be1d67
commit
a1842c04f9
49 changed files with 1653 additions and 341 deletions
|
@ -702,7 +702,7 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src,
|
|||
dst_col--;
|
||||
|
||||
if (data & 1)
|
||||
*dst_col = fg_pattern;
|
||||
*dst_col = FB_SCALARPACK(fg_pattern);
|
||||
#if 0
|
||||
else
|
||||
*dst_col = bg_pattern;
|
||||
|
@ -719,7 +719,7 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src,
|
|||
while (src < src_end);
|
||||
}
|
||||
|
||||
/* draw alpha bitmap for anti-alias font */
|
||||
|
||||
#define ALPHA_COLOR_FONT_DEPTH 2
|
||||
#define ALPHA_COLOR_LOOKUP_SHIFT (1 << ALPHA_COLOR_FONT_DEPTH)
|
||||
#define ALPHA_COLOR_LOOKUP_SIZE ((1 << ALPHA_COLOR_LOOKUP_SHIFT) - 1)
|
||||
|
@ -727,6 +727,7 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src,
|
|||
#define ALPHA_COLOR_PIXEL_PER_WORD (32 >> ALPHA_COLOR_FONT_DEPTH)
|
||||
#ifdef CPU_ARM
|
||||
#define BLEND_INIT do {} while (0)
|
||||
#define BLEND_FINISH do {} while(0)
|
||||
#define BLEND_START(acc, color, alpha) \
|
||||
asm volatile("mul %0, %1, %2" : "=&r" (acc) : "r" (color), "r" (alpha))
|
||||
#define BLEND_CONT(acc, color, alpha) \
|
||||
|
@ -734,13 +735,18 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src,
|
|||
#define BLEND_OUT(acc) do {} while (0)
|
||||
#elif defined(CPU_COLDFIRE)
|
||||
#define ALPHA_BITMAP_READ_WORDS
|
||||
#define BLEND_INIT coldfire_set_macsr(EMAC_UNSIGNED)
|
||||
#define BLEND_INIT \
|
||||
unsigned long _macsr = coldfire_get_macsr(); \
|
||||
coldfire_set_macsr(EMAC_UNSIGNED)
|
||||
#define BLEND_FINISH \
|
||||
coldfire_set_macsr(_macsr)
|
||||
#define BLEND_START(acc, color, alpha) \
|
||||
asm volatile("mac.l %0, %1, %%acc0" :: "%d" (color), "d" (alpha))
|
||||
#define BLEND_CONT BLEND_START
|
||||
#define BLEND_OUT(acc) asm volatile("movclr.l %%acc0, %0" : "=d" (acc))
|
||||
#else
|
||||
#define BLEND_INIT do {} while (0)
|
||||
#define BLEND_FINISH do {} while(0)
|
||||
#define BLEND_START(acc, color, alpha) ((acc) = (color) * (alpha))
|
||||
#define BLEND_CONT(acc, color, alpha) ((acc) += (color) * (alpha))
|
||||
#define BLEND_OUT(acc) do {} while (0)
|
||||
|
@ -749,6 +755,7 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src,
|
|||
/* Blend the given two colors */
|
||||
static inline unsigned blend_two_colors(unsigned c1, unsigned c2, unsigned a)
|
||||
{
|
||||
#if LCD_DEPTH == 16
|
||||
a += a >> (ALPHA_COLOR_LOOKUP_SHIFT - 1);
|
||||
#if (LCD_PIXELFORMAT == RGB565SWAPPED)
|
||||
c1 = swap16(c1);
|
||||
|
@ -767,6 +774,20 @@ static inline unsigned blend_two_colors(unsigned c1, unsigned c2, unsigned a)
|
|||
#else
|
||||
return p;
|
||||
#endif
|
||||
|
||||
#else /* LCD_DEPTH == 24 */
|
||||
unsigned s = c1;
|
||||
unsigned d = c2;
|
||||
unsigned s1 = s & 0xff00ff;
|
||||
unsigned d1 = d & 0xff00ff;
|
||||
a += a >> (ALPHA_COLOR_LOOKUP_SHIFT - 1);
|
||||
d1 = (d1 + ((s1 - d1) * a >> ALPHA_COLOR_LOOKUP_SHIFT)) & 0xff00ff;
|
||||
s &= 0xff00;
|
||||
d &= 0xff00;
|
||||
d = (d + ((s - d) * a >> ALPHA_COLOR_LOOKUP_SHIFT)) & 0xff00;
|
||||
|
||||
return d1 | d;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void draw_oriented_alpha_bitmap_part(const unsigned char *src,
|
||||
|
@ -849,8 +870,9 @@ static void draw_oriented_alpha_bitmap_part(const unsigned char *src,
|
|||
#endif
|
||||
do
|
||||
{
|
||||
*dst=blend_two_colors(*dst, fg_pattern,
|
||||
data & ALPHA_COLOR_LOOKUP_SIZE );
|
||||
unsigned color = blend_two_colors(FB_UNPACK_SCALAR_LCD(*dst), fg_pattern,
|
||||
data & ALPHA_COLOR_LOOKUP_SIZE );
|
||||
*dst= FB_SCALARPACK(color);
|
||||
dst += LCD_WIDTH;
|
||||
UPDATE_SRC_ALPHA;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue