Re: [AD] Drawing a bitmap to itself...

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


On Wed, Sep 1, 2010 at 1:14 AM, Peter Wang <novalazy@xxxxxxxxxx> wrote:
On 2010-09-01, Elias Pschernig <elias.pschernig@xxxxxxxxxx> wrote:
>
> I didn't think too much about how difficult exactly it would be to
> properly implement this, I stopped when I realized that at least
> sometimes a temporary bitmap is required and I couldn't implement it in
> just a few hours. And given the limited use of drawing a bitmap to
> itself one of the above options might do instead for 5.0 :)

I think we would be better off being conservative, so solution 1,
possibly 2.  We can always relax restrictions later, if need be.


I adjusted the docs to go for solution 1. Drawing a bitmap to itself just triggers an assert in debug mode and has undefined behavior in release mode.

I also did the same for the backbuffer as source, but left in an exception for when it is untransformed. This exception can be quite useful for e.g. taking a screenshot. Blending also doesn't work though, so I'll add another note saying that the blending mode is ignored when the source is the backbuffer.

So basically, all things which may require us to create an internal temporary bitmap are not allowed for 5.0.0. The exception for the backbuffer is a bit messy, a cleaner way would be to do it like e.g. OpenGL and have a separate function, something like al_grab_display(DISPLAY *source, BITMAP *target, int sx, sy, dx, dy, w, h) which ignores transformation and blending and target bitmap and just retrieves a portion of the display surface.

But I guess we plan to actually implement all the special cases with temporary bitmaps at some point, so that exception shouldn't be too bad.


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