Re: [AD] Add timeBeginPeriod(1) to wtimer.c

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


On Monday 07 March 2005 13:59, Tobias Scheuer wrote:
> The bad routine is NOT ddraw_draw_sprite, but draw_sprite.

No, it's ddraw_draw sprite, or should be. The reason is that draw_sprite() 
is just a vtable wrapper defined in include/allegro/inline/draw.inl:

AL_INLINE(void, draw_sprite, (BITMAP *bmp, BITMAP *sprite, int x, int y),
{
   ASSERT(bmp);
   ASSERT(sprite);

   if (sprite->vtable->color_depth == 8) {
      bmp->vtable->draw_256_sprite(bmp, sprite, x, y);
   }
   else {
      ASSERT(bmp->vtable->color_depth == sprite->vtable->color_depth);
      bmp->vtable->draw_sprite(bmp, sprite, x, y);
   }
})


> But then, in two 
> programs I have, one time it calls a lot of EnterCriticalSection, in the
> other it doesn't. 

Check for colour conversions from an 8 bit source.

> The only difference is: In the gwfk test program the ball which is drawed
> very often, is explicitely created as a system bitmap, because I found 
that
> this way everything is slightly more efficient. Though this variant is 
doing
> so much synchronization. 
> In the other program (TNTrain) I'm just using the result of load_bitmap,
> which is not explicitely a system bitmap, so it uses a different piece of
> code in draw_sprite... 

Hmm... that would also make a difference, since system bitmaps have a 
different vtable from memory bitmaps.

Evert




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