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
if (!_indicatorsLaidOut) {
List<Rectangle> boundaries = Lists.newArrayList();
for (Map.Entry<SceneObject, SceneObjectIndicator> entry : _indicators.entrySet()) {
entry.getValue().layout(gfx, entry.getKey(), _vbounds, boundaries);
dirtyIndicator(entry.getValue());
boundaries.add(entry.getValue().getBounds());
SceneObjectIndicator indic = entry.getValue();
if (!indic.isLaidOut()) {
indic.layout(gfx, entry.getKey(), _vbounds);
dirtyIndicator(indic);
}
}
_indicatorsLaidOut = true;
}
@@ -41,8 +41,12 @@ public interface SceneObjectIndicator
/**
* Positions the indicator in the scene in relation to <code>key</code>
*/
public void layout (Graphics2D gfx, SceneObject key, Rectangle viewBounds,
Collection<Rectangle> otherIndicators);
public void layout (Graphics2D gfx, SceneObject key, Rectangle viewBounds);
/**
* 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.
@@ -21,8 +21,6 @@
package com.threerings.miso.client;
import java.util.Collection;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Composite;
@@ -77,6 +75,11 @@ public class SceneObjectTip extends LabelSausage
super(new Label(text, _foreground, _font), icon);
}
public boolean isLaidOut ()
{
return _label.isLaidOut();
}
/**
* 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 othertips other tip boundaries that we should avoid.
*/
public void layout (Graphics2D gfx, SceneObject tipFor, Rectangle boundary,
Collection<Rectangle> othertips)
public void layout (Graphics2D gfx, SceneObject tipFor, Rectangle boundary)
{
layout(gfx, ICON_PAD, EXTRA_PAD);
bounds = new Rectangle(_size);