Updates to reflect new media architecture.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2123 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
//
|
||||
// $Id: ImageLoadingSpeed.java,v 1.1 2002/12/23 20:32:28 mdb Exp $
|
||||
// $Id: ImageLoadingSpeed.java,v 1.2 2003/01/13 22:57:45 mdb Exp $
|
||||
|
||||
package com.threerings.media;
|
||||
|
||||
import java.awt.Image;
|
||||
import java.io.*;
|
||||
|
||||
import com.threerings.resource.ResourceManager;
|
||||
import com.threerings.media.image.ImageManager;
|
||||
|
||||
/**
|
||||
* Tests our image loading speed.
|
||||
@@ -36,17 +38,30 @@ public class ImageLoadingSpeed
|
||||
// System.exit(-1);
|
||||
// }
|
||||
|
||||
for (int iter = 0; iter < IMAGE_LOAD_ITERS; iter++) {
|
||||
int iter = 0;
|
||||
while (true) {
|
||||
// for (int iter = 0; iter < IMAGE_LOAD_ITERS; iter++) {
|
||||
String path = args[iter%args.length];
|
||||
if (path.startsWith("rsrc/")) {
|
||||
path = path.substring(5);
|
||||
}
|
||||
Image image = null;
|
||||
try {
|
||||
image = imgr.loadImage(path);
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace(System.err);
|
||||
System.exit(-1);
|
||||
// image = imgr.getImage(path);
|
||||
image = imgr.getImage("components", path);
|
||||
|
||||
if (++iter == 100) {
|
||||
long now = System.currentTimeMillis();
|
||||
long elapsed = now - start;
|
||||
System.err.println("Loaded " + args.length +
|
||||
" images a total of " + iter +
|
||||
" times in " + elapsed + "ms.");
|
||||
System.err.println("An average of " + (elapsed/iter) +
|
||||
"ms per image.");
|
||||
start = now;
|
||||
iter = 0;
|
||||
|
||||
System.gc();
|
||||
try { Thread.sleep(5000); } catch (Throwable t) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,12 +81,12 @@ public class ImageLoadingSpeed
|
||||
// System.exit(-1);
|
||||
// }
|
||||
|
||||
long elapsed = System.currentTimeMillis() - start;
|
||||
// long elapsed = System.currentTimeMillis() - start;
|
||||
|
||||
System.err.println("Loaded " + args.length + " images a total of " +
|
||||
IMAGE_LOAD_ITERS + " times in " + elapsed + "ms.");
|
||||
System.err.println("An average of " + (elapsed/IMAGE_LOAD_ITERS) +
|
||||
"ms per image.");
|
||||
// System.err.println("Loaded " + args.length + " images a total of " +
|
||||
// IMAGE_LOAD_ITERS + " times in " + elapsed + "ms.");
|
||||
// System.err.println("An average of " + (elapsed/IMAGE_LOAD_ITERS) +
|
||||
// "ms per image.");
|
||||
}
|
||||
|
||||
protected static final int IMAGE_LOAD_ITERS = 100;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: TestIconManager.java,v 1.2 2002/07/19 20:13:29 shaper Exp $
|
||||
// $Id: TestIconManager.java,v 1.3 2003/01/13 22:57:45 mdb Exp $
|
||||
|
||||
package com.threerings.media;
|
||||
|
||||
@@ -9,8 +9,9 @@ import javax.swing.*;
|
||||
import com.samskivert.swing.HGroupLayout;
|
||||
import com.samskivert.swing.util.SwingUtil;
|
||||
|
||||
import com.threerings.resource.ResourceManager;
|
||||
import com.threerings.media.image.ImageManager;
|
||||
import com.threerings.media.tile.TileManager;
|
||||
import com.threerings.resource.ResourceManager;
|
||||
|
||||
/**
|
||||
* Does something extraordinary.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// $Id: SoundTestApp.java,v 1.3 2002/12/10 21:36:53 mdb Exp $
|
||||
// $Id: SoundTestApp.java,v 1.4 2003/01/13 22:57:45 mdb Exp $
|
||||
|
||||
package com.threerings.media;
|
||||
package com.threerings.media.sound;
|
||||
|
||||
import com.samskivert.util.StringUtil;
|
||||
import com.threerings.resource.ResourceManager;
|
||||
@@ -27,7 +27,7 @@ public class SoundTestApp
|
||||
for (int ii = 0; ii < _keys.length; ii++) {
|
||||
System.out.println("Playing " + _keys[ii] + ".");
|
||||
_soundmgr.play(SoundManager.DEFAULT,
|
||||
"com/threerings/media/", _keys[ii]);
|
||||
"com/threerings/media/sound/", _keys[ii]);
|
||||
}
|
||||
_soundmgr.shutdown();
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
//
|
||||
// $Id: BundledTileSetRepositoryTest.java,v 1.7 2002/07/19 20:13:30 shaper Exp $
|
||||
// $Id: BundledTileSetRepositoryTest.java,v 1.8 2003/01/13 22:57:45 mdb Exp $
|
||||
|
||||
package com.threerings.media.tile.bundle;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import com.threerings.media.image.ImageManager;
|
||||
import com.threerings.resource.ResourceManager;
|
||||
import com.threerings.media.ImageManager;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
@@ -22,9 +23,8 @@ public class BundledTileSetRepositoryTest extends TestCase
|
||||
try {
|
||||
ResourceManager rmgr = new ResourceManager("rsrc");
|
||||
rmgr.initBundles(null, "config/resource/manager.properties", null);
|
||||
ImageManager imgr = new ImageManager(rmgr, null);
|
||||
BundledTileSetRepository repo =
|
||||
new BundledTileSetRepository(rmgr, imgr, "tilesets");
|
||||
BundledTileSetRepository repo = new BundledTileSetRepository(
|
||||
rmgr, new ImageManager(rmgr, null), "tilesets");
|
||||
Iterator sets = repo.enumerateTileSets();
|
||||
while (sets.hasNext()) {
|
||||
sets.next();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: TraceViz.java,v 1.1 2002/11/15 09:29:40 shaper Exp $
|
||||
// $Id: TraceViz.java,v 1.2 2003/01/13 22:57:45 mdb Exp $
|
||||
|
||||
package com.threerings.media.util;
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.samskivert.swing.VGroupLayout;
|
||||
import com.samskivert.swing.util.SwingUtil;
|
||||
|
||||
import com.threerings.media.Log;
|
||||
import com.threerings.media.image.ImageUtil;
|
||||
|
||||
/**
|
||||
* Simple application for testing image trace functionality.
|
||||
|
||||
Reference in New Issue
Block a user