[OpenJDK 2D-Dev] One or many GraphicsConfiguration(s) per	toplevel?
    Dmitri Trembovetski 
    Dmitri.Trembovetski at Sun.COM
       
    Thu Jan 22 17:40:21 UTC 2009
    
    
  
Anthony Petrov wrote:
> Hi Dmitri,
> 
> On 01/21/2009 10:23 PM Anthony Petrov wrote:
>> 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?
> 
> By the way, Canvases may be created with a non-default GC. How should 
> these be treated then if we think we should have the same GC for every 
> component in a Window?
   Hmm. Indeed, forgot about that.
   Canvas is pretty much a toplevel from this perspective.
   For Canvas it wasn't really meant to specify a location
   (like, which screen it appears on), but the visual of the
   window (or pixel format on windows).
   So we can modify our original suggestion, and treat Canvas
   as toplevel - allow it to have its own GC.
   But it's not clear what to do if its toplevel containing
   a canvas created with non-default GC is moved onto a different
   screen (or if a display change event happened which
   re-created all GCs).
   The only sensible option I see is to change it to the
   new default GC.
   This stuff was designed when there were no multiple
   screens, and it shows - at least, you couldn't move a
   window from one screen to another (windows didn't
   have multiscreen up until Win2k/WinXP, and xinerama
   was a rare beast back then).
   The bulk of multiscreen and display change support in Java
   was retrofitted later.
   Thanks,
     Dmitri
    
    
More information about the 2d-dev
mailing list