Jim Graham wrote:

I'm curious if you need this behavior or not.

No, I don't specifically need this behavior. I am simply working my way through JCK failures on OpenJDK/icedtea.

So, I guess it is reasonable to fix (though I'm still curious if anyone but the JCK tests might rely on the behavior), but please fix it in a way that is compatible with the SystemColor rgb mutation so that we don't regress that bug at the same time...

Ultimately, the decision to fix/not fix is up to you guys. I am simply following the specifications and the JCK.

I think the attached patch addresses the regression concern, but I have not tested it (I am not even sure how to test it).

Thank you for your extensive reply,
Keith
--- openjdk/jdk/src/share/classes/java/awt/Color.java.orig	2008-04-18 12:31:17.000000000 -0700
+++ openjdk/jdk/src/share/classes/java/awt/Color.java	2008-04-18 12:31:42.000000000 -0700
@@ -251,6 +251,12 @@
      */
     private ColorSpace cs = null;
 
+    /**
+     * The <code>PaintContext</code> for this solid color.
+     * @see #createContext
+     */
+    private transient ColorPaintContext context;
+
     /*
      * JDK 1.1 serialVersionUID
      */
@@ -1205,7 +1211,10 @@
                                                    Rectangle2D r2d,
                                                    AffineTransform xform,
                                                    RenderingHints hints) {
-        return new ColorPaintContext(getRGB(), cm);
+      if (context == null || !context.getColorModel().equals(cm)
+	  || context.getRGB() != getRGB())
+	context = new ColorPaintContext(getRGB(), cm);
+      return context;
     }
 
     /**

Reply via email to