com.threerings.media
Class ActiveRepaintManager

java.lang.Object
  extended by javax.swing.RepaintManager
      extended by com.threerings.media.ActiveRepaintManager

public class ActiveRepaintManager
extends RepaintManager

Used to get Swing's repainting to jive with our active rendering strategy.

See Also:
FrameManager

Field Summary
protected  Rectangle _cbounds
          Used to compute dirty components' bounds.
protected  boolean[] _clipped
          Used when rendering "layered" components.
protected  Map<JComponent,Rectangle> _dirty
          A mapping of invalid rectangles for each widget that is dirty.
protected  Object[] _invalid
          A list of invalid components.
protected  Component _root
          The root of our interface.
protected  Map<JComponent,Rectangle> _spare
          A spare hashmap that we swap in while repainting dirty components in the old hashmap.
protected static boolean DEBUG
          We debug so much that we have to make it easy to enable and disable debug logging.
 
Constructor Summary
ActiveRepaintManager(Component root)
          Components that are rooted in this component (which must be a Window or an Applet) will be rendered into the offscreen buffer managed by the frame manager.
 
Method Summary
 void addDirtyRegion(JComponent comp, int x, int y, int width, int height)
           
 void addInvalidComponent(JComponent comp)
           
protected static void dumpHierarchy(Component comp)
          Dumps the containment hierarchy for the supplied component.
 Rectangle getDirtyRegion(JComponent comp)
           
protected  Component getRoot(Component comp)
          Returns the root component for the supplied component or null if it is not part of a rooted hierarchy or if any parent along the way is found to be hidden or without a peer.
 void markCompletelyClean(JComponent comp)
           
 boolean paintComponents(Graphics g, FrameManager fmgr)
          Paints the components that have become dirty since the last tick.
protected static String toString(Component comp)
          Used to dump a component when debugging.
 void validateComponents()
          Validates the invalid components that have been queued up since the last frame tick.
 
Methods inherited from class javax.swing.RepaintManager
addDirtyRegion, addDirtyRegion, currentManager, currentManager, getDoubleBufferMaximumSize, getOffscreenBuffer, getVolatileOffscreenBuffer, isCompletelyDirty, isDoubleBufferingEnabled, markCompletelyDirty, paintDirtyRegions, removeInvalidComponent, setCurrentManager, setDoubleBufferingEnabled, setDoubleBufferMaximumSize, toString, validateInvalidComponents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_root

protected Component _root
The root of our interface.


_invalid

protected Object[] _invalid
A list of invalid components.


_dirty

protected Map<JComponent,Rectangle> _dirty
A mapping of invalid rectangles for each widget that is dirty.


_spare

protected Map<JComponent,Rectangle> _spare
A spare hashmap that we swap in while repainting dirty components in the old hashmap.


_cbounds

protected Rectangle _cbounds
Used to compute dirty components' bounds.


_clipped

protected boolean[] _clipped
Used when rendering "layered" components.


DEBUG

protected static final boolean DEBUG
We debug so much that we have to make it easy to enable and disable debug logging. Yay!

See Also:
Constant Field Values
Constructor Detail

ActiveRepaintManager

public ActiveRepaintManager(Component root)
Components that are rooted in this component (which must be a Window or an Applet) will be rendered into the offscreen buffer managed by the frame manager. Other components will be rendered into separate offscreen buffers and repainted in the normal Swing manner.

Method Detail

addInvalidComponent

public void addInvalidComponent(JComponent comp)
Overrides:
addInvalidComponent in class RepaintManager

addDirtyRegion

public void addDirtyRegion(JComponent comp,
                           int x,
                           int y,
                           int width,
                           int height)
Overrides:
addDirtyRegion in class RepaintManager

getRoot

protected Component getRoot(Component comp)
Returns the root component for the supplied component or null if it is not part of a rooted hierarchy or if any parent along the way is found to be hidden or without a peer.


getDirtyRegion

public Rectangle getDirtyRegion(JComponent comp)
Overrides:
getDirtyRegion in class RepaintManager

markCompletelyClean

public void markCompletelyClean(JComponent comp)
Overrides:
markCompletelyClean in class RepaintManager

validateComponents

public void validateComponents()
Validates the invalid components that have been queued up since the last frame tick.


paintComponents

public boolean paintComponents(Graphics g,
                               FrameManager fmgr)
Paints the components that have become dirty since the last tick.

Returns:
true if any components were painted.

toString

protected static String toString(Component comp)
Used to dump a component when debugging.


dumpHierarchy

protected static void dumpHierarchy(Component comp)
Dumps the containment hierarchy for the supplied component.