make the linux-ppc packags be in synch with other platforms
[tangerine.git] / arch / common / boot / grub2 / video / i386 / pc / vbefill.c
blob8ba550ad98269bced755456b4c730b74fbfe2731
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2006,2007 Free Software Foundation, Inc.
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 /* SPECIAL NOTES!
21 Please note following when reading the code below:
23 - In this driver we assume that every memory can be accessed by same memory
24 bus. If there are different address spaces do not use this code as a base
25 code for other archs.
27 - Every function in this code assumes that bounds checking has been done in
28 previous phase and they are opted out in here. */
30 #include <grub/machine/vbe.h>
31 #include <grub/machine/vbefill.h>
32 #include <grub/machine/vbeutil.h>
33 #include <grub/types.h>
34 #include <grub/video.h>
36 void
37 grub_video_i386_vbefill_R8G8B8A8 (struct grub_video_i386_vbeblit_info *dst,
38 grub_video_color_t color, int x, int y,
39 int width, int height)
41 int i;
42 int j;
43 grub_uint32_t *dstptr;
45 /* We do not need to worry about data being out of bounds
46 as we assume that everything has been checked before. */
48 for (j = 0; j < height; j++)
50 dstptr = (grub_uint32_t *)grub_video_vbe_get_video_ptr (dst, x, y + j);
52 for (i = 0; i < width; i++)
53 *dstptr++ = color;
57 void
58 grub_video_i386_vbefill_R8G8B8 (struct grub_video_i386_vbeblit_info *dst,
59 grub_video_color_t color, int x, int y,
60 int width, int height)
62 int i;
63 int j;
64 grub_uint8_t *dstptr;
65 grub_uint8_t fillr = (grub_uint8_t)((color >> 0) & 0xFF);
66 grub_uint8_t fillg = (grub_uint8_t)((color >> 8) & 0xFF);
67 grub_uint8_t fillb = (grub_uint8_t)((color >> 16) & 0xFF);
69 /* We do not need to worry about data being out of bounds
70 as we assume that everything has been checked before. */
72 for (j = 0; j < height; j++)
74 dstptr = (grub_uint8_t *)grub_video_vbe_get_video_ptr (dst, x, y + j);
76 for (i = 0; i < width; i++)
78 *dstptr++ = fillr;
79 *dstptr++ = fillg;
80 *dstptr++ = fillb;
85 void
86 grub_video_i386_vbefill_index (struct grub_video_i386_vbeblit_info *dst,
87 grub_video_color_t color, int x, int y,
88 int width, int height)
90 int i;
91 int j;
92 grub_uint8_t *dstptr;
93 grub_uint8_t fill = (grub_uint8_t)color & 0xFF;
95 /* We do not need to worry about data being out of bounds
96 as we assume that everything has been checked before. */
98 for (j = 0; j < height; j++)
100 dstptr = (grub_uint8_t *)grub_video_vbe_get_video_ptr (dst, x, y + j);
102 for (i = 0; i < width; i++)
103 *dstptr++ = fill;
107 void
108 grub_video_i386_vbefill (struct grub_video_i386_vbeblit_info *dst,
109 grub_video_color_t color, int x, int y,
110 int width, int height)
112 int i;
113 int j;
115 /* We do not need to worry about data being out of bounds
116 as we assume that everything has been checked before. */
118 for (j = 0; j < height; j++)
119 for (i = 0; i < width; i++)
120 set_pixel (dst, x+i, y+j, color);