summaryrefslogtreecommitdiffstats
path: root/libjava/java/awt/Color.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java/awt/Color.java')
-rw-r--r--libjava/java/awt/Color.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/libjava/java/awt/Color.java b/libjava/java/awt/Color.java
index e6eb03e8f0a..c41117a6e33 100644
--- a/libjava/java/awt/Color.java
+++ b/libjava/java/awt/Color.java
@@ -319,7 +319,12 @@ public class Color implements Paint, Serializable
{
if ((red & 255) != red || (green & 255) != green || (blue & 255) != blue
|| (alpha & 255) != alpha)
- throw new IllegalArgumentException("Bad RGB values");
+ throw new IllegalArgumentException("Bad RGB values"
+ +" red=0x"+Integer.toHexString(red)
+ +" green=0x"+Integer.toHexString(green)
+ +" blue=0x"+Integer.toHexString(blue)
+ +" alpha=0x"+Integer.toHexString(alpha) );
+
value = (alpha << 24) | (red << 16) | (green << 8) | blue;
falpha = 1;
cs = null;
@@ -950,7 +955,7 @@ public class Color implements Paint, Serializable
* object, regardless of the parameters. Subclasses, however, may have a
* mutable result.
*
- * @param cm the requested color model, ignored
+ * @param cm the requested color model
* @param deviceBounds the bounding box in device coordinates, ignored
* @param userBounds the bounding box in user coordinates, ignored
* @param xform the bounds transformation, ignored
@@ -962,8 +967,8 @@ public class Color implements Paint, Serializable
AffineTransform xform,
RenderingHints hints)
{
- if (context == null)
- context = new ColorPaintContext(value);
+ if (context == null || !context.getColorModel().equals(cm))
+ context = new ColorPaintContext(cm,value);
return context;
}
OpenPOWER on IntegriCloud