Not to complain if we can't load an image because we'll fall back to the
classpath. Removed getImageSource() as calling through to the resource manager is simpler. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1972 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: ImageManager.java,v 1.26 2002/11/20 02:15:05 mdb Exp $
|
// $Id: ImageManager.java,v 1.27 2002/11/20 03:06:06 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.media;
|
package com.threerings.media;
|
||||||
|
|
||||||
@@ -75,7 +75,11 @@ public class ImageManager
|
|||||||
InputStream imgin = null;
|
InputStream imgin = null;
|
||||||
try {
|
try {
|
||||||
// first attempt to load the image from the specified resource set
|
// first attempt to load the image from the specified resource set
|
||||||
imgin = getImageSource(rset, path);
|
try {
|
||||||
|
imgin = _rmgr.getResource(rset, path);
|
||||||
|
} catch (FileNotFoundException fnfe) {
|
||||||
|
// fall through and try the classpath
|
||||||
|
}
|
||||||
|
|
||||||
// if that fails, attempt to load the image from the classpath
|
// if that fails, attempt to load the image from the classpath
|
||||||
if (imgin == null) {
|
if (imgin == null) {
|
||||||
@@ -164,11 +168,7 @@ public class ImageManager
|
|||||||
public Image loadImage (String rset, String path)
|
public Image loadImage (String rset, String path)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
InputStream imgin = getImageSource(rset, path);
|
InputStream imgin = _rmgr.getResource(rset, path);
|
||||||
if (imgin == null) {
|
|
||||||
throw new IOException("Image not in resource set " +
|
|
||||||
"[rset=" + rset + ", path=" + path + "].");
|
|
||||||
}
|
|
||||||
|
|
||||||
// load up the image
|
// load up the image
|
||||||
try {
|
try {
|
||||||
@@ -181,22 +181,6 @@ public class ImageManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an input stream from which the requested image can be
|
|
||||||
* loaded or null if the image could not be located in any bundle in
|
|
||||||
* the specified resource set.
|
|
||||||
*/
|
|
||||||
protected InputStream getImageSource (String rset, String path)
|
|
||||||
throws IOException
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
return _rmgr.getResource(rset, path);
|
|
||||||
} catch (FileNotFoundException fnfe) {
|
|
||||||
Log.warning(fnfe.getMessage());
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the image from the supplied input stream. Does no caching and
|
* Loads the image from the supplied input stream. Does no caching and
|
||||||
* does not convert the image for optimized display on the target
|
* does not convert the image for optimized display on the target
|
||||||
|
|||||||
Reference in New Issue
Block a user