[OpenBIOS] [PATCH 5/10] Add draw-rectangle to the display package

William Hahne will07c5 at gmail.com
Tue Aug 9 23:54:53 CEST 2011


While not necessary for BootX to function this allows the Apple logo to be
displayed during boot time.

Index: packages/video.c
===================================================================
--- packages/video.c (revision 1041)
+++ packages/video.c (working copy)
@@ -281,6 +281,42 @@
  fill_rect( color_ind, x, y, w, h );
 }

+static void
+video_draw_rect( void )
+{
+ int h = POP();
+ int w = POP();
+ int y = POP();
+ int x = POP();
+ unsigned char* img = (unsigned char*)cell2pointer(POP());
+ char *pp;
+
+ if (!video.has_video || x < 0 || y < 0 || w <= 0 || h <= 0 ||
+ x + w > video.fb.w || y + h > video.fb.h)
+ return;
+
+ pp = (char*)video.fb.mphys + video.fb.rb * y;
+ for( ; h--; pp += video.fb.rb ) {
+ int ww = w;
+
+ if( video.fb.depth == 24 || video.fb.depth == 32 ) {
+ unsigned long *p = (unsigned long*)pp + x;
+ while( ww-- )
+ *p++ = get_color(*img++);
+ } else if( video.fb.depth == 16 || video.fb.depth == 15 ) {
+ unsigned short *p = (unsigned short*)pp + x;
+ while( ww-- )
+ *p++ = get_color(*img++);
+ } else {
+                        char *p = (char *)((unsigned short*)pp + x);
+
+ while( ww-- )
+ *p++ = get_color(*img++);
+ }
+ }
+
+}
+
 /* ( addr len -- actual ) */
 static void
 video_write(void)
@@ -299,6 +335,7 @@
  {"dimensions", video_dimensions },
  {"set-colors", video_set_colors },
  {"fill-rectangle", video_fill_rect },
+ {"draw-rectangle", video_draw_rect },
  {"color!", video_color_bang },
  {"write", video_write },
 };
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openbios.org/pipermail/openbios/attachments/20110809/8329a692/attachment.html>


More information about the OpenBIOS mailing list