From b68922d51f52ca6ab9daa0105ef5c57f35bfbdcf Mon Sep 17 00:00:00 2001
From: marha <marha@users.sourceforge.net>
Date: Mon, 23 Apr 2012 14:49:28 +0200
Subject: fontconfig libXau libXext libxcb pixman mesa git update 23 April 2012

---
 pixman/pixman/pixman-bits-image.c | 10 +++++-----
 pixman/test/utils.c               | 13 ++++++++++---
 2 files changed, 15 insertions(+), 8 deletions(-)

(limited to 'pixman')

diff --git a/pixman/pixman/pixman-bits-image.c b/pixman/pixman/pixman-bits-image.c
index d105d2f69..1f6897c2c 100644
--- a/pixman/pixman/pixman-bits-image.c
+++ b/pixman/pixman/pixman-bits-image.c
@@ -381,11 +381,11 @@ bits_image_fetch_pixel_convolution (bits_image_t   *image,
     int y_off = (params[1] - pixman_fixed_1) >> 1;
     int32_t cwidth = pixman_fixed_to_int (params[0]);
     int32_t cheight = pixman_fixed_to_int (params[1]);
-    int32_t srtot, sgtot, sbtot, satot;
     int32_t i, j, x1, x2, y1, y2;
     pixman_repeat_t repeat_mode = image->common.repeat;
     int width = image->width;
     int height = image->height;
+    int srtot, sgtot, sbtot, satot;
 
     params += 2;
 
@@ -421,10 +421,10 @@ bits_image_fetch_pixel_convolution (bits_image_t   *image,
 		    pixel = get_pixel (image, rx, ry, TRUE);
 		}
 
-		srtot += RED_8 (pixel) * f;
-		sgtot += GREEN_8 (pixel) * f;
-		sbtot += BLUE_8 (pixel) * f;
-		satot += ALPHA_8 (pixel) * f;
+		srtot += (int)RED_8 (pixel) * f;
+		sgtot += (int)GREEN_8 (pixel) * f;
+		sbtot += (int)BLUE_8 (pixel) * f;
+		satot += (int)ALPHA_8 (pixel) * f;
 	    }
 
 	    params++;
diff --git a/pixman/test/utils.c b/pixman/test/utils.c
index cc0365aa2..c1bf6dc2c 100644
--- a/pixman/test/utils.c
+++ b/pixman/test/utils.c
@@ -358,9 +358,16 @@ a8r8g8b8_to_rgba_np (uint32_t *dst, uint32_t *src, int n_pixels)
 
 	if (a != 0)
 	{
-	    r = (r * 255) / a;
-	    g = (g * 255) / a;
-	    b = (b * 255) / a;
+#define DIVIDE(c, a)							\
+	    do								\
+	    {								\
+		int t = ((c) * 255) / a;				\
+		(c) = t < 0? 0 : t > 255? 255 : t;			\
+	    } while (0)
+
+	    DIVIDE (r, a);
+	    DIVIDE (g, a);
+	    DIVIDE (b, a);
 	}
 
 	*dst8++ = r;
-- 
cgit v1.2.3