--- /home/cpdev/src/classpath/javax/swing/GrayFilter.java	2005-07-02 21:04:00.000000000 +0000
+++ javax/swing/GrayFilter.java	2005-06-30 05:35:08.000000000 +0000
@@ -46,11 +46,10 @@
 public class GrayFilter extends RGBImageFilter
 {
   private boolean b;
-  private double p;
+  private int p;
 
   /**
-   * Create a GrayFilter. If b is true then brighten. Also, indicate how much
-   * gray.
+   * Create a GrayFilter. If b is true then brighten. Also, indicate how much gray.
    *    
    * @param b if brighten
    * @param p percent of gray, 0 - 100
@@ -58,7 +57,7 @@
   public GrayFilter(boolean b, int p)
   {
     this.b = b; //FIXME - HANDLE THIS
-    this.p = (1. - (p / 100.)) / 3.;
+    this.p = p;
   }
 
   /**
@@ -72,7 +71,7 @@
   {
     return (Toolkit.getDefaultToolkit().
 	    createImage(new FilteredImageSource(src.getSource(),
-						new GrayFilter(true, 0))));
+						new GrayFilter(false, 100))));
   }
   
   /**
@@ -80,13 +79,7 @@
    */
   public int filterRGB(int x, int y, int rgb)
   {
-    int alpha = 0xff000000 & rgb;
-    int red = (0xff0000 & rgb) >> 16;
-    int green = (0xff00 & rgb) >> 8;
-    int blue = (0xff & rgb);
-    int gray = (int) ((0.299 * red + 0.587 * green + 0.114 * blue) * p);
-    if (b)
-      gray = Math.min(gray + 128, 255);
-    return gray | gray << 8 | gray << 16 | alpha ;
+    return (int) (p * (0.299 * ((0xff0000 & rgb) >> 16)
+		       + 0.587 * ((0xff00 & rgb) >> 8) + 0.114 * (0xff & rgb)));
   }
 }
