changeset 81:ba1987562a73

Fix 8to8 saturated scaled blit function.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 02 Oct 2012 09:44:18 +0300
parents 5cefa59baa9d
children 265ce3091d88
files dmblitfunc.h
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/dmblitfunc.h	Tue Oct 02 05:55:28 2012 +0300
+++ b/dmblitfunc.h	Tue Oct 02 09:44:18 2012 +0300
@@ -231,7 +231,10 @@
 #define DM_SCALED_DST_BYTES 1
 #define DM_SCALED_SRC_TYPE Uint8
 #define DM_SCALED_DST_TYPE Uint8
-#define DM_SCALED_INNER *(dp++) += sp[FP_GETH(xv)];
+#define DM_SCALED_INNER \
+    const Uint8 q = sp[FP_GETH(xv)] + *dp; \
+    *(dp++) = q < 256 ? q : 255;
+
 #include "dmscaledblit.h"
 
 // -----------------------------------------------------------------------