Allow tile set bundles to be created uncompressed - this probably will go hand-in-hand with the keepRawPngs parameter, but I can imagine the two being used separately so I won't overload the single parameter.
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@958 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -132,17 +132,18 @@ public class TileSetBundler
|
||||
public TileSetBundler (File configFile)
|
||||
throws IOException
|
||||
{
|
||||
this(configFile, false);
|
||||
this(configFile, false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a tileset bundler with the specified bundler config
|
||||
* file and whether to keep pngs as-is or if not, re-encode them.
|
||||
*/
|
||||
public TileSetBundler (File configFile, boolean keepRawPngs)
|
||||
public TileSetBundler (File configFile, boolean keepRawPngs, boolean uncompressed)
|
||||
throws IOException
|
||||
{
|
||||
_keepRawPngs = keepRawPngs;
|
||||
_uncompressed = uncompressed;
|
||||
|
||||
// we parse our configuration with a digester
|
||||
Digester digester = new Digester();
|
||||
@@ -352,7 +353,7 @@ public class TileSetBundler
|
||||
File target, TileSetBundle bundle, ImageProvider improv, String imageBase, long newestMod)
|
||||
throws IOException
|
||||
{
|
||||
return createBundleJar(target, bundle, improv, imageBase, _keepRawPngs);
|
||||
return createBundleJar(target, bundle, improv, imageBase, _keepRawPngs, _uncompressed);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -367,14 +368,14 @@ public class TileSetBundler
|
||||
*/
|
||||
public static boolean createBundleJar (
|
||||
File target, TileSetBundle bundle, ImageProvider improv, String imageBase,
|
||||
boolean keepOriginalPngs)
|
||||
boolean keepOriginalPngs, boolean uncompressed)
|
||||
throws IOException
|
||||
{
|
||||
// now we have to create the actual bundle file
|
||||
FileOutputStream fout = new FileOutputStream(target);
|
||||
Manifest manifest = new Manifest();
|
||||
JarOutputStream jar = new JarOutputStream(fout, manifest);
|
||||
jar.setLevel(Deflater.BEST_COMPRESSION);
|
||||
jar.setLevel(uncompressed ? Deflater.NO_COMPRESSION : Deflater.BEST_COMPRESSION);
|
||||
|
||||
try {
|
||||
// write all of the image files to the bundle, converting the
|
||||
@@ -516,4 +517,7 @@ public class TileSetBundler
|
||||
|
||||
/** Whether we should keep pngs as-is rather than re-encoding. */
|
||||
protected boolean _keepRawPngs;
|
||||
|
||||
/** Normally we compress the jar, but if we want to leave them uncompressed, we set this. */
|
||||
protected boolean _uncompressed;
|
||||
}
|
||||
|
||||
@@ -75,6 +75,15 @@ public class TileSetBundlerTask extends Task
|
||||
_keepRawPngs = keep;
|
||||
}
|
||||
|
||||
/**
|
||||
* Note whether we are supposed to leave the jar uncompressed rather than the normal process
|
||||
* of zipping it at maximum compression.
|
||||
*/
|
||||
public void setUncompressed (boolean uncompressed)
|
||||
{
|
||||
_uncompressed = uncompressed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the actual work of the task.
|
||||
*/
|
||||
@@ -146,7 +155,7 @@ public class TileSetBundlerTask extends Task
|
||||
protected TileSetBundler createBundler ()
|
||||
throws IOException
|
||||
{
|
||||
return new TileSetBundler(_config, _keepRawPngs);
|
||||
return new TileSetBundler(_config, _keepRawPngs, _uncompressed);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -173,4 +182,7 @@ public class TileSetBundlerTask extends Task
|
||||
|
||||
/** Whether we should keep raw pngs rather than reencoding them in the bundle. */
|
||||
protected boolean _keepRawPngs;
|
||||
|
||||
/** Whether we should keep the bundle jars uncompressed rather than zipped. */
|
||||
protected boolean _uncompressed;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user