Re: [AD] Locking Behaviour

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


> 
> That I don't think we can safely do. The user might
> lock a region
> and if we unlock it and lock a new region on him, that
> would be bad.
> Unless there is some way to avoid that that I'm
> missing.
> 

Aha, yes, you are right. I thought more about it and I thought up of a few other problems with it in addition to the one you said.

How about if the routine finds the buffer already locked, then it will leave it locked? If it finds it unlocked, then it will unlock it after it is done with it. If it is locked but does not encompass the region the routine wants to draw to/from, then the call will fail. This means that any user-set locks will persist, and utilized for as long as possible (you can lock the entire destination bitmap, and then draw multiple images on it before unlocking it again, something you can't do now). I guess we can force the user to manually unlock the bitmaps as well as per the current API. So, to me, it appears that this sort of strategy will lead to the same API and the same output, but with some potential speed gains.

The lock_region function, thus, can remain unchanged, and we'd need to recode the drawing routines a bit so they check whether the regions are already locked.

SiegeLord

> 
> Trent :{)>


      




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