A few substantial changes:
- Tiles are initialized after being constructed which makes life simpler for custom tiles which no longer have to have their own constructor that passes Tile's stuff down to it. - Tiles are no longer LRU cached (because we blow through that cache instantly on all but the smallest of scenes), and are now tracked by weak references so that we guarantee that only one instance of a tile is ever in memory. - Added code to track and report memory usage of weak cached tiles as well as "stray" tiles which are created through other means than asking a TileSet for a tile (fringe tiles being the most prolific example). git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2628 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
//
|
||||
// $Id: ObjectTileSet.java,v 1.16 2003/05/13 02:16:21 mdb Exp $
|
||||
// $Id: ObjectTileSet.java,v 1.17 2003/05/31 00:56:38 mdb Exp $
|
||||
|
||||
package com.threerings.media.tile;
|
||||
|
||||
import com.samskivert.util.StringUtil;
|
||||
|
||||
import com.threerings.media.image.Mirage;
|
||||
import com.threerings.media.image.Colorization;
|
||||
|
||||
/**
|
||||
@@ -159,27 +158,31 @@ public class ObjectTileSet extends SwissArmyTileSet
|
||||
return zations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates instances of {@link ObjectTile}, which can span more than a
|
||||
* single tile's space in a display.
|
||||
*/
|
||||
protected Tile createTile (int tileIndex, Mirage image)
|
||||
// documentation inherited
|
||||
protected Tile createTile ()
|
||||
{
|
||||
ObjectTile tile = new ObjectTile(image);
|
||||
return new ObjectTile();
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
protected void initTile (Tile tile, int tileIndex, Colorization[] zations)
|
||||
{
|
||||
super.initTile(tile, tileIndex, zations);
|
||||
|
||||
ObjectTile otile = (ObjectTile)tile;
|
||||
if (_owidths != null) {
|
||||
tile.setBase(_owidths[tileIndex], _oheights[tileIndex]);
|
||||
otile.setBase(_owidths[tileIndex], _oheights[tileIndex]);
|
||||
}
|
||||
if (_xorigins != null) {
|
||||
tile.setOrigin(_xorigins[tileIndex], _yorigins[tileIndex]);
|
||||
otile.setOrigin(_xorigins[tileIndex], _yorigins[tileIndex]);
|
||||
}
|
||||
if (_priorities != null) {
|
||||
tile.setPriority(_priorities[tileIndex]);
|
||||
otile.setPriority(_priorities[tileIndex]);
|
||||
}
|
||||
if (_xspots != null) {
|
||||
tile.setSpot(_xspots[tileIndex], _yspots[tileIndex],
|
||||
_sorients[tileIndex]);
|
||||
otile.setSpot(_xspots[tileIndex], _yspots[tileIndex],
|
||||
_sorients[tileIndex]);
|
||||
}
|
||||
return tile;
|
||||
}
|
||||
|
||||
/** The width (in tile units) of our object tiles. */
|
||||
|
||||
Reference in New Issue
Block a user