[AD] stretch_blit problems on WinXP SP2

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


As discussed in this thread:
http://www.allegro.cc/forums/view_thread.php?_id=395950
there seems to be a problem when using stretch_blit() on AMD64 and Opteron 
processors under Windows XP SP2. Using the information from that thread, 
the attached patch aims to fix the problem.
Knowing nothing whatsoever about Windows and not using it myself (let alone 
on such a system), I haven't tested this. If someone more knowledgeagble 
could take a look at it to confirm wether or not it's ok...

Evert
Index: src/i386/istretch.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/i386/istretch.c,v
retrieving revision 1.6
diff -u -r1.6 istretch.c
--- src/i386/istretch.c	15 Feb 2003 01:29:39 -0000	1.6
+++ src/i386/istretch.c	21 Aug 2004 08:44:46 -0000
@@ -272,6 +272,9 @@
  */
 static void do_stretch_blit(BITMAP *source, BITMAP *dest, int source_x, int source_y, int source_width, int source_height, int dest_x, int dest_y, int dest_width, int dest_height, int masked)
 {
+ #ifdef ALLEGRO_WINDOWS
+   int old_protect;
+ #endif     /* ifdef ALLEGRO_WINDOWS */
    fixed sx, sy, sxd, syd;
    void *prev_scratch_mem;
    int prev_scratch_mem_size;
@@ -419,6 +422,11 @@
 
    COMPILER_RET();
 
+ #ifdef ALLEGRO_WINDOWS
+   /* Play nice with Windows executable memory protection */
+   VirtualProtect(_scratch_mem, _scratch_mem_size, PAGE_EXECUTE_READWRITE, &old_protect);
+ #endif     /* ifdef ALLEGRO_WINDOWS */
+
    /* call the stretcher */
    _do_stretch(source, dest, _scratch_mem, sx>>16, sy, syd, 
 	       dest_x, dest_y, dest_height, dest->vtable->color_depth);


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