SunGraphics2D instead of Graphics2D
neugens at limasoftware.net
Fri Nov 18 15:17:44 PST 2011
While developing our Swing/JavaFX integration  I've found that with the aqua look and feel it doesn't paint correctly, unless I set the awt.nativeDoubleBuffering to false.
The reason for this is that internally, Graphics2D objects are casted to SunGraphics2D, probably this is a left over for some specific optimizations in the Apple JDK, but from the current OpenJDK code I can't see any reason for that cast to exist.
The problem surfaces because we use a special component to proxy heavyweight behavior to the Java FX view and to provide graphics and all the usual goodies that the swing hierarchy wants.
In particular, the graphics object for the heavyweight component is a proxy graphics that wraps a BufferedImage.
Since those cast gets in the way only when native double buffering is enabled on the Mac, I can workaround for older JDK releases, but I would really like to see if this fix can be pushed in for OpenJDK 7.
The webrev for the patch is here:
 Some links:
pgp key: http://subkeys.pgp.net/ PGP Key ID: 80F240CF
Fingerprint: BA39 9666 94EC 8B73 27FA FC7C 4086 63E3 80F2 40CF
Proud GNU Classpath developer: http://www.classpath.org/
Read About us at: http://planet.classpath.org
Please, support open standards:
More information about the macosx-port-dev