Several fixes to ieee1275 and big-endian video.
This commit is contained in:
parent
813c16222f
commit
a8905e8ae8
18 changed files with 655 additions and 72 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue