<AWT Dev> [OpenJDK 2D-Dev] One or many GraphicsConfiguration(s) per toplevel?

Anthony Petrov Anthony.Petrov at Sun.COM
Wed Jan 21 11:23:03 PST 2009


On 1/21/2009 9:16 PM Dmitri Trembovetski wrote:
>> Perhaps it would make sense to move the graphicsConfig member to
>> the Window class and use its value for
>> Component.getGraphicsConfiguration()? A component not currently
>> contained in a toplevel window obviously should have a null GC.  
>> Thoughts?
> 
>   May not be a bad idea. The less copies of GC we have laying around
>   the smaller chance it is that someone would use a stale version.
> 
>   The only consideration is that getting a GC is a very common operation,
>   and traveling the hierarchy every time to retrieve it could
>   result in performance degradation (wouldn't you need to grab the tree
>   lock for that too?).
Yeah, I see the point. Another option is to make the field private, 
create a final package-private getter (though why? we have a lovely 
public one already), and private setter. The setter would be invoked 
through the sun.awt.AWTAccessor by the toplevel window whenever its own 
GC gets changed (holding the TreeLock and traversing the whole 
hierarchy). It will also be assigned when adding a component to a 
container (by using the container's local copy of the gc - which we 
assume correct). This way we ensure there's only one value of gc in 
every single component in the given toplevel window at any moment of 
time. I guess changing the GC is not quite frequent operation to worry 
much about the performance of this approach?

--
best regards,
Anthony



More information about the awt-dev mailing list