diff --git a/engine/src/core/com/jme3/texture/Image.java b/engine/src/core/com/jme3/texture/Image.java index a37477df0..6a3cc46a2 100644 --- a/engine/src/core/com/jme3/texture/Image.java +++ b/engine/src/core/com/jme3/texture/Image.java @@ -534,6 +534,28 @@ public class Image extends GLObject implements Savable /*, Cloneable*/ { return mipMapSizes; } + @Override + public String toString(){ + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append("[size=").append(width).append("x").append(height); + + if (depth > 1) + sb.append("x").append(depth); + + sb.append(", format=").append(format.name()); + + if (hasMipmaps()) + sb.append(", mips"); + + if (getId() >= 0) + sb.append(", id=").append(id); + + sb.append("]"); + + return sb.toString(); + } + public boolean equals(Object other) { if (other == this) { return true; diff --git a/engine/src/core/com/jme3/texture/Texture.java b/engine/src/core/com/jme3/texture/Texture.java index 0181d9c13..734f5984e 100644 --- a/engine/src/core/com/jme3/texture/Texture.java +++ b/engine/src/core/com/jme3/texture/Texture.java @@ -504,18 +504,15 @@ public abstract class Texture implements Asset, Savable, Cloneable { @Override public String toString(){ - String imgTxt = null; - if (image != null){ - imgTxt = ", img="+image.getWidth() - +"x"+image.getHeight(); - if (image.getDepth() > 1) - imgTxt += "x"+image.getDepth(); - imgTxt += "-"+image.getFormat().name(); - if (image.hasMipmaps()) - imgTxt += "/mips"; - } + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append("[name=").append(name); + if (image != null) + sb.append(", image=").append(image.toString()); + + sb.append("]"); - return getClass().getSimpleName() + "[name="+name+imgTxt+"]"; + return sb.toString(); } // public boolean equals(Object other) { diff --git a/engine/src/jogg/com/jme3/audio/plugins/OGGLoader.java b/engine/src/jogg/com/jme3/audio/plugins/OGGLoader.java index dccb881ca..9d279b5a4 100644 --- a/engine/src/jogg/com/jme3/audio/plugins/OGGLoader.java +++ b/engine/src/jogg/com/jme3/audio/plugins/OGGLoader.java @@ -40,7 +40,6 @@ import com.jme3.audio.AudioKey; import com.jme3.util.BufferUtils; import de.jarnbjo.ogg.EndOfOggStreamException; import de.jarnbjo.ogg.LogicalOggStream; -import de.jarnbjo.ogg.OggPage; import de.jarnbjo.vorbis.IdentificationHeader; import de.jarnbjo.vorbis.VorbisStream; import java.io.ByteArrayOutputStream; @@ -136,8 +135,12 @@ public class OGGLoader implements AssetLoader { // System.out.println("Bytes Calculated: " + totalBytes); // System.out.println("Bytes Available: " + dataBytes.length); - ByteBuffer data = BufferUtils.createByteBuffer(totalBytes); - data.put(dataBytes, 0, totalBytes).flip(); + // Take the minimum of the number of bytes available + // and the expected duration of the audio. + int bytesToCopy = Math.min(totalBytes, dataBytes.length); + + ByteBuffer data = BufferUtils.createByteBuffer(bytesToCopy); + data.put(dataBytes, 0, bytesToCopy).flip(); vorbisStream.close(); loStream.close(); diff --git a/engine/src/niftygui/com/jme3/niftygui/RenderImageJme.java b/engine/src/niftygui/com/jme3/niftygui/RenderImageJme.java index fd837b8ed..bddb17309 100644 --- a/engine/src/niftygui/com/jme3/niftygui/RenderImageJme.java +++ b/engine/src/niftygui/com/jme3/niftygui/RenderImageJme.java @@ -43,6 +43,8 @@ public class RenderImageJme implements RenderImage { private Texture2D texture; private Image image; + private int width; + private int height; public RenderImageJme(String filename, boolean linear, NiftyJmeDisplay display){ TextureKey key = new TextureKey(filename, true); @@ -55,6 +57,9 @@ public class RenderImageJme implements RenderImage { texture.setMagFilter(MagFilter.Bilinear); texture.setMinFilter(MinFilter.BilinearNoMipMaps); image = texture.getImage(); + + width = image.getWidth(); + height = image.getHeight(); } public RenderImageJme(Texture2D texture){