[AD] set_difference_blender patch |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: Coordination of admins/developers of the game programming library Allegro <alleg-developers@xxxxxxxxxx>
- Subject: [AD] set_difference_blender patch
- From: Jon Rafkind <workmin@xxxxxxxxxx>
- Date: Sun, 30 Jan 2011 19:53:43 -0700
Anyone mind if I apply this patch to set_difference_blender for 4.4? It
clamps the lowest value to 0 instead of using ABS to wrap around. Heres
a post on a.cc that no one responded to:
http://www.allegro.cc/forums/thread/606235
I can add an example program if someone wants.
Index: colblend.c
===================================================================
--- colblend.c (revision 14428)
+++ colblend.c (working copy)
@@ -209,9 +209,9 @@
*/
unsigned long _blender_difference24(unsigned long x, unsigned long y, unsigned long n)
{
- return BLEND(24, ABS(getr24(y) - getr24(x)),
- ABS(getg24(y) - getg24(x)),
- ABS(getb24(y) - getb24(x)));
+ return BLEND(24, MAX(getr24(y) - getr24(x), 0),
+ MAX(getg24(y) - getg24(x), 0),
+ MAX(getb24(y) - getb24(x), 0));
}
@@ -496,9 +496,9 @@
*/
unsigned long _blender_difference16(unsigned long x, unsigned long y, unsigned long n)
{
- return BLEND(16, ABS(getr16(y) - getr16(x)),
- ABS(getg16(y) - getg16(x)),
- ABS(getb16(y) - getb16(x)));
+ return BLEND(16, MAX(getr16(y) - getr16(x), 0),
+ MAX(getg16(y) - getg16(x), 0),
+ MAX(getb16(y) - getb16(x), 0));
}
@@ -776,9 +776,9 @@
*/
unsigned long _blender_difference15(unsigned long x, unsigned long y, unsigned long n)
{
- return BLEND(15, ABS(getr15(y) - getr15(x)),
- ABS(getg15(y) - getg15(x)),
- ABS(getb15(y) - getb15(x)));
+ return BLEND(15, MAX(getr15(y) - getr15(x), 0),
+ MAX(getg15(y) - getg15(x), 0),
+ MAX(getb15(y) - getb15(x), 0));
}