2009-08-17 Michal Suchanek <hramrach@centrum.cz>
Remove duplicate grub_video_fb_get_video_ptr. * include/grub/fbutil.h (get_data_ptr): Rename to ... (grub_video_fb_get_video_ptr): ... this. * include/grub/video_fb.h (grub_video_fb_get_video_ptr): Removed. * video/fb/fbutil.c: Add comment about addressing. (get_data_ptr): Rename to ... (grub_video_fb_get_video_ptr): ... this. All users updated. * video/fb/video_fb.c (grub_video_fb_get_video_ptr): Remove.
This commit is contained in:
parent
cc8c6fafe9
commit
6025fcd7f9
6 changed files with 61 additions and 79 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2009-08-17 Michal Suchanek <hramrach@centrum.cz>
|
||||
|
||||
Remove duplicate grub_video_fb_get_video_ptr.
|
||||
|
||||
* include/grub/fbutil.h (get_data_ptr): Rename to ...
|
||||
(grub_video_fb_get_video_ptr): ... this.
|
||||
* include/grub/video_fb.h (grub_video_fb_get_video_ptr): Removed.
|
||||
* video/fb/fbutil.c: Add comment about addressing.
|
||||
(get_data_ptr): Rename to ...
|
||||
(grub_video_fb_get_video_ptr): ... this. All users updated.
|
||||
* video/fb/video_fb.c (grub_video_fb_get_video_ptr): Remove.
|
||||
|
||||
2009-08-17 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* fs/fat.c (grub_fat_read_data): Remove `#if 0' braces around the
|
||||
|
|
|
@ -31,7 +31,7 @@ struct grub_video_fbblit_info
|
|||
void *data;
|
||||
};
|
||||
|
||||
grub_uint8_t *get_data_ptr (struct grub_video_fbblit_info *source,
|
||||
grub_uint8_t *grub_video_fb_get_video_ptr (struct grub_video_fbblit_info *source,
|
||||
unsigned int x, unsigned int y);
|
||||
|
||||
grub_video_color_t get_pixel (struct grub_video_fbblit_info *source,
|
||||
|
|
|
@ -33,9 +33,6 @@ struct grub_video_fbrender_target;
|
|||
#define GRUB_VIDEO_FBSTD_NUMCOLORS 16
|
||||
extern struct grub_video_palette_data grub_video_fbstd_colors[GRUB_VIDEO_FBSTD_NUMCOLORS];
|
||||
|
||||
grub_uint8_t * grub_video_fb_get_video_ptr (struct grub_video_fbblit_info *source,
|
||||
grub_uint32_t x, grub_uint32_t y);
|
||||
|
||||
grub_err_t
|
||||
grub_video_fb_init (void);
|
||||
|
||||
|
|
|
@ -83,8 +83,8 @@ grub_video_fbblit_replace_directN (struct grub_video_fbblit_info *dst,
|
|||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
srcptr = (grub_uint32_t *)get_data_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint32_t *)get_data_ptr (dst, x, y + j);
|
||||
srcptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (dst, x, y + j);
|
||||
|
||||
grub_memmove (dstptr, srcptr, width * bpp);
|
||||
}
|
||||
|
@ -110,8 +110,8 @@ grub_video_fbblit_replace_BGRX8888_RGBX8888 (struct grub_video_fbblit_info *dst,
|
|||
srcrowskip = src->mode_info->pitch - src->mode_info->bytes_per_pixel * width;
|
||||
dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
|
||||
srcptr = (grub_uint8_t *) get_data_ptr (src, offset_x, offset_y);
|
||||
dstptr = (grub_uint8_t *) get_data_ptr (dst, x, y);
|
||||
srcptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (src, offset_x, offset_y);
|
||||
dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y);
|
||||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
|
@ -153,8 +153,8 @@ grub_video_fbblit_replace_BGRX8888_RGB888 (struct grub_video_fbblit_info *dst,
|
|||
srcrowskip = src->mode_info->pitch - src->mode_info->bytes_per_pixel * width;
|
||||
dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
|
||||
srcptr = (grub_uint8_t *) get_data_ptr (src, offset_x, offset_y);
|
||||
dstptr = (grub_uint8_t *) get_data_ptr (dst, x, y);
|
||||
srcptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (src, offset_x, offset_y);
|
||||
dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y);
|
||||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
|
@ -197,8 +197,8 @@ grub_video_fbblit_replace_BGR888_RGBX8888 (struct grub_video_fbblit_info *dst,
|
|||
srcrowskip = src->mode_info->pitch - src->mode_info->bytes_per_pixel * width;
|
||||
dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
|
||||
srcptr = (grub_uint32_t *) get_data_ptr (src, offset_x, offset_y);
|
||||
dstptr = (grub_uint8_t *) get_data_ptr (dst, x, y);
|
||||
srcptr = (grub_uint32_t *) grub_video_fb_get_video_ptr (src, offset_x, offset_y);
|
||||
dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y);
|
||||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
|
@ -245,8 +245,8 @@ grub_video_fbblit_replace_BGR888_RGB888 (struct grub_video_fbblit_info *dst,
|
|||
srcrowskip = src->mode_info->pitch - src->mode_info->bytes_per_pixel * width;
|
||||
dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
|
||||
srcptr = (grub_uint8_t *) get_data_ptr (src, offset_x, offset_y);
|
||||
dstptr = (grub_uint8_t *) get_data_ptr (dst, x, y);
|
||||
srcptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (src, offset_x, offset_y);
|
||||
dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y);
|
||||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
|
@ -285,8 +285,8 @@ grub_video_fbblit_replace_RGBX8888_RGB888 (struct grub_video_fbblit_info *dst,
|
|||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
srcptr = (grub_uint8_t *)get_data_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint32_t *)get_data_ptr (dst, x, y + j);
|
||||
srcptr = (grub_uint8_t *)grub_video_fb_get_video_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (dst, x, y + j);
|
||||
|
||||
for (i = 0; i < width; i++)
|
||||
{
|
||||
|
@ -321,8 +321,8 @@ grub_video_fbblit_replace_RGB888_RGBX8888 (struct grub_video_fbblit_info *dst,
|
|||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
srcptr = (grub_uint32_t *)get_data_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint8_t *)get_data_ptr (dst, x, y + j);
|
||||
srcptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint8_t *)grub_video_fb_get_video_ptr (dst, x, y + j);
|
||||
|
||||
for (i = 0; i < width; i++)
|
||||
{
|
||||
|
@ -358,8 +358,8 @@ grub_video_fbblit_replace_index_RGBX8888 (struct grub_video_fbblit_info *dst,
|
|||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
srcptr = (grub_uint32_t *)get_data_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint8_t *)get_data_ptr (dst, x, y + j);
|
||||
srcptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint8_t *)grub_video_fb_get_video_ptr (dst, x, y + j);
|
||||
|
||||
for (i = 0; i < width; i++)
|
||||
{
|
||||
|
@ -394,8 +394,8 @@ grub_video_fbblit_replace_index_RGB888 (struct grub_video_fbblit_info *dst,
|
|||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
srcptr = (grub_uint8_t *)get_data_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint8_t *)get_data_ptr (dst, x, y + j);
|
||||
srcptr = (grub_uint8_t *)grub_video_fb_get_video_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint8_t *)grub_video_fb_get_video_ptr (dst, x, y + j);
|
||||
|
||||
for (i = 0; i < width; i++)
|
||||
{
|
||||
|
@ -491,8 +491,8 @@ grub_video_fbblit_blend_BGRA8888_RGBA8888 (struct grub_video_fbblit_info *dst,
|
|||
srcrowskip = src->mode_info->pitch - src->mode_info->bytes_per_pixel * width;
|
||||
dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
|
||||
srcptr = (grub_uint32_t *) get_data_ptr (src, offset_x, offset_y);
|
||||
dstptr = (grub_uint32_t *) get_data_ptr (dst, x, y);
|
||||
srcptr = (grub_uint32_t *) grub_video_fb_get_video_ptr (src, offset_x, offset_y);
|
||||
dstptr = (grub_uint32_t *) grub_video_fb_get_video_ptr (dst, x, y);
|
||||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
|
@ -572,8 +572,8 @@ grub_video_fbblit_blend_BGR888_RGBA8888 (struct grub_video_fbblit_info *dst,
|
|||
srcrowskip = src->mode_info->pitch - src->mode_info->bytes_per_pixel * width;
|
||||
dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
|
||||
srcptr = (grub_uint32_t *) get_data_ptr (src, offset_x, offset_y);
|
||||
dstptr = (grub_uint8_t *) get_data_ptr (dst, x, y);
|
||||
srcptr = (grub_uint32_t *) grub_video_fb_get_video_ptr (src, offset_x, offset_y);
|
||||
dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y);
|
||||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
|
@ -656,8 +656,8 @@ grub_video_fbblit_blend_RGBA8888_RGBA8888 (struct grub_video_fbblit_info *dst,
|
|||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
srcptr = (grub_uint32_t *)get_data_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint32_t *)get_data_ptr (dst, x, y + j);
|
||||
srcptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (dst, x, y + j);
|
||||
|
||||
for (i = 0; i < width; i++)
|
||||
{
|
||||
|
@ -721,8 +721,8 @@ grub_video_fbblit_blend_RGB888_RGBA8888 (struct grub_video_fbblit_info *dst,
|
|||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
srcptr = (grub_uint32_t *)get_data_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint8_t *)get_data_ptr (dst, x, y + j);
|
||||
srcptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint8_t *)grub_video_fb_get_video_ptr (dst, x, y + j);
|
||||
|
||||
for (i = 0; i < width; i++)
|
||||
{
|
||||
|
@ -788,8 +788,8 @@ grub_video_fbblit_blend_index_RGBA8888 (struct grub_video_fbblit_info *dst,
|
|||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
srcptr = (grub_uint32_t *)get_data_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint8_t *)get_data_ptr (dst, x, y + j);
|
||||
srcptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint8_t *)grub_video_fb_get_video_ptr (dst, x, y + j);
|
||||
|
||||
for (i = 0; i < width; i++)
|
||||
{
|
||||
|
|
|
@ -16,12 +16,23 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* SPECIAL NOTES!
|
||||
|
||||
Please note following when reading the code below:
|
||||
|
||||
- In this driver we assume that every memory can be accessed by same memory
|
||||
bus. If there are different address spaces do not use this code as a base
|
||||
code for other archs.
|
||||
|
||||
- Every function in this code assumes that bounds checking has been done in
|
||||
previous phase and they are opted out in here. */
|
||||
|
||||
#include <grub/fbutil.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/video.h>
|
||||
|
||||
grub_uint8_t *
|
||||
get_data_ptr (struct grub_video_fbblit_info *source,
|
||||
grub_video_fb_get_video_ptr (struct grub_video_fbblit_info *source,
|
||||
unsigned int x, unsigned int y)
|
||||
{
|
||||
grub_uint8_t *ptr = 0;
|
||||
|
@ -72,24 +83,24 @@ get_pixel (struct grub_video_fbblit_info *source,
|
|||
switch (source->mode_info->bpp)
|
||||
{
|
||||
case 32:
|
||||
color = *(grub_uint32_t *)get_data_ptr (source, x, y);
|
||||
color = *(grub_uint32_t *)grub_video_fb_get_video_ptr (source, x, y);
|
||||
break;
|
||||
|
||||
case 24:
|
||||
{
|
||||
grub_uint8_t *ptr;
|
||||
ptr = get_data_ptr (source, x, y);
|
||||
ptr = grub_video_fb_get_video_ptr (source, x, y);
|
||||
color = ptr[0] | (ptr[1] << 8) | (ptr[2] << 16);
|
||||
}
|
||||
break;
|
||||
|
||||
case 16:
|
||||
case 15:
|
||||
color = *(grub_uint16_t *)get_data_ptr (source, x, y);
|
||||
color = *(grub_uint16_t *)grub_video_fb_get_video_ptr (source, x, y);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
color = *(grub_uint8_t *)get_data_ptr (source, x, y);
|
||||
color = *(grub_uint8_t *)grub_video_fb_get_video_ptr (source, x, y);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
@ -120,7 +131,7 @@ set_pixel (struct grub_video_fbblit_info *source,
|
|||
{
|
||||
grub_uint32_t *ptr;
|
||||
|
||||
ptr = (grub_uint32_t *)get_data_ptr (source, x, y);
|
||||
ptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (source, x, y);
|
||||
|
||||
*ptr = color;
|
||||
}
|
||||
|
@ -131,7 +142,7 @@ set_pixel (struct grub_video_fbblit_info *source,
|
|||
grub_uint8_t *ptr;
|
||||
grub_uint8_t *colorptr = (grub_uint8_t *)&color;
|
||||
|
||||
ptr = get_data_ptr (source, x, y);
|
||||
ptr = grub_video_fb_get_video_ptr (source, x, y);
|
||||
|
||||
ptr[0] = colorptr[0];
|
||||
ptr[1] = colorptr[1];
|
||||
|
@ -144,7 +155,7 @@ set_pixel (struct grub_video_fbblit_info *source,
|
|||
{
|
||||
grub_uint16_t *ptr;
|
||||
|
||||
ptr = (grub_uint16_t *)get_data_ptr (source, x, y);
|
||||
ptr = (grub_uint16_t *)grub_video_fb_get_video_ptr (source, x, y);
|
||||
|
||||
*ptr = (grub_uint16_t) (color & 0xFFFF);
|
||||
}
|
||||
|
@ -154,7 +165,7 @@ set_pixel (struct grub_video_fbblit_info *source,
|
|||
{
|
||||
grub_uint8_t *ptr;
|
||||
|
||||
ptr = (grub_uint8_t *)get_data_ptr (source, x, y);
|
||||
ptr = (grub_uint8_t *)grub_video_fb_get_video_ptr (source, x, y);
|
||||
|
||||
*ptr = (grub_uint8_t) (color & 0xFF);
|
||||
}
|
||||
|
|
|
@ -83,44 +83,6 @@ grub_video_fb_get_info (struct grub_video_mode_info *mode_info)
|
|||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
||||
grub_uint8_t *
|
||||
grub_video_fb_get_video_ptr (struct grub_video_fbblit_info *source,
|
||||
grub_uint32_t x, grub_uint32_t y)
|
||||
{
|
||||
grub_uint8_t *ptr = 0;
|
||||
|
||||
switch (source->mode_info->bpp)
|
||||
{
|
||||
case 32:
|
||||
ptr = (grub_uint8_t *)source->data
|
||||
+ y * source->mode_info->pitch
|
||||
+ x * 4;
|
||||
break;
|
||||
|
||||
case 24:
|
||||
ptr = (grub_uint8_t *)source->data
|
||||
+ y * source->mode_info->pitch
|
||||
+ x * 3;
|
||||
break;
|
||||
|
||||
case 16:
|
||||
case 15:
|
||||
ptr = (grub_uint8_t *)source->data
|
||||
+ y * source->mode_info->pitch
|
||||
+ x * 2;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
ptr = (grub_uint8_t *)source->data
|
||||
+ y * source->mode_info->pitch
|
||||
+ x;
|
||||
break;
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_video_fb_get_palette (unsigned int start, unsigned int count,
|
||||
struct grub_video_palette_data *palette_data)
|
||||
|
|
Loading…
Reference in a new issue