[OpenBIOS] [PATCHv2 13/20] video_common.c: create low-level video_fill_rect() function.

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Sun May 26 15:02:33 CEST 2013


Switch fb8-erase-screen in display.fs over to use it.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 openbios-devel/forth/device/display.fs     |    6 +++---
 openbios-devel/include/libopenbios/video.h |    1 +
 openbios-devel/libopenbios/video_common.c  |   16 ++++++++++++++++
 openbios-devel/packages/video.c            |   13 -------------
 4 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/openbios-devel/forth/device/display.fs b/openbios-devel/forth/device/display.fs
index d6fcb02..b74fae9 100644
--- a/openbios-devel/forth/device/display.fs
+++ b/openbios-devel/forth/device/display.fs
@@ -165,6 +165,7 @@ defer fb-emit ( x -- )
 
 \ bind to low-level C function later
 defer fb8-blitmask
+defer fb8-fillrect
 defer fb8-invertrect
 
 : fb8-line2addr ( line -- addr )
@@ -236,14 +237,13 @@ defer fb8-invertrect
   ;
 
 : fb8-erase-screen ( -- )
-  frame-buffer-adr 
-  screen-height screen-width * 
   inverse-screen? if
     foreground-color
   else
     background-color
   then
-  fill
+  0 0 screen-width screen-height
+  fb8-fillrect
   ;
 
 : fb8-invert-screen ( -- )
diff --git a/openbios-devel/include/libopenbios/video.h b/openbios-devel/include/libopenbios/video.h
index 4f10eb8..13bf143 100644
--- a/openbios-devel/include/libopenbios/video.h
+++ b/openbios-devel/include/libopenbios/video.h
@@ -9,6 +9,7 @@ void video_scroll(int height);
 void fill_rect(int col_ind, int x, int y, int w, int h);
 void video_mask_blit(void);
 void video_invert_rect(void);
+void video_fill_rect(void);
 
 typedef struct osi_fb_info {
     unsigned long mphys;
diff --git a/openbios-devel/libopenbios/video_common.c b/openbios-devel/libopenbios/video_common.c
index 41d103c..7b15d4a 100644
--- a/openbios-devel/libopenbios/video_common.c
+++ b/openbios-devel/libopenbios/video_common.c
@@ -338,6 +338,19 @@ video_write(void)
     PUSH(len);
 }
 
+/* ( color_ind x y width height -- ) (?) */
+void
+video_fill_rect(void)
+{
+	int h = POP();
+	int w = POP();
+	int y = POP();
+	int x = POP();
+	int color_ind = POP();
+
+	fill_rect( color_ind, x, y, w, h );
+}
+
 void
 init_video( unsigned long fb, int width, int height, int depth, int rb )
 {
@@ -390,6 +403,9 @@ init_video( unsigned long fb, int width, int height, int depth, int rb )
 	PUSH( pointer2cell(video_mask_blit) );
 	fword("is-noname-cfunc");
 	feval("to fb8-blitmask");
+	PUSH( pointer2cell(video_fill_rect) );
+	fword("is-noname-cfunc");
+	feval("to fb8-fillrect");
 	PUSH( pointer2cell(video_invert_rect) );
 	fword("is-noname-cfunc");
 	feval("to fb8-invertrect");
diff --git a/openbios-devel/packages/video.c b/openbios-devel/packages/video.c
index e68faa5..99f0c3f 100644
--- a/openbios-devel/packages/video.c
+++ b/openbios-devel/packages/video.c
@@ -71,19 +71,6 @@ video_color_bang( void )
 	refresh_palette();
 }
 
-/* ( color_ind x y width height -- ) (?) */
-static void
-video_fill_rect( void )
-{
-	int h = POP();
-	int w = POP();
-	int y = POP();
-	int x = POP();
-	int color_ind = POP();
-
-	fill_rect( color_ind, x, y, w, h );
-}
-
 NODE_METHODS( video ) = {
 	{"dimensions",		video_dimensions	},
 	{"set-colors",		video_set_colors	},
-- 
1.7.10.4




More information about the OpenBIOS mailing list