Index: src/cairo-color.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-color.c,v
retrieving revision 1.14
diff -u -p -r1.14 cairo-color.c
--- src/cairo-color.c	14 Apr 2005 21:42:26 -0000	1.14
+++ src/cairo-color.c	3 Aug 2005 01:32:54 -0000
@@ -89,29 +89,19 @@ _cairo_color_init_rgb (cairo_color_t *co
     _cairo_color_init_rgba (color, red, green, blue, 1.0);
 }
 
+/* We multiply colors by (0x10000 - epsilon), such that we get a uniform
+ * range even for 0xffff.  In other words, (1.0 - epsilon) would convert
+ * to 0xffff, not 0xfffe.
+ */
+#define COLOR_MAGIC_MULT (65536.0 - 1e-5)
 
-/* XXX: The calculation of:
-
-		channel * 0xffff
-
-	isn't really what we want since:
-
-		(1.0 - epsilon) * 0xffff = 0xfffe
-
-	In other words, given an input range of [0.0, 1.0], we have an
-	infinitely small range tha maps to the output value 0xffff,
-	(while having large, uniformly sized input ranges for all
-	other output values). This is undesirable, particularly when
-	we want to do optimizations for "opaque" colors specfied as
-	floating-point.
-*/
 static void
 _cairo_color_compute_shorts (cairo_color_t *color)
 {
-    color->red_short   = color->red   * color->alpha * 0xffff;
-    color->green_short = color->green * color->alpha * 0xffff;
-    color->blue_short  = color->blue  * color->alpha * 0xffff;
-    color->alpha_short = color->alpha * 0xffff;
+    color->red_short   = color->red   * color->alpha * COLOR_MAGIC_MULT;
+    color->green_short = color->green * color->alpha * COLOR_MAGIC_MULT;
+    color->blue_short  = color->blue  * color->alpha * COLOR_MAGIC_MULT;
+    color->alpha_short = color->alpha * COLOR_MAGIC_MULT;
 }
 
 void
