Catch and report image decoding errors when obtaining sub-image.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1683 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: Tile.java,v 1.22 2002/06/19 08:26:22 mdb Exp $
|
// $Id: Tile.java,v 1.23 2002/09/13 20:27:05 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.media.tile;
|
package com.threerings.media.tile;
|
||||||
|
|
||||||
@@ -7,10 +7,11 @@ import java.awt.Graphics;
|
|||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.Shape;
|
import java.awt.Shape;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
|
import com.threerings.media.Log;
|
||||||
import com.threerings.media.util.ImageUtil;
|
import com.threerings.media.util.ImageUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,8 +39,17 @@ public class Tile implements Cloneable
|
|||||||
protected void createSubImage ()
|
protected void createSubImage ()
|
||||||
{
|
{
|
||||||
if (_image instanceof BufferedImage) {
|
if (_image instanceof BufferedImage) {
|
||||||
_subimage = ImageUtil.getSubimage(_image, _bounds.x, _bounds.y,
|
try {
|
||||||
_bounds.width, _bounds.height);
|
_subimage = ImageUtil.getSubimage(
|
||||||
|
_image, _bounds.x, _bounds.y,
|
||||||
|
_bounds.width, _bounds.height);
|
||||||
|
} catch (RuntimeException rte) {
|
||||||
|
Log.warning("Failure creating subimage [src=" + _image +
|
||||||
|
", bounds=" + StringUtil.toString(_bounds) +
|
||||||
|
", error=" + rte + "].");
|
||||||
|
throw rte;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
String errmsg = "Can't obtain tile image [tile=" + this + "].";
|
String errmsg = "Can't obtain tile image [tile=" + this + "].";
|
||||||
throw new RuntimeException(errmsg);
|
throw new RuntimeException(errmsg);
|
||||||
|
|||||||
Reference in New Issue
Block a user