[patch] gl: use fabs value for color difference

"Henry (Yu) Song - SISA" <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <3955FA337689574EB32F94B12A7E6E9E16364B18@sisaex01sj>
From eaba158af31cbf17d7c0ab079e59f606edcc86d0 Mon Sep 17 00:00:00 2001
From: Henry Song <[email protected]>
Date: Thu, 26 Jul 2012 10:14:41 -0700
Subject: [PATCH] gl: use absolute difference value in computing gradient
 sample width

---
 src/cairo-gl-gradient.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/cairo-gl-gradient.c b/src/cairo-gl-gradient.c
index a66f26d..c52b895 100644
--- a/src/cairo-gl-gradient.c
+++ b/src/cairo-gl-gradient.c
@@ -63,17 +63,17 @@ _cairo_gl_gradient_sample_width (unsigned int                 n_stops,
 	if (dx == 0)
 	    dx = 0.01;
 
-	max = stops[n].color.red - stops[n-1].color.red;
+	max = fabs (stops[n].color.red - stops[n-1].color.red);
 
-	delta = stops[n].color.green - stops[n-1].color.green;
+	delta = fabs (stops[n].color.green - stops[n-1].color.green);
 	if (delta > max)
 	    max = delta;
 
-	delta = stops[n].color.blue - stops[n-1].color.blue;
+	delta = fabs (stops[n].color.blue - stops[n-1].color.blue);
 	if (delta > max)
 	    max = delta;
 
-	delta = stops[n].color.alpha - stops[n-1].color.alpha;
+	delta = fabs (stops[n].color.alpha - stops[n-1].color.alpha);
 	if (delta > max)
 	    max = delta;
 
-- 
1.7.9.5
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.