SunGraphics2D instead of Graphics2D

Mike Swingler swingler at apple.com
Mon Nov 21 12:06:22 PST 2011


I don't think we had any specific reason to cast SunGraphics2D instead of just Graphics2D. Feel free to change the casts.

Regards,
Mike Swingler
Apple Inc.

On Nov 21, 2011, at 8:58 AM, Alexander Potochkin wrote:

> Hello Mario
> 
> Your patch looks very logic,
> let me ask the Apple guys what were the reasons behind that SunGraphics2D cast
> 
> Thanks!
> alexp
>> Hello all,
>> 
>> While developing our Swing/JavaFX integration [1] 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:
>> 
>> http://cr.openjdk.java.net/~neugens/use_graphics2d/webrev.01/
>> 
>> Any comments?
>> 
>> Cheers,
>> Mario
>> 
>> [1]  Some links:
>>        http://jroller.com/neugens/entry/jfreechartfx
>>        http://jroller.com/neugens/entry/oh_no_i_lost_focus
>>        http://thingsfx.com/
>> ---
>> pgp key: http://subkeys.pgp.net/ PGP Key ID: 80F240CF
>> Fingerprint: BA39 9666 94EC 8B73 27FA  FC7C 4086 63E3 80F2 40CF
>> 
>> http://www.ladybug-studio.com
>> 
>> IcedRobot: www.icedrobot.org
>> Proud GNU Classpath developer: http://www.classpath.org/
>> Read About us at: http://planet.classpath.org
>> OpenJDK: http://openjdk.java.net/projects/caciocavallo/
>> 
>> Please, support open standards:
>> http://endsoftpatents.org/
>> 
>> 
>> 
>> 
> 



More information about the macosx-port-dev mailing list