Move blit and fill dispatcher to appropriate files to decrease export

and relocation overhead.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-05-30 22:06:28 +02:00
parent b8323067e8
commit 6570b2050e
7 changed files with 394 additions and 601 deletions

View file

@ -34,7 +34,7 @@
#include <grub/video.h>
/* Generic filler that works for every supported mode. */
void
static void
grub_video_fbfill (struct grub_video_fbblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height)
@ -49,7 +49,7 @@ grub_video_fbfill (struct grub_video_fbblit_info *dst,
/* Optimized filler for direct color 32 bit modes. It is assumed that color
is already mapped to destination format. */
void
static void
grub_video_fbfill_direct32 (struct grub_video_fbblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height)
@ -78,7 +78,7 @@ grub_video_fbfill_direct32 (struct grub_video_fbblit_info *dst,
/* Optimized filler for direct color 24 bit modes. It is assumed that color
is already mapped to destination format. */
void
static void
grub_video_fbfill_direct24 (struct grub_video_fbblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height)
@ -119,7 +119,7 @@ grub_video_fbfill_direct24 (struct grub_video_fbblit_info *dst,
/* Optimized filler for direct color 16 bit modes. It is assumed that color
is already mapped to destination format. */
void
static void
grub_video_fbfill_direct16 (struct grub_video_fbblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height)
@ -148,7 +148,7 @@ grub_video_fbfill_direct16 (struct grub_video_fbblit_info *dst,
/* Optimized filler for index color. It is assumed that color
is already mapped to destination format. */
void
static void
grub_video_fbfill_direct8 (struct grub_video_fbblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height)
@ -175,3 +175,34 @@ grub_video_fbfill_direct8 (struct grub_video_fbblit_info *dst,
dstptr += rowskip;
}
}
void
grub_video_fb_fill_dispatch (struct grub_video_fbblit_info *target,
grub_video_color_t color, int x, int y,
unsigned int width, unsigned int height)
{
/* Try to figure out more optimized version. Note that color is already
mapped to target format so we can make assumptions based on that. */
switch (target->mode_info->bytes_per_pixel)
{
case 4:
grub_video_fbfill_direct32 (target, color, x, y,
width, height);
return;
case 3:
grub_video_fbfill_direct24 (target, color, x, y,
width, height);
return;
case 2:
grub_video_fbfill_direct16 (target, color, x, y,
width, height);
return;
case 1:
grub_video_fbfill_direct8 (target, color, x, y,
width, height);
return;
}
/* No optimized version found, use default (slow) filler. */
grub_video_fbfill (target, color, x, y, width, height);
}