diff --git a/src/java/com/threerings/miso/client/MisoScenePanel.java b/src/java/com/threerings/miso/client/MisoScenePanel.java index ab56c3f87..b017ba0aa 100644 --- a/src/java/com/threerings/miso/client/MisoScenePanel.java +++ b/src/java/com/threerings/miso/client/MisoScenePanel.java @@ -1,5 +1,5 @@ // -// $Id: MisoScenePanel.java,v 1.15 2003/04/25 22:13:14 mdb Exp $ +// $Id: MisoScenePanel.java,v 1.16 2003/04/26 02:16:18 mdb Exp $ package com.threerings.miso.client; @@ -661,7 +661,7 @@ public class MisoScenePanel extends VirtualMediaPanel // if this block has objects that intersect our visible bounds // (zoiks!) then repaint Rectangle sbounds = block.getScreenBounds(); - if (sbounds.intersects(_vbounds)) { + if (sbounds != null && sbounds.intersects(_vbounds)) { // Log.info("Eek, block came into view during resolution " + // block + "."); } diff --git a/src/java/com/threerings/miso/client/SceneBlock.java b/src/java/com/threerings/miso/client/SceneBlock.java index bbf484b7c..301288729 100644 --- a/src/java/com/threerings/miso/client/SceneBlock.java +++ b/src/java/com/threerings/miso/client/SceneBlock.java @@ -1,5 +1,5 @@ // -// $Id: SceneBlock.java,v 1.11 2003/04/25 22:13:14 mdb Exp $ +// $Id: SceneBlock.java,v 1.12 2003/04/26 02:16:18 mdb Exp $ package com.threerings.miso.client; @@ -48,9 +48,6 @@ public class SceneBlock _footprint = MisoUtil.getFootprintPolygon( panel.getSceneMetrics(), tx, ty, width, height); - // start with the bounds of the footprint polygon - _sbounds = new Rectangle(_footprint.getBounds()); - // the rest of our resolution will happen in resolve() } @@ -59,7 +56,7 @@ public class SceneBlock * block resolution thread to allow us to load up our image data * without blocking the AWT thread. */ - protected synchronized boolean resolve () + protected boolean resolve () { // if we got canned before we were resolved, go ahead and bail now if (_panel.getBlock(_bounds.x, _bounds.y) != this) { @@ -67,6 +64,9 @@ public class SceneBlock return false; } + // start with the bounds of the footprint polygon + Rectangle sbounds = new Rectangle(_footprint.getBounds()); + // resolve our base tiles MisoSceneModel model = _panel.getSceneModel(); for (int yy = 0; yy < _bounds.height; yy++) { @@ -97,7 +97,7 @@ public class SceneBlock _objects = new SceneObject[set.size()]; for (int ii = 0; ii < _objects.length; ii++) { _objects[ii] = new SceneObject(_panel, set.get(ii)); - _sbounds.add(_objects[ii].bounds); + sbounds.add(_objects[ii].bounds); } // resolve our default tileset @@ -111,6 +111,12 @@ public class SceneBlock ", error=" + e + "]."); } + // this both marks us as resolved and makes all our other updated + // fields visible + synchronized (this) { + _sbounds = sbounds; + } + return true; } @@ -126,9 +132,9 @@ public class SceneBlock /** * Returns true if this block has been resolved, false if not. */ - protected boolean isResolved () + protected synchronized boolean isResolved () { - return (_defset != null); + return _sbounds != null; } /**