This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] prevent sign extended alpha values


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;
   }
 
   /**


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]