Well that's just peachy. When we drawImage from a BufferedImage, the performance is relative to the size of the source image, not to the size of the resulting tile subimage. Therefore, for largish tileset sources, this was taking a Very Long Time. So, we take a subimage first and use that for our drawing. (I believe it's still accurate that we cannot just use the subimage directly due to various factors - though if we somehow could, it would save us some cache space).

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@534 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Mike Thomas
2008-06-10 20:29:20 +00:00
parent 7ae34a5683
commit 06e3217d6b
@@ -72,7 +72,11 @@ public class CachedVolatileMirage extends VolatileMirage
BufferedImage source = _imgr.getImage(_source, _zations);
if (source != null) {
gfx = _image.getGraphics();
gfx.drawImage(source, -_bounds.x, -_bounds.y, null);
// We grab a subimage before drawing because otherwise bufferedimage does all its
// computations across the entire image, including those parts outside the bounds.
BufferedImage subImg =
source.getSubimage(_bounds.x, _bounds.y, _bounds.width, _bounds.height);
gfx.drawImage(subImg, 0, 0, null);
}
} catch (Exception e) {