Don't forcibly render layer components that are not currently visible; added a
mechanism for layer components that know they will never be "under-rendered" to avoid the expense of forced rendering on every tick. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3805 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -109,6 +109,20 @@ import com.threerings.util.unsafe.Unsafe;
|
||||
*/
|
||||
public abstract class FrameManager
|
||||
{
|
||||
/**
|
||||
* Normally, the frame manager will repaint any component in a {@link
|
||||
* JLayeredPane} layer (popups, overlays, etc.) that overlaps a frame
|
||||
* participant on every tick because the frame participant <em>could</em>
|
||||
* have changed underneath the overlay which would require that the overlay
|
||||
* be repainted. If the application knows that the frame participant
|
||||
* beneath the overlay will never change, it can have its overlay implement
|
||||
* this interface and avoid the expense of forcibly fully repainting the
|
||||
* overlay on every frame.
|
||||
*/
|
||||
public static interface SafeLayerComponent
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a frame manager that will use a {@link SystemMediaTimer} to
|
||||
* obtain timing information, which is available on every platform,
|
||||
@@ -601,6 +615,12 @@ public abstract class FrameManager
|
||||
Component[] comps = pane.getComponentsInLayer(layer.intValue());
|
||||
for (int ii = 0; ii < ccount; ii++) {
|
||||
Component comp = comps[ii];
|
||||
if (!comp.isVisible() || comp instanceof SafeLayerComponent) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// if this overlay does not intersect the component we just
|
||||
// rendered, we don't need to repaint it
|
||||
_tbounds.setBounds(0, 0, comp.getWidth(), comp.getHeight());
|
||||
getRoot(comp, _tbounds);
|
||||
if (!_tbounds.intersects(bounds)) {
|
||||
|
||||
Reference in New Issue
Block a user