From bf5fff9ee17e7e7c5679345e6c324892bf864161 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Mon, 16 Jan 2006 21:21:22 +0000 Subject: [PATCH] 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 --- .../com/threerings/media/FrameManager.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/java/com/threerings/media/FrameManager.java b/src/java/com/threerings/media/FrameManager.java index b186541d5..7621dd5dc 100644 --- a/src/java/com/threerings/media/FrameManager.java +++ b/src/java/com/threerings/media/FrameManager.java @@ -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 could + * 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)) {