Re: [Re: [AD] New WIP]

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Sun, Aug 27, 2000 at 02:07:34AM +0100, Laurence Withers wrote:
> We need some clarification here, before we make any changes. As I code
> for DJGPP, I do not use the bitmap acquisition/release functions, so I
> have no experience of using them. Is it necessary to acquire a bitmap to
> read from it, or only to write to it?

Last time I used those functions (with WinAllegro 5), it was
both.

> If we only acquire a bitmap for the purpose of writing to it, then we
> can happily remove the `AL_CONST' keyword, since all the functions which
> write to the bitmap get their pointer in the type BITMAP*, not const
> BITMAP*.
> 
> However, if we need to acquire bitmaps in order to read from them, then
> we must have the `AL_CONST' keyword, and supply relevant casts in the
> acquire/release functions.

Casting away constness is very bad though -- the compiler can
make optimisations assuming the pointed-to data does not change,
when in fact you're altering it.  Acquiring the surface is
changing the data pointed to (several levels of indirection
further down), so the function should not take a const
parameter.

I can't think of any bitmap operations for which it *would* be
appropriate to have a const parameter.  Any drawing operation
modifies the content, and even reading operations may involve a
bank switch.  That's true in all platforms, not just Windows.

George

-- 
Random project update:
22/06/2000: AllegroGL documentation:  http://allegrogl.sourceforge.net/
        See under `Documentation' for the AllegroGL Reference Manual in
	various formats.



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/