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

William Hahne will07c5 at gmail.com
Wed Aug 10 17:35:08 CEST 2011


On Wed, Aug 10, 2011 at 5:55 AM, Mark Cave-Ayland <
mark.cave-ayland at siriusit.co.uk> wrote:

> 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?
>
>
I am not sure if it is officially part of any specification. BootX doesn't
even assume that it was there and attempted to add its own "draw-rectangle"
word, but unfortunately the method it uses to add words to packages doesn't
work with OpenBIOS. Just adding draw-rectangle seemed like a much simpler
and safer solution than changing the way device packages work. Also from
what I could see it looked like a serious rewrite might be necessary just to
get one small edge case to work.

William Hahne


>
> 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
>
> --
> OpenBIOS                 http://openbios.org/
> Mailinglist:  http://lists.openbios.org/**mailman/listinfo<http://lists.openbios.org/mailman/listinfo>
> Free your System - May the Forth be with you
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openbios.org/pipermail/openbios/attachments/20110810/8f4569f8/attachment.html>


More information about the OpenBIOS mailing list