Go ahead and return our cached subimage since we have it.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1479 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-06-19 00:20:49 +00:00
parent 30071e79c2
commit e91b6420b1
+9 -10
View File
@@ -1,5 +1,5 @@
// //
// $Id: Tile.java,v 1.20 2002/06/18 22:19:56 mdb Exp $ // $Id: Tile.java,v 1.21 2002/06/19 00:20:49 mdb Exp $
package com.threerings.media.tile; package com.threerings.media.tile;
@@ -30,7 +30,13 @@ public class Tile implements Cloneable
{ {
_image = image; _image = image;
_bounds = bounds; _bounds = bounds;
_subimage = getImage(); if (_image instanceof BufferedImage) {
_subimage = ImageUtil.getSubimage(_image, _bounds.x, _bounds.y,
_bounds.width, _bounds.height);
} else {
String errmsg = "Can't obtain tile image [tile=" + this + "].";
throw new RuntimeException(errmsg);
}
} }
/** /**
@@ -80,14 +86,7 @@ public class Tile implements Cloneable
*/ */
public Image getImage () public Image getImage ()
{ {
if (_image instanceof BufferedImage) { return _subimage;
return ImageUtil.getSubimage(_image, _bounds.x, _bounds.y,
_bounds.width, _bounds.height);
} else {
String errmsg = "Can't obtain tile image [tile=" + this + "].";
throw new RuntimeException(errmsg);
}
} }
/** /**