aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChien Yang <[email protected]>2007-05-23 00:32:38 +0000
committerChien Yang <[email protected]>2007-05-23 00:32:38 +0000
commitc4de3defbe0721769d56f135969311c26e97a9b0 (patch)
tree0ece628e995b59ba2a1193b5a11cffc99b81f8f3
parent8c6de265d20cd8292d1b612d2428cafc0575c471 (diff)
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
-rw-r--r--src/classes/share/javax/media/j3d/ImageComponent2D.java15
1 files changed, 8 insertions, 7 deletions
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);
}