Don't freak out if we can't load our source image.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2400 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
//
|
//
|
||||||
// $Id: CachedVolatileMirage.java,v 1.2 2003/01/13 23:56:01 mdb Exp $
|
// $Id: CachedVolatileMirage.java,v 1.3 2003/04/11 18:48:05 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.media.image;
|
package com.threerings.media.image;
|
||||||
|
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.Transparency;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
import com.threerings.media.Log;
|
import com.threerings.media.Log;
|
||||||
@@ -42,7 +43,8 @@ public class CachedVolatileMirage extends VolatileMirage
|
|||||||
protected int getTransparency ()
|
protected int getTransparency ()
|
||||||
{
|
{
|
||||||
BufferedImage source = _imgr.getImage(_source, _zations);
|
BufferedImage source = _imgr.getImage(_source, _zations);
|
||||||
return source.getColorModel().getTransparency();
|
return (source == null) ? Transparency.OPAQUE :
|
||||||
|
source.getColorModel().getTransparency();
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
@@ -51,8 +53,10 @@ public class CachedVolatileMirage extends VolatileMirage
|
|||||||
Graphics gfx = null;
|
Graphics gfx = null;
|
||||||
try {
|
try {
|
||||||
BufferedImage source = _imgr.getImage(_source, _zations);
|
BufferedImage source = _imgr.getImage(_source, _zations);
|
||||||
gfx = _image.getGraphics();
|
if (source != null) {
|
||||||
gfx.drawImage(source, -_bounds.x, -_bounds.y, null);
|
gfx = _image.getGraphics();
|
||||||
|
gfx.drawImage(source, -_bounds.x, -_bounds.y, null);
|
||||||
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.warning("Failure refreshing mirage " + this + ".");
|
Log.warning("Failure refreshing mirage " + this + ".");
|
||||||
|
|||||||
Reference in New Issue
Block a user