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

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Wed Aug 10 12:55:45 CEST 2011


On 09/08/11 22:54, William Hahne wrote:

> 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 },
>   };

This is interesting, since although I can't find draw-rectangle in the 
OF specification, neither can I find fill-rectangle which is already 
there. Perhaps there is part of the OF PPC supplement?


ATB,

Mark.

-- 
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs



More information about the OpenBIOS mailing list