Re: [AD] Two Windows patches

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


On 2006-01-22, Evert Glebbeek <eglebbk@xxxxxxxxxx> wrote:
> See the following threads for some background information on the following 
> patches:
> 
> http://www.allegro.cc/forums/thread/558465
> http://www.allegro.cc/forums/thread/560782
> 
> The first one adds a hardware-accelerated stretch_blit() to the DirectX 
> driver (the documentation will need to be updated accordingly). This 
> should probably be tested more, but unless it's applied and put into a 
> release version no one will use it and it won't get tested, so I propose 
> it for 4.2.1, if we're adding minor enhancements there anyway.
> Credits for Thomas Harte and Neil Walker.

The 4.2.x branch is supposed to be stable, but I don't see any way
around it.

> The second is a genuine bugfix where destroying a subbitmap of a system 
> bitmap also destroyed (or at least garbled) the parent bitmap. This I 
> think could be applied without problems.
> Credits for Neil Walker and myself.
> 
> Evert

> Index: src/win/wddaccel.c
> ===================================================================
> --- src/win/wddaccel.c	(revision 5662)
> +++ src/win/wddaccel.c	(working copy)
> @@ -15,6 +15,7 @@
>   *      Bugfixes by Isaac Cruz.
>   *
>   *      Accelerated rectfill() and hline() added by Shawn Hargreaves.
> + *      Accelerated stretch_blit() and friends by Thomas Harte
>   *

Add an extra blank line and full stop.

> @@ -467,6 +534,11 @@
>        _screen_vtable.blit_from_system = ddraw_blit_to_self;
>        _screen_vtable.blit_to_system = ddraw_blit_to_self;
>  
> +      if (ddcaps.dwCaps&DDCAPS_BLTSTRETCH) {
> +         _screen_vtable.do_stretch_blit = ddraw_do_stretch_blit;
> +         gfx_capabilities |= GFX_HW_STRETCH_BLIT;
> +      }

Add whitespace around the & operator.

> @@ -486,6 +558,11 @@
>        _screen_vtable.masked_blit = ddraw_masked_blit;
>        _screen_vtable.draw_sprite = ddraw_draw_sprite;
>  
> +      if (ddcaps.dwCaps&DDCAPS_BLTSTRETCH) {
> +         _screen_vtable.do_stretch_blit = ddraw_do_stretch_blit;
> +         gfx_capabilities |= GFX_HW_STRETCH_BLIT_MASKED;
> +      }

Same here.

> Index: src/win/wddbmp.c
> ===================================================================
> --- src/win/wddbmp.c	(revision 5662)
> +++ src/win/wddbmp.c	(working copy)
> @@ -655,6 +655,24 @@
>   */
>  void gfx_directx_destroy_system_bitmap(BITMAP *bmp)
>  {
> +   /* Special case: use normal destroy_bitmap() for subbitmaps of system bitmaps.
> +    * Checked here rather than in destroy_bitmap() because that function should
> +    * not make assumptions about the relation between system bitmaps and
> +    * subbitmaps thereof.
> +    */

Might as well wrap this comment at 80 chars.

> +   if (is_sub_bitmap(bmp)) {
> +      if (system_driver->destroy_bitmap) {
> +        if (system_driver->destroy_bitmap(bmp))
> +           return;
> +      }
> +
> +      if (bmp->dat)
> +        _AL_FREE(bmp->dat);
> +
> +      _AL_FREE(bmp);
> +
> +      return;
> +   }
>     /* destroy the surface */
>     gfx_directx_destroy_surface(DDRAW_SURFACE_OF(bmp));
>  

Add a blank line.

I don't like this fix much.  The free's correspond to mallocs which are
performed "one level up" in src/graphics.c, and it duplicates code.

Peter





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