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/>.
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
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>
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
)
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
++)
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
)
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
++)
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
)
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
++)
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
)
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
);