From: DRC Date: Sat, 27 Apr 2013 22:48:08 +0000 (+0000) Subject: Fix backward compatibility between the Java classes and the 1.2.x JNI library (as... X-Git-Tag: 1.3.0~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bb9e14787236cc283415fb052a532c6869fcf739;p=libjpeg-turbo Fix backward compatibility between the Java classes and the 1.2.x JNI library (as long as the 1.3 Java features are not used.) git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.3.x@973 632fc199-4ca6-4c93-a231-07263d6284db --- diff --git a/java/org/libjpegturbo/turbojpeg/TJDecompressor.java b/java/org/libjpegturbo/turbojpeg/TJDecompressor.java index da51a43..c2d361e 100644 --- a/java/org/libjpegturbo/turbojpeg/TJDecompressor.java +++ b/java/org/libjpegturbo/turbojpeg/TJDecompressor.java @@ -301,8 +301,12 @@ public class TJDecompressor { desiredHeight < 0 || pixelFormat < 0 || pixelFormat >= TJ.NUMPF || flags < 0) throw new Exception("Invalid argument in decompress()"); - decompress(jpegBuf, jpegBufSize, dstBuf, x, y, desiredWidth, pitch, - desiredHeight, pixelFormat, flags); + if (x > 0 || y > 0) + decompress(jpegBuf, jpegBufSize, dstBuf, x, y, desiredWidth, pitch, + desiredHeight, pixelFormat, flags); + else + decompress(jpegBuf, jpegBufSize, dstBuf, desiredWidth, pitch, + desiredHeight, pixelFormat, flags); } /**