Added support for obtaining the estimated memory usage of a Mirage.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2174 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2003-01-17 02:30:21 +00:00
parent 34144c86de
commit 6f7ad6a09f
4 changed files with 28 additions and 4 deletions
@@ -1,5 +1,5 @@
//
// $Id: BlankMirage.java,v 1.1 2003/01/13 22:49:46 mdb Exp $
// $Id: BlankMirage.java,v 1.2 2003/01/17 02:30:21 mdb Exp $
package com.threerings.media.image;
@@ -42,6 +42,12 @@ public class BlankMirage implements Mirage
return false;
}
// documentation inherited from interface
public long getEstimatedMemoryUsage ()
{
return 0;
}
// documentation inherited from interface
public BufferedImage getSnapshot ()
{
@@ -1,5 +1,5 @@
//
// $Id: BufferedMirage.java,v 1.1 2003/01/13 22:49:46 mdb Exp $
// $Id: BufferedMirage.java,v 1.2 2003/01/17 02:30:21 mdb Exp $
package com.threerings.media.image;
@@ -40,6 +40,12 @@ public class BufferedMirage implements Mirage
return ImageUtil.hitTest(_image, x, y);
}
// documentation inherited from interface
public long getEstimatedMemoryUsage ()
{
return ImageUtil.getEstimatedMemoryUsage(_image.getRaster());
}
// documentation inherited from interface
public BufferedImage getSnapshot ()
{
@@ -1,5 +1,5 @@
//
// $Id: Mirage.java,v 1.1 2003/01/13 22:49:46 mdb Exp $
// $Id: Mirage.java,v 1.2 2003/01/17 02:30:21 mdb Exp $
package com.threerings.media.image;
@@ -40,4 +40,10 @@ public interface Mirage
* should <em>not</em> be modified by the caller.
*/
public BufferedImage getSnapshot ();
/**
* Returns an estimate of the memory consumed by this mirage's image
* raster data.
*/
public long getEstimatedMemoryUsage ();
}
@@ -1,5 +1,5 @@
//
// $Id: VolatileMirage.java,v 1.3 2003/01/14 04:18:25 mdb Exp $
// $Id: VolatileMirage.java,v 1.4 2003/01/17 02:30:21 mdb Exp $
package com.threerings.media.image;
@@ -85,6 +85,12 @@ public abstract class VolatileMirage implements Mirage
return ImageUtil.hitTest(_image, x, y);
}
// documentation inherited from interface
public long getEstimatedMemoryUsage ()
{
return ImageUtil.getEstimatedMemoryUsage(_image.getRaster());
}
// documentation inherited from interface
public BufferedImage getSnapshot ()
{