This is breaking a little backwards compatibility but on something we're surely not using anywhere else anyway - if a scene object has already been laid out, don't do it repeatedly, which was then causing extra dirty rectangles, especially when we scrolled. The actual breakage of compatibility comes that I took out the otherIndicators argument on SceneObjectIndicator.layout, which we weren't using anyway.

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@865 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Mike Thomas
2009-11-25 19:08:12 +00:00
parent 29df8b9166
commit 0278208ef8
3 changed files with 17 additions and 10 deletions
@@ -1321,11 +1321,12 @@ public class MisoScenePanel extends VirtualMediaPanel
{ {
// make sure the indicators are ready // make sure the indicators are ready
if (!_indicatorsLaidOut) { if (!_indicatorsLaidOut) {
List<Rectangle> boundaries = Lists.newArrayList();
for (Map.Entry<SceneObject, SceneObjectIndicator> entry : _indicators.entrySet()) { for (Map.Entry<SceneObject, SceneObjectIndicator> entry : _indicators.entrySet()) {
entry.getValue().layout(gfx, entry.getKey(), _vbounds, boundaries); SceneObjectIndicator indic = entry.getValue();
dirtyIndicator(entry.getValue()); if (!indic.isLaidOut()) {
boundaries.add(entry.getValue().getBounds()); indic.layout(gfx, entry.getKey(), _vbounds);
dirtyIndicator(indic);
}
} }
_indicatorsLaidOut = true; _indicatorsLaidOut = true;
} }
@@ -41,8 +41,12 @@ public interface SceneObjectIndicator
/** /**
* Positions the indicator in the scene in relation to <code>key</code> * Positions the indicator in the scene in relation to <code>key</code>
*/ */
public void layout (Graphics2D gfx, SceneObject key, Rectangle viewBounds, public void layout (Graphics2D gfx, SceneObject key, Rectangle viewBounds);
Collection<Rectangle> otherIndicators);
/**
* Returns whether the indicator has already been laid out (and thus doesn't need to be again)
*/
public boolean isLaidOut ();
/** /**
* Called when the indicator is removed from the scene. * Called when the indicator is removed from the scene.
@@ -21,8 +21,6 @@
package com.threerings.miso.client; package com.threerings.miso.client;
import java.util.Collection;
import java.awt.AlphaComposite; import java.awt.AlphaComposite;
import java.awt.Color; import java.awt.Color;
import java.awt.Composite; import java.awt.Composite;
@@ -77,6 +75,11 @@ public class SceneObjectTip extends LabelSausage
super(new Label(text, _foreground, _font), icon); super(new Label(text, _foreground, _font), icon);
} }
public boolean isLaidOut ()
{
return _label.isLaidOut();
}
/** /**
* Called to initialize the tip so that it can be painted. * Called to initialize the tip so that it can be painted.
* *
@@ -84,8 +87,7 @@ public class SceneObjectTip extends LabelSausage
* @param boundary the boundary of all displayable space. * @param boundary the boundary of all displayable space.
* @param othertips other tip boundaries that we should avoid. * @param othertips other tip boundaries that we should avoid.
*/ */
public void layout (Graphics2D gfx, SceneObject tipFor, Rectangle boundary, public void layout (Graphics2D gfx, SceneObject tipFor, Rectangle boundary)
Collection<Rectangle> othertips)
{ {
layout(gfx, ICON_PAD, EXTRA_PAD); layout(gfx, ICON_PAD, EXTRA_PAD);
bounds = new Rectangle(_size); bounds = new Rectangle(_size);