Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: AddColor() / SetColor()



Clemens Kirchgatterer wrote:
> 
> in the games plugin i set the palette, before i draw anything the first
> time:
> 
>    for (int i=0; i<COLORS; i++) {
> #if VDRVERSNUM < 10307
>       if (screen) screen->AddColor(PALETTE(i));
> #else
>       if (screen) {
>          screen->GetBitmap(0)->SetColor(i, PALETTE(i));
>       }
> #endif
>    }
> 
> is this useful in any way, except that i know which color is on a
> specific index? if cOsd would provide a SetIndex() methode it would
> speed up setting a pixel a little bit. or should i dump that code
> anyway?

On the cOsd level there is no guarantee that there is a bitmap at all.
A particular OSD implementation may not even need any bitmaps to work,
because it re-implements all of the Draw*() functions to make them go
directly to some frame buffer or whatever.

If you want to make sure you can work with a cBitmap, you should
create one of your own, draw your stuff in there, and call cOsd::DrawBitmap()
with it. That's an operation that is always guaranteed to work.

In your example code above the GetBitmap(0) call may return NULL, so
you should at least check for that case and fall back to a DrawBitmap()
solution.

Maybe I should make cOsd::GetBitmap() a 'protected' function, because
it really only is of use for a derived cOsd class that actually uses
areas...

Klaus


-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index