[patch] prevent sign extended alpha values

graydon hoare graydon@redhat.com
Sat Aug 9 03:27:00 GMT 2003


trivial fix to make colors with alpha work. ok to commit?

-graydon

2003-08-08  Graydon Hoare  <graydon@redhat.com>

	* java/awt/Color.java (getAlpha): Prevent sign extension in
	extracted alpha value.

--- Color.java	2002-08-09 00:26:13.000000000 -0400
+++ Color.java	2003-08-08 17:08:59.000000000 -0400
@@ -496,7 +496,7 @@
   public int getAlpha()
   {
     // Do not inline getRGB() to value, because of SystemColor.
-    return (getRGB() & ALPHA_MASK) >> 24;
+    return ((getRGB() & ALPHA_MASK) >> 24) & 0xff;
   }
 
   /**



More information about the Java-patches mailing list