Several fixes to ieee1275 and big-endian video.

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-05-02 22:30:20 +02:00
parent 813c16222f
commit a8905e8ae8
18 changed files with 655 additions and 72 deletions

View file

@ -416,15 +416,25 @@ grub_video_fbblit_replace_BGRX8888_RGBX8888 (struct grub_video_fbblit_info *dst,
{
for (i = 0; i < width; i++)
{
#ifdef GRUB_CPU_WORDS_BIGENDIAN
grub_uint8_t a = *srcptr++;
#endif
grub_uint8_t r = *srcptr++;
grub_uint8_t g = *srcptr++;
grub_uint8_t b = *srcptr++;
#ifndef GRUB_CPU_WORDS_BIGENDIAN
grub_uint8_t a = *srcptr++;
#endif
#ifdef GRUB_CPU_WORDS_BIGENDIAN
*dstptr++ = a;
#endif
*dstptr++ = b;
*dstptr++ = g;
*dstptr++ = r;
#ifndef GRUB_CPU_WORDS_BIGENDIAN
*dstptr++ = a;
#endif
}
srcptr += srcrowskip;
@ -463,12 +473,19 @@ grub_video_fbblit_replace_BGRX8888_RGB888 (struct grub_video_fbblit_info *dst,
grub_uint8_t g = *srcptr++;
grub_uint8_t b = *srcptr++;
#ifdef GRUB_CPU_WORDS_BIGENDIAN
/* Set alpha component as opaque. */
*dstptr++ = 255;
#endif
*dstptr++ = b;
*dstptr++ = g;
*dstptr++ = r;
#ifndef GRUB_CPU_WORDS_BIGENDIAN
/* Set alpha component as opaque. */
*dstptr++ = 255;
#endif
}
srcptr += srcrowskip;
@ -514,9 +531,15 @@ grub_video_fbblit_replace_BGR888_RGBX8888 (struct grub_video_fbblit_info *dst,
sg = (color >> 8) & 0xFF;
sb = (color >> 16) & 0xFF;
#ifdef GRUB_CPU_WORDS_BIGENDIAN
*dstptr++ = sr;
*dstptr++ = sg;
*dstptr++ = sb;
#else
*dstptr++ = sb;
*dstptr++ = sg;
*dstptr++ = sr;
#endif
}
GRUB_VIDEO_FB_ADVANCE_POINTER (srcptr, srcrowskip);
@ -593,10 +616,15 @@ grub_video_fbblit_replace_RGBX8888_RGB888 (struct grub_video_fbblit_info *dst,
{
for (i = 0; i < width; i++)
{
#ifdef GRUB_CPU_WORDS_BIGENDIAN
sb = *srcptr++;
sg = *srcptr++;
sr = *srcptr++;
#else
sr = *srcptr++;
sg = *srcptr++;
sb = *srcptr++;
#endif
/* Set alpha as opaque. */
color = 0xFF000000 | (sb << 16) | (sg << 8) | sr;
@ -641,9 +669,15 @@ grub_video_fbblit_replace_RGB888_RGBX8888 (struct grub_video_fbblit_info *dst,
sg = (color >> 8) & 0xFF;
sb = (color >> 16) & 0xFF;
#ifndef GRUB_CPU_WORDS_BIGENDIAN
*dstptr++ = sr;
*dstptr++ = sg;
*dstptr++ = sb;
#else
*dstptr++ = sb;
*dstptr++ = sg;
*dstptr++ = sr;
#endif
}
GRUB_VIDEO_FB_ADVANCE_POINTER (srcptr, srcrowskip);
GRUB_VIDEO_FB_ADVANCE_POINTER (dstptr, dstrowskip);
@ -681,9 +715,15 @@ grub_video_fbblit_replace_index_RGBX8888 (struct grub_video_fbblit_info *dst,
{
color = *srcptr++;
#ifdef GRUB_CPU_WORDS_BIGENDIAN
sb = (color >> 0) & 0xFF;
sg = (color >> 8) & 0xFF;
sr = (color >> 16) & 0xFF;
#else
sr = (color >> 0) & 0xFF;
sg = (color >> 8) & 0xFF;
sb = (color >> 16) & 0xFF;
#endif
color = grub_video_fb_map_rgb(sr, sg, sb);
*dstptr++ = color & 0xFF;
@ -722,9 +762,15 @@ grub_video_fbblit_replace_index_RGB888 (struct grub_video_fbblit_info *dst,
{
for (i = 0; i < width; i++)
{
#ifndef GRUB_CPU_WORDS_BIGENDIAN
sr = *srcptr++;
sg = *srcptr++;
sb = *srcptr++;
#else
sb = *srcptr++;
sg = *srcptr++;
sr = *srcptr++;
#endif
color = grub_video_fb_map_rgb(sr, sg, sb);
@ -948,9 +994,15 @@ grub_video_fbblit_blend_BGR888_RGBA8888 (struct grub_video_fbblit_info *dst,
dr = (dr * (255 - a) + sr * a) / 255;
}
#ifndef GRUB_CPU_WORDS_BIGENDIAN
*dstptr++ = db;
*dstptr++ = dg;
*dstptr++ = dr;
#else
*dstptr++ = dr;
*dstptr++ = dg;
*dstptr++ = db;
#endif
}
GRUB_VIDEO_FB_ADVANCE_POINTER (srcptr, srcrowskip);
@ -1079,24 +1131,42 @@ grub_video_fbblit_blend_RGB888_RGBA8888 (struct grub_video_fbblit_info *dst,
if (a == 255)
{
#ifndef GRUB_CPU_WORDS_BIGENDIAN
*dstptr++ = sr;
*dstptr++ = sg;
*dstptr++ = sb;
#else
*dstptr++ = sb;
*dstptr++ = sg;
*dstptr++ = sr;
#endif
continue;
}
#ifndef GRUB_CPU_WORDS_BIGENDIAN
db = dstptr[0];
dg = dstptr[1];
dr = dstptr[2];
#else
dr = dstptr[0];
dg = dstptr[1];
db = dstptr[2];
#endif
dr = (dr * (255 - a) + sr * a) / 255;
dg = (dg * (255 - a) + sg * a) / 255;
db = (db * (255 - a) + sb * a) / 255;
#ifndef GRUB_CPU_WORDS_BIGENDIAN
*dstptr++ = dr;
*dstptr++ = dg;
*dstptr++ = db;
#else
*dstptr++ = db;
*dstptr++ = dg;
*dstptr++ = dr;
#endif
}
GRUB_VIDEO_FB_ADVANCE_POINTER (srcptr, srcrowskip);
GRUB_VIDEO_FB_ADVANCE_POINTER (dstptr, dstrowskip);
@ -1330,9 +1400,15 @@ grub_video_fbblit_blend_XXX888_1bit (struct grub_video_fbblit_info *dst,
if (a == 255)
{
#ifndef GRUB_CPU_WORDS_BIGENDIAN
((grub_uint8_t *) dstptr)[0] = color & 0xff;
((grub_uint8_t *) dstptr)[1] = (color & 0xff00) >> 8;
((grub_uint8_t *) dstptr)[2] = (color & 0xff0000) >> 16;
#else
((grub_uint8_t *) dstptr)[2] = color & 0xff;
((grub_uint8_t *) dstptr)[1] = (color & 0xff00) >> 8;
((grub_uint8_t *) dstptr)[0] = (color & 0xff0000) >> 16;
#endif
}
else if (a != 0)
{

View file

@ -87,10 +87,15 @@ grub_video_fbfill_direct24 (struct grub_video_fbblit_info *dst,
int j;
grub_size_t rowskip;
grub_uint8_t *dstptr;
#ifndef GRUB_CPU_WORDS_BIGENDIAN
grub_uint8_t fill0 = (grub_uint8_t)((color >> 0) & 0xFF);
grub_uint8_t fill1 = (grub_uint8_t)((color >> 8) & 0xFF);
grub_uint8_t fill2 = (grub_uint8_t)((color >> 16) & 0xFF);
#else
grub_uint8_t fill2 = (grub_uint8_t)((color >> 0) & 0xFF);
grub_uint8_t fill1 = (grub_uint8_t)((color >> 8) & 0xFF);
grub_uint8_t fill0 = (grub_uint8_t)((color >> 16) & 0xFF);
#endif
/* Calculate the number of bytes to advance from the end of one line
to the beginning of the next line. */
rowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
@ -122,13 +127,11 @@ grub_video_fbfill_direct16 (struct grub_video_fbblit_info *dst,
int i;
int j;
grub_size_t rowskip;
grub_uint8_t *dstptr;
grub_uint8_t fill0 = (grub_uint8_t)((color >> 0) & 0xFF);
grub_uint8_t fill1 = (grub_uint8_t)((color >> 8) & 0xFF);
grub_uint16_t *dstptr;
/* Calculate the number of bytes to advance from the end of one line
to the beginning of the next line. */
rowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
rowskip = (dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width);
/* Get the start address. */
dstptr = grub_video_fb_get_video_ptr (dst, x, y);
@ -136,13 +139,10 @@ grub_video_fbfill_direct16 (struct grub_video_fbblit_info *dst,
for (j = 0; j < height; j++)
{
for (i = 0; i < width; i++)
{
*dstptr++ = fill0;
*dstptr++ = fill1;
}
*dstptr++ = color;
/* Advance the dest pointer to the right location on the next line. */
dstptr += rowskip;
GRUB_VIDEO_FB_ADVANCE_POINTER (dstptr, rowskip);
}
}

View file

@ -82,7 +82,11 @@ get_pixel (struct grub_video_fbblit_info *source,
{
grub_uint8_t *ptr;
ptr = grub_video_fb_get_video_ptr (source, x, y);
#ifdef GRUB_CPU_WORDS_BIGENDIAN
color = ptr[2] | (ptr[1] << 8) | (ptr[0] << 16);
#else
color = ptr[0] | (ptr[1] << 8) | (ptr[2] << 16);
#endif
}
break;
@ -131,7 +135,11 @@ set_pixel (struct grub_video_fbblit_info *source,
case 24:
{
grub_uint8_t *ptr;
#ifdef GRUB_CPU_WORDS_BIGENDIAN
grub_uint8_t *colorptr = ((grub_uint8_t *)&color) + 1;
#else
grub_uint8_t *colorptr = (grub_uint8_t *)&color;
#endif
ptr = grub_video_fb_get_video_ptr (source, x, y);

View file

@ -59,8 +59,10 @@ static struct
/* Specify "standard" VGA palette, some video cards may
need this and this will also be used when using RGB modes. */
struct grub_video_palette_data grub_video_fbstd_colors[GRUB_VIDEO_FBSTD_NUMCOLORS] =
struct grub_video_palette_data grub_video_fbstd_colors[GRUB_VIDEO_FBSTD_EXT_NUMCOLORS] =
{
/* Standard (3-bit) colors. */
// {R, G, B, A}
{0x00, 0x00, 0x00, 0xFF}, // 0 = black
{0x00, 0x00, 0xA8, 0xFF}, // 1 = blue
@ -71,6 +73,7 @@ struct grub_video_palette_data grub_video_fbstd_colors[GRUB_VIDEO_FBSTD_NUMCOLOR
{0xA8, 0x54, 0x00, 0xFF}, // 6 = brown
{0xA8, 0xA8, 0xA8, 0xFF}, // 7 = light gray
/* Bright (4-bit) colors. */
{0x54, 0x54, 0x54, 0xFF}, // 8 = dark gray
{0x54, 0x54, 0xFE, 0xFF}, // 9 = bright blue
{0x54, 0xFE, 0x54, 0xFF}, // 10 = bright green
@ -78,7 +81,249 @@ struct grub_video_palette_data grub_video_fbstd_colors[GRUB_VIDEO_FBSTD_NUMCOLOR
{0xFE, 0x54, 0x54, 0xFF}, // 12 = bright red
{0xFE, 0x54, 0xFE, 0xFF}, // 13 = bright magenta
{0xFE, 0xFE, 0x54, 0xFF}, // 14 = yellow
{0xFE, 0xFE, 0xFE, 0xFF} // 15 = white
{0xFE, 0xFE, 0xFE, 0xFF}, // 15 = white
/* Extended (8-bit) colors. Completes preceding colors to full RGB332. */
{0x00, 0x00, 0x55, 0xFF}, // RGB332 = (0, 0, 1)
{0x00, 0x00, 0xFF, 0xFF}, // RGB332 = (0, 0, 3)
{0x00, 0x24, 0x00, 0xFF}, // RGB332 = (0, 1, 0)
{0x00, 0x24, 0x55, 0xFF}, // RGB332 = (0, 1, 1)
{0x00, 0x24, 0xAA, 0xFF}, // RGB332 = (0, 1, 2)
{0x00, 0x24, 0xFF, 0xFF}, // RGB332 = (0, 1, 3)
{0x00, 0x48, 0x00, 0xFF}, // RGB332 = (0, 2, 0)
{0x00, 0x48, 0x55, 0xFF}, // RGB332 = (0, 2, 1)
{0x00, 0x48, 0xAA, 0xFF}, // RGB332 = (0, 2, 2)
{0x00, 0x48, 0xFF, 0xFF}, // RGB332 = (0, 2, 3)
{0x00, 0x6C, 0x00, 0xFF}, // RGB332 = (0, 3, 0)
{0x00, 0x6C, 0x55, 0xFF}, // RGB332 = (0, 3, 1)
{0x00, 0x6C, 0xAA, 0xFF}, // RGB332 = (0, 3, 2)
{0x00, 0x6C, 0xFF, 0xFF}, // RGB332 = (0, 3, 3)
{0x00, 0x90, 0x00, 0xFF}, // RGB332 = (0, 4, 0)
{0x00, 0x90, 0x55, 0xFF}, // RGB332 = (0, 4, 1)
{0x00, 0x90, 0xAA, 0xFF}, // RGB332 = (0, 4, 2)
{0x00, 0x90, 0xFF, 0xFF}, // RGB332 = (0, 4, 3)
{0x00, 0xB4, 0x55, 0xFF}, // RGB332 = (0, 5, 1)
{0x00, 0xB4, 0xFF, 0xFF}, // RGB332 = (0, 5, 3)
{0x00, 0xD8, 0x00, 0xFF}, // RGB332 = (0, 6, 0)
{0x00, 0xD8, 0x55, 0xFF}, // RGB332 = (0, 6, 1)
{0x00, 0xD8, 0xAA, 0xFF}, // RGB332 = (0, 6, 2)
{0x00, 0xD8, 0xFF, 0xFF}, // RGB332 = (0, 6, 3)
{0x00, 0xFC, 0x00, 0xFF}, // RGB332 = (0, 7, 0)
{0x00, 0xFC, 0x55, 0xFF}, // RGB332 = (0, 7, 1)
{0x00, 0xFC, 0xAA, 0xFF}, // RGB332 = (0, 7, 2)
{0x00, 0xFC, 0xFF, 0xFF}, // RGB332 = (0, 7, 3)
{0x24, 0x00, 0x00, 0xFF}, // RGB332 = (1, 0, 0)
{0x24, 0x00, 0x55, 0xFF}, // RGB332 = (1, 0, 1)
{0x24, 0x00, 0xAA, 0xFF}, // RGB332 = (1, 0, 2)
{0x24, 0x00, 0xFF, 0xFF}, // RGB332 = (1, 0, 3)
{0x24, 0x24, 0x00, 0xFF}, // RGB332 = (1, 1, 0)
{0x24, 0x24, 0x55, 0xFF}, // RGB332 = (1, 1, 1)
{0x24, 0x24, 0xAA, 0xFF}, // RGB332 = (1, 1, 2)
{0x24, 0x24, 0xFF, 0xFF}, // RGB332 = (1, 1, 3)
{0x24, 0x48, 0x00, 0xFF}, // RGB332 = (1, 2, 0)
{0x24, 0x48, 0x55, 0xFF}, // RGB332 = (1, 2, 1)
{0x24, 0x48, 0xAA, 0xFF}, // RGB332 = (1, 2, 2)
{0x24, 0x48, 0xFF, 0xFF}, // RGB332 = (1, 2, 3)
{0x24, 0x6C, 0x00, 0xFF}, // RGB332 = (1, 3, 0)
{0x24, 0x6C, 0x55, 0xFF}, // RGB332 = (1, 3, 1)
{0x24, 0x6C, 0xAA, 0xFF}, // RGB332 = (1, 3, 2)
{0x24, 0x6C, 0xFF, 0xFF}, // RGB332 = (1, 3, 3)
{0x24, 0x90, 0x00, 0xFF}, // RGB332 = (1, 4, 0)
{0x24, 0x90, 0x55, 0xFF}, // RGB332 = (1, 4, 1)
{0x24, 0x90, 0xAA, 0xFF}, // RGB332 = (1, 4, 2)
{0x24, 0x90, 0xFF, 0xFF}, // RGB332 = (1, 4, 3)
{0x24, 0xB4, 0x00, 0xFF}, // RGB332 = (1, 5, 0)
{0x24, 0xB4, 0x55, 0xFF}, // RGB332 = (1, 5, 1)
{0x24, 0xB4, 0xAA, 0xFF}, // RGB332 = (1, 5, 2)
{0x24, 0xB4, 0xFF, 0xFF}, // RGB332 = (1, 5, 3)
{0x24, 0xD8, 0x00, 0xFF}, // RGB332 = (1, 6, 0)
{0x24, 0xD8, 0x55, 0xFF}, // RGB332 = (1, 6, 1)
{0x24, 0xD8, 0xAA, 0xFF}, // RGB332 = (1, 6, 2)
{0x24, 0xD8, 0xFF, 0xFF}, // RGB332 = (1, 6, 3)
{0x24, 0xFC, 0x00, 0xFF}, // RGB332 = (1, 7, 0)
{0x24, 0xFC, 0x55, 0xFF}, // RGB332 = (1, 7, 1)
{0x24, 0xFC, 0xAA, 0xFF}, // RGB332 = (1, 7, 2)
{0x24, 0xFC, 0xFF, 0xFF}, // RGB332 = (1, 7, 3)
{0x48, 0x00, 0x00, 0xFF}, // RGB332 = (2, 0, 0)
{0x48, 0x00, 0x55, 0xFF}, // RGB332 = (2, 0, 1)
{0x48, 0x00, 0xAA, 0xFF}, // RGB332 = (2, 0, 2)
{0x48, 0x00, 0xFF, 0xFF}, // RGB332 = (2, 0, 3)
{0x48, 0x24, 0x00, 0xFF}, // RGB332 = (2, 1, 0)
{0x48, 0x24, 0x55, 0xFF}, // RGB332 = (2, 1, 1)
{0x48, 0x24, 0xAA, 0xFF}, // RGB332 = (2, 1, 2)
{0x48, 0x24, 0xFF, 0xFF}, // RGB332 = (2, 1, 3)
{0x48, 0x48, 0x00, 0xFF}, // RGB332 = (2, 2, 0)
{0x48, 0x48, 0xAA, 0xFF}, // RGB332 = (2, 2, 2)
{0x48, 0x6C, 0x00, 0xFF}, // RGB332 = (2, 3, 0)
{0x48, 0x6C, 0x55, 0xFF}, // RGB332 = (2, 3, 1)
{0x48, 0x6C, 0xAA, 0xFF}, // RGB332 = (2, 3, 2)
{0x48, 0x6C, 0xFF, 0xFF}, // RGB332 = (2, 3, 3)
{0x48, 0x90, 0x00, 0xFF}, // RGB332 = (2, 4, 0)
{0x48, 0x90, 0x55, 0xFF}, // RGB332 = (2, 4, 1)
{0x48, 0x90, 0xAA, 0xFF}, // RGB332 = (2, 4, 2)
{0x48, 0x90, 0xFF, 0xFF}, // RGB332 = (2, 4, 3)
{0x48, 0xB4, 0x00, 0xFF}, // RGB332 = (2, 5, 0)
{0x48, 0xB4, 0x55, 0xFF}, // RGB332 = (2, 5, 1)
{0x48, 0xB4, 0xAA, 0xFF}, // RGB332 = (2, 5, 2)
{0x48, 0xB4, 0xFF, 0xFF}, // RGB332 = (2, 5, 3)
{0x48, 0xD8, 0x00, 0xFF}, // RGB332 = (2, 6, 0)
{0x48, 0xD8, 0x55, 0xFF}, // RGB332 = (2, 6, 1)
{0x48, 0xD8, 0xAA, 0xFF}, // RGB332 = (2, 6, 2)
{0x48, 0xD8, 0xFF, 0xFF}, // RGB332 = (2, 6, 3)
{0x48, 0xFC, 0x00, 0xFF}, // RGB332 = (2, 7, 0)
{0x48, 0xFC, 0xAA, 0xFF}, // RGB332 = (2, 7, 2)
{0x6C, 0x00, 0x00, 0xFF}, // RGB332 = (3, 0, 0)
{0x6C, 0x00, 0x55, 0xFF}, // RGB332 = (3, 0, 1)
{0x6C, 0x00, 0xAA, 0xFF}, // RGB332 = (3, 0, 2)
{0x6C, 0x00, 0xFF, 0xFF}, // RGB332 = (3, 0, 3)
{0x6C, 0x24, 0x00, 0xFF}, // RGB332 = (3, 1, 0)
{0x6C, 0x24, 0x55, 0xFF}, // RGB332 = (3, 1, 1)
{0x6C, 0x24, 0xAA, 0xFF}, // RGB332 = (3, 1, 2)
{0x6C, 0x24, 0xFF, 0xFF}, // RGB332 = (3, 1, 3)
{0x6C, 0x48, 0x00, 0xFF}, // RGB332 = (3, 2, 0)
{0x6C, 0x48, 0x55, 0xFF}, // RGB332 = (3, 2, 1)
{0x6C, 0x48, 0xAA, 0xFF}, // RGB332 = (3, 2, 2)
{0x6C, 0x48, 0xFF, 0xFF}, // RGB332 = (3, 2, 3)
{0x6C, 0x6C, 0x00, 0xFF}, // RGB332 = (3, 3, 0)
{0x6C, 0x6C, 0x55, 0xFF}, // RGB332 = (3, 3, 1)
{0x6C, 0x6C, 0xAA, 0xFF}, // RGB332 = (3, 3, 2)
{0x6C, 0x6C, 0xFF, 0xFF}, // RGB332 = (3, 3, 3)
{0x6C, 0x90, 0x00, 0xFF}, // RGB332 = (3, 4, 0)
{0x6C, 0x90, 0x55, 0xFF}, // RGB332 = (3, 4, 1)
{0x6C, 0x90, 0xAA, 0xFF}, // RGB332 = (3, 4, 2)
{0x6C, 0x90, 0xFF, 0xFF}, // RGB332 = (3, 4, 3)
{0x6C, 0xB4, 0x00, 0xFF}, // RGB332 = (3, 5, 0)
{0x6C, 0xB4, 0x55, 0xFF}, // RGB332 = (3, 5, 1)
{0x6C, 0xB4, 0xAA, 0xFF}, // RGB332 = (3, 5, 2)
{0x6C, 0xB4, 0xFF, 0xFF}, // RGB332 = (3, 5, 3)
{0x6C, 0xD8, 0x00, 0xFF}, // RGB332 = (3, 6, 0)
{0x6C, 0xD8, 0x55, 0xFF}, // RGB332 = (3, 6, 1)
{0x6C, 0xD8, 0xAA, 0xFF}, // RGB332 = (3, 6, 2)
{0x6C, 0xD8, 0xFF, 0xFF}, // RGB332 = (3, 6, 3)
{0x6C, 0xFC, 0x00, 0xFF}, // RGB332 = (3, 7, 0)
{0x6C, 0xFC, 0x55, 0xFF}, // RGB332 = (3, 7, 1)
{0x6C, 0xFC, 0xAA, 0xFF}, // RGB332 = (3, 7, 2)
{0x6C, 0xFC, 0xFF, 0xFF}, // RGB332 = (3, 7, 3)
{0x90, 0x00, 0x00, 0xFF}, // RGB332 = (4, 0, 0)
{0x90, 0x00, 0x55, 0xFF}, // RGB332 = (4, 0, 1)
{0x90, 0x00, 0xAA, 0xFF}, // RGB332 = (4, 0, 2)
{0x90, 0x00, 0xFF, 0xFF}, // RGB332 = (4, 0, 3)
{0x90, 0x24, 0x00, 0xFF}, // RGB332 = (4, 1, 0)
{0x90, 0x24, 0x55, 0xFF}, // RGB332 = (4, 1, 1)
{0x90, 0x24, 0xAA, 0xFF}, // RGB332 = (4, 1, 2)
{0x90, 0x24, 0xFF, 0xFF}, // RGB332 = (4, 1, 3)
{0x90, 0x48, 0x00, 0xFF}, // RGB332 = (4, 2, 0)
{0x90, 0x48, 0x55, 0xFF}, // RGB332 = (4, 2, 1)
{0x90, 0x48, 0xAA, 0xFF}, // RGB332 = (4, 2, 2)
{0x90, 0x48, 0xFF, 0xFF}, // RGB332 = (4, 2, 3)
{0x90, 0x6C, 0x00, 0xFF}, // RGB332 = (4, 3, 0)
{0x90, 0x6C, 0x55, 0xFF}, // RGB332 = (4, 3, 1)
{0x90, 0x6C, 0xAA, 0xFF}, // RGB332 = (4, 3, 2)
{0x90, 0x6C, 0xFF, 0xFF}, // RGB332 = (4, 3, 3)
{0x90, 0x90, 0x00, 0xFF}, // RGB332 = (4, 4, 0)
{0x90, 0x90, 0x55, 0xFF}, // RGB332 = (4, 4, 1)
{0x90, 0x90, 0xAA, 0xFF}, // RGB332 = (4, 4, 2)
{0x90, 0x90, 0xFF, 0xFF}, // RGB332 = (4, 4, 3)
{0x90, 0xB4, 0x00, 0xFF}, // RGB332 = (4, 5, 0)
{0x90, 0xB4, 0x55, 0xFF}, // RGB332 = (4, 5, 1)
{0x90, 0xB4, 0xAA, 0xFF}, // RGB332 = (4, 5, 2)
{0x90, 0xB4, 0xFF, 0xFF}, // RGB332 = (4, 5, 3)
{0x90, 0xD8, 0x00, 0xFF}, // RGB332 = (4, 6, 0)
{0x90, 0xD8, 0x55, 0xFF}, // RGB332 = (4, 6, 1)
{0x90, 0xD8, 0xAA, 0xFF}, // RGB332 = (4, 6, 2)
{0x90, 0xD8, 0xFF, 0xFF}, // RGB332 = (4, 6, 3)
{0x90, 0xFC, 0x00, 0xFF}, // RGB332 = (4, 7, 0)
{0x90, 0xFC, 0x55, 0xFF}, // RGB332 = (4, 7, 1)
{0x90, 0xFC, 0xAA, 0xFF}, // RGB332 = (4, 7, 2)
{0x90, 0xFC, 0xFF, 0xFF}, // RGB332 = (4, 7, 3)
{0xB4, 0x00, 0x55, 0xFF}, // RGB332 = (5, 0, 1)
{0xB4, 0x00, 0xFF, 0xFF}, // RGB332 = (5, 0, 3)
{0xB4, 0x24, 0x00, 0xFF}, // RGB332 = (5, 1, 0)
{0xB4, 0x24, 0x55, 0xFF}, // RGB332 = (5, 1, 1)
{0xB4, 0x24, 0xAA, 0xFF}, // RGB332 = (5, 1, 2)
{0xB4, 0x24, 0xFF, 0xFF}, // RGB332 = (5, 1, 3)
{0xB4, 0x48, 0x55, 0xFF}, // RGB332 = (5, 2, 1)
{0xB4, 0x48, 0xAA, 0xFF}, // RGB332 = (5, 2, 2)
{0xB4, 0x48, 0xFF, 0xFF}, // RGB332 = (5, 2, 3)
{0xB4, 0x6C, 0x00, 0xFF}, // RGB332 = (5, 3, 0)
{0xB4, 0x6C, 0x55, 0xFF}, // RGB332 = (5, 3, 1)
{0xB4, 0x6C, 0xAA, 0xFF}, // RGB332 = (5, 3, 2)
{0xB4, 0x6C, 0xFF, 0xFF}, // RGB332 = (5, 3, 3)
{0xB4, 0x90, 0x00, 0xFF}, // RGB332 = (5, 4, 0)
{0xB4, 0x90, 0x55, 0xFF}, // RGB332 = (5, 4, 1)
{0xB4, 0x90, 0xAA, 0xFF}, // RGB332 = (5, 4, 2)
{0xB4, 0x90, 0xFF, 0xFF}, // RGB332 = (5, 4, 3)
{0xB4, 0xB4, 0x00, 0xFF}, // RGB332 = (5, 5, 0)
{0xB4, 0xB4, 0x55, 0xFF}, // RGB332 = (5, 5, 1)
{0xB4, 0xB4, 0xFF, 0xFF}, // RGB332 = (5, 5, 3)
{0xB4, 0xD8, 0x00, 0xFF}, // RGB332 = (5, 6, 0)
{0xB4, 0xD8, 0x55, 0xFF}, // RGB332 = (5, 6, 1)
{0xB4, 0xD8, 0xAA, 0xFF}, // RGB332 = (5, 6, 2)
{0xB4, 0xD8, 0xFF, 0xFF}, // RGB332 = (5, 6, 3)
{0xB4, 0xFC, 0x00, 0xFF}, // RGB332 = (5, 7, 0)
{0xB4, 0xFC, 0x55, 0xFF}, // RGB332 = (5, 7, 1)
{0xB4, 0xFC, 0xAA, 0xFF}, // RGB332 = (5, 7, 2)
{0xB4, 0xFC, 0xFF, 0xFF}, // RGB332 = (5, 7, 3)
{0xD8, 0x00, 0x00, 0xFF}, // RGB332 = (6, 0, 0)
{0xD8, 0x00, 0x55, 0xFF}, // RGB332 = (6, 0, 1)
{0xD8, 0x00, 0xAA, 0xFF}, // RGB332 = (6, 0, 2)
{0xD8, 0x00, 0xFF, 0xFF}, // RGB332 = (6, 0, 3)
{0xD8, 0x24, 0x00, 0xFF}, // RGB332 = (6, 1, 0)
{0xD8, 0x24, 0x55, 0xFF}, // RGB332 = (6, 1, 1)
{0xD8, 0x24, 0xAA, 0xFF}, // RGB332 = (6, 1, 2)
{0xD8, 0x24, 0xFF, 0xFF}, // RGB332 = (6, 1, 3)
{0xD8, 0x48, 0x00, 0xFF}, // RGB332 = (6, 2, 0)
{0xD8, 0x48, 0x55, 0xFF}, // RGB332 = (6, 2, 1)
{0xD8, 0x48, 0xAA, 0xFF}, // RGB332 = (6, 2, 2)
{0xD8, 0x48, 0xFF, 0xFF}, // RGB332 = (6, 2, 3)
{0xD8, 0x6C, 0x00, 0xFF}, // RGB332 = (6, 3, 0)
{0xD8, 0x6C, 0x55, 0xFF}, // RGB332 = (6, 3, 1)
{0xD8, 0x6C, 0xAA, 0xFF}, // RGB332 = (6, 3, 2)
{0xD8, 0x6C, 0xFF, 0xFF}, // RGB332 = (6, 3, 3)
{0xD8, 0x90, 0x00, 0xFF}, // RGB332 = (6, 4, 0)
{0xD8, 0x90, 0x55, 0xFF}, // RGB332 = (6, 4, 1)
{0xD8, 0x90, 0xAA, 0xFF}, // RGB332 = (6, 4, 2)
{0xD8, 0x90, 0xFF, 0xFF}, // RGB332 = (6, 4, 3)
{0xD8, 0xB4, 0x00, 0xFF}, // RGB332 = (6, 5, 0)
{0xD8, 0xB4, 0x55, 0xFF}, // RGB332 = (6, 5, 1)
{0xD8, 0xB4, 0xAA, 0xFF}, // RGB332 = (6, 5, 2)
{0xD8, 0xB4, 0xFF, 0xFF}, // RGB332 = (6, 5, 3)
{0xD8, 0xD8, 0x00, 0xFF}, // RGB332 = (6, 6, 0)
{0xD8, 0xD8, 0x55, 0xFF}, // RGB332 = (6, 6, 1)
{0xD8, 0xD8, 0xAA, 0xFF}, // RGB332 = (6, 6, 2)
{0xD8, 0xD8, 0xFF, 0xFF}, // RGB332 = (6, 6, 3)
{0xD8, 0xFC, 0x00, 0xFF}, // RGB332 = (6, 7, 0)
{0xD8, 0xFC, 0x55, 0xFF}, // RGB332 = (6, 7, 1)
{0xD8, 0xFC, 0xAA, 0xFF}, // RGB332 = (6, 7, 2)
{0xD8, 0xFC, 0xFF, 0xFF}, // RGB332 = (6, 7, 3)
{0xFC, 0x00, 0x00, 0xFF}, // RGB332 = (7, 0, 0)
{0xFC, 0x00, 0x55, 0xFF}, // RGB332 = (7, 0, 1)
{0xFC, 0x00, 0xAA, 0xFF}, // RGB332 = (7, 0, 2)
{0xFC, 0x00, 0xFF, 0xFF}, // RGB332 = (7, 0, 3)
{0xFC, 0x24, 0x00, 0xFF}, // RGB332 = (7, 1, 0)
{0xFC, 0x24, 0x55, 0xFF}, // RGB332 = (7, 1, 1)
{0xFC, 0x24, 0xAA, 0xFF}, // RGB332 = (7, 1, 2)
{0xFC, 0x24, 0xFF, 0xFF}, // RGB332 = (7, 1, 3)
{0xFC, 0x48, 0x00, 0xFF}, // RGB332 = (7, 2, 0)
{0xFC, 0x48, 0xAA, 0xFF}, // RGB332 = (7, 2, 2)
{0xFC, 0x6C, 0x00, 0xFF}, // RGB332 = (7, 3, 0)
{0xFC, 0x6C, 0x55, 0xFF}, // RGB332 = (7, 3, 1)
{0xFC, 0x6C, 0xAA, 0xFF}, // RGB332 = (7, 3, 2)
{0xFC, 0x6C, 0xFF, 0xFF}, // RGB332 = (7, 3, 3)
{0xFC, 0x90, 0x00, 0xFF}, // RGB332 = (7, 4, 0)
{0xFC, 0x90, 0x55, 0xFF}, // RGB332 = (7, 4, 1)
{0xFC, 0x90, 0xAA, 0xFF}, // RGB332 = (7, 4, 2)
{0xFC, 0x90, 0xFF, 0xFF}, // RGB332 = (7, 4, 3)
{0xFC, 0xB4, 0x00, 0xFF}, // RGB332 = (7, 5, 0)
{0xFC, 0xB4, 0x55, 0xFF}, // RGB332 = (7, 5, 1)
{0xFC, 0xB4, 0xAA, 0xFF}, // RGB332 = (7, 5, 2)
{0xFC, 0xB4, 0xFF, 0xFF}, // RGB332 = (7, 5, 3)
{0xFC, 0xD8, 0x00, 0xFF}, // RGB332 = (7, 6, 0)
{0xFC, 0xD8, 0x55, 0xFF}, // RGB332 = (7, 6, 1)
{0xFC, 0xD8, 0xAA, 0xFF}, // RGB332 = (7, 6, 2)
{0xFC, 0xD8, 0xFF, 0xFF}, // RGB332 = (7, 6, 3)
{0xFC, 0xFC, 0x00, 0xFF}, // RGB332 = (7, 7, 0)
{0xFC, 0xFC, 0xAA, 0xFF}, // RGB332 = (7, 7, 2)
};
grub_err_t
@ -487,38 +732,21 @@ grub_video_fb_fill_rect (grub_video_color_t color, int x, int y,
/* Try to figure out more optimized version. Note that color is already
mapped to target format so we can make assumptions based on that. */
if (target.mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_BGRA_8888)
switch (target.mode_info->bytes_per_pixel)
{
case 4:
grub_video_fbfill_direct32 (&target, color, x, y,
width, height);
width, height);
return GRUB_ERR_NONE;
}
else if (target.mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_RGBA_8888)
{
grub_video_fbfill_direct32 (&target, color, x, y,
width, height);
return GRUB_ERR_NONE;
}
else if (target.mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_RGB_888)
{
case 3:
grub_video_fbfill_direct24 (&target, color, x, y,
width, height);
width, height);
return GRUB_ERR_NONE;
}
else if (target.mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_RGB_565)
{
case 2:
grub_video_fbfill_direct16 (&target, color, x, y,
width, height);
return GRUB_ERR_NONE;
}
else if (target.mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_BGR_565)
{
grub_video_fbfill_direct16 (&target, color, x, y,
width, height);
return GRUB_ERR_NONE;
}
else if (target.mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR)
{
case 1:
grub_video_fbfill_direct8 (&target, color, x, y,
width, height);
return GRUB_ERR_NONE;