Re: [AD] stretch_blit() ob1 error

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


On 2003-02-11, aj <aj@xxxxxxxxxx> wrote:
> has anyone been made aware of the stretch_blit() scaling error... as 
> mentioned on the allegro.cc forums.
> 
> attached is a small test app... approx 50 lines of easily read c code.
> and a copy of the 2 output files the code makes, apologies for using .BMP 
> format.
> 
> the problem occurs when scaling a 3x3 image to 9x9.... its not centred.

Here's what I have so far.  It needs a *lot* more testing though.

-- 
王浩禎
Index: istretch.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/i386/istretch.c,v
retrieving revision 1.5
diff -u -r1.5 istretch.c
--- istretch.c	6 Nov 2001 15:30:47 -0000	1.5
+++ istretch.c	12 Feb 2003 23:44:33 -0000
@@ -67,6 +67,7 @@
       }                                                                      \
    }                                                                         \
    else {                           /* little -> big scaling */              \
+      sx += (sxd >> 1);                                                      \
       x2 = sx >> 16;                                                         \
       COMPILER_LODS##sz();                                                   \
       for (x=0; x<dest_width; x++) {                                         \
@@ -316,6 +317,8 @@
       if ((dest_width <= 0) || (dest_height <= 0))
 	 return;
    }
+
+   sy += (syd >> 1);
 
    /* search the cache */
    stretcher_count++;


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