[AD] BUG in C version of draw_trans_sprite() ?

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


It shows in extrans - first part. With assembler version of
draw_trans_sprite() it's like circle of light with nothing around it, BUT
with C version it's like circle of light with background image around it
inside box with nothing around box (I hope it's understandable
description).

I dig into sources and found out that C version of draw_trans_sprite()
skips masked pixels of given sprite, but ASM version doesn't (so it
shouldn't be called draw_trans_sprite :-).

Attached is a small diff to C version of src/c/cspr.h to act like ASM
version. I hope it's correct. It's only for normal functions, not for RLE
ones, because these are to complicated and I have no time. Is there
someone who wants to do it?

Stepan Roh
--- cspr.h.orig	Sun Jan 30 22:46:58 2000
+++ cspr.h	Wed Feb  9 19:13:04 2000
@@ -452,10 +452,8 @@
 
 	 for (x = w - 1; x >= 0; s++, INC_PIXEL_PTR(ds), INC_PIXEL_PTR(dd), x--) {
 	    unsigned long c = *s;
-	    if (c) {
-	       c = DTS_BLEND(blender, GET_PIXEL(ds), c);
-	       PUT_PIXEL(dd, c);
-	    }
+	    c = DTS_BLEND(blender, GET_PIXEL(ds), c);
+	    PUT_PIXEL(dd, c);
 	 }
       }
 
@@ -471,10 +469,8 @@
 
 	 for (x = w - 1; x >= 0; INC_PIXEL_PTR(s), INC_PIXEL_PTR(ds), INC_PIXEL_PTR(dd), x--) {
 	    unsigned long c = GET_MEMORY_PIXEL(s);
-	    if (!IS_MASK(c)) {
-	       c = DTS_BLEND(blender, GET_PIXEL(ds), c);
-	       PUT_PIXEL(dd, c);
-	    }
+	    c = DTS_BLEND(blender, GET_PIXEL(ds), c);
+	    PUT_PIXEL(dd, c);
 	 }
       }
 
@@ -487,10 +483,8 @@
 
 	 for (x = w - 1; x >= 0; INC_PIXEL_PTR(s), INC_PIXEL_PTR(d), x--) {
 	    unsigned long c = GET_MEMORY_PIXEL(s);
-	    if (!IS_MASK(c)) {
-	       c = DTS_BLEND(blender, GET_MEMORY_PIXEL(d), c);
-	       PUT_MEMORY_PIXEL(d, c);
-	    }
+	    c = DTS_BLEND(blender, GET_MEMORY_PIXEL(d), c);
+	    PUT_MEMORY_PIXEL(d, c);
 	 }
       }
    }
@@ -552,10 +546,8 @@
       for (x = w - 1; x >= 0; s++, INC_PIXEL_PTR(ds), INC_PIXEL_PTR(dd), x--) {
 	 unsigned long c = *s;
 
-	 if (!c != MASK_COLOR_32) {
-	    c = RGBA_BLEND(blender, GET_PIXEL(ds), c);
-	    PUT_PIXEL(dd, c);
-	 }
+	 c = RGBA_BLEND(blender, GET_PIXEL(ds), c);
+	 PUT_PIXEL(dd, c);
       }
    }
 


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