From c4de3defbe0721769d56f135969311c26e97a9b0 Mon Sep 17 00:00:00 2001 From: Chien Yang Date: Wed, 23 May 2007 00:32:38 +0000 Subject: Fixed to issue 492 : ImageComponent2D.setSubImage throws IllegalArgumentException when it should not git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@844 ba19aa83-45c5-6ac9-afd3-db810772062c --- src/classes/share/javax/media/j3d/ImageComponent2D.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/classes/share/javax/media/j3d/ImageComponent2D.java b/src/classes/share/javax/media/j3d/ImageComponent2D.java index a69bf46..998e7d3 100644 --- a/src/classes/share/javax/media/j3d/ImageComponent2D.java +++ b/src/classes/share/javax/media/j3d/ImageComponent2D.java @@ -546,14 +546,15 @@ public class ImageComponent2D extends ImageComponent { int w = ((ImageComponent2DRetained)this.retained).getWidth(); int h = ((ImageComponent2DRetained)this.retained).getHeight(); - if ((srcX < 0) || (srcY < 0) || - ((srcX + width) > w) || ((srcY + height) > h) || - (dstX < 0) || (dstY < 0) || - ((dstX + width) > w) || ((dstY + height) > h)) { + // Fix to issue 492 + if ((srcX < 0) || (srcY < 0) || + ((srcX + width) > image.getWidth()) || ((srcY + height) > image.getHeight()) || + (dstX < 0) || (dstY < 0) || + ((dstX + width) > w) || ((dstY + height) > h)) { throw new IllegalArgumentException( - J3dI18N.getString("ImageComponent2D3")); - } - + J3dI18N.getString("ImageComponent2D3")); + } + ((ImageComponent2DRetained)this.retained).setSubImage( image, width, height, srcX, srcY, dstX, dstY); } -- cgit v1.2.3