Hi Anthony,

Anthony Petrov wrote:
Hi Dmitri,

On 1/21/2009 8:43 PM Dmitri Trembovetski wrote:
implementation of this method in the Container class that recursively calls this method for every child of the container.

The question is: is it really possible for one toplevel to contain components having different GraphicsDevice's (and/or different GraphicsConfiguration's)? Or may I assume that all and every descendant components of a toplevel window use the same GC that the window uses (and therefore the Container.checkGD() may safely be removed)?

  We should enforce that all components within a toplevel have the
  same GC. If checkGD does that I wouldn't remove it.
"Asserts" are fine as long as they are simple and fast. But if we're sure we don't have several GC/GDs per toplevel window, then I don't see much reason to waste time recursively traversing the whole hierarchy of components of a container when it gets added to another container.

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?).

  Thanks,
    Dmitri

Reply via email to