aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordcommander <dcommander@632fc199-4ca6-4c93-a231-07263d6284db>2011-03-15 20:09:47 +0000
committerdcommander <dcommander@632fc199-4ca6-4c93-a231-07263d6284db>2011-03-15 20:09:47 +0000
commit388f8743feebc0bf84695e9c468de39d1c795f40 (patch)
tree42d8ed70a6bc5fe3a4c4eb6ae9967b0a9e3ebbf9
parent18fed120105965628a186de16f41f12452f2f7cd (diff)
tjTransform() was not working properly if r.w=0 or r.h=0
git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@517 632fc199-4ca6-4c93-a231-07263d6284db
-rw-r--r--turbojpeg.h4
-rw-r--r--turbojpegl.c3
2 files changed, 5 insertions, 2 deletions
diff --git a/turbojpeg.h b/turbojpeg.h
index b6a9d91..e075277 100644
--- a/turbojpeg.h
+++ b/turbojpeg.h
@@ -475,9 +475,9 @@ DLLEXPORT tjhandle DLLCALL tjInitTransform(void);
divisible by tjmcuh[subsamp] (the MCU block height corresponding to the
level of chrominance subsampling used in the source image)
r.w = the width of the cropping region. Setting this to 0 is the
- equivalent of setting it to the width of the source JPEG image.
+ equivalent of setting it to the width of the source JPEG image - r.x.
r.h = the height of the cropping region. Setting this to 0 is the
- equivalent of setting it to the height of the source JPEG image.
+ equivalent of setting it to the height of the source JPEG image - r.y.
op = one of the transform operations described in the
"Transform operations" section above
options = the bitwise OR of one or more of the transform options described
diff --git a/turbojpegl.c b/turbojpegl.c
index 2a35e2f..266e335 100644
--- a/turbojpegl.c
+++ b/turbojpegl.c
@@ -743,6 +743,7 @@ DLLEXPORT int DLLCALL tjTransform(tjhandle hnd,
if((xinfo=(jpeg_transform_info *)malloc(sizeof(jpeg_transform_info)*n))
==NULL)
_throw("Memory allocation failed in tjTransform()");
+ memset(xinfo, 0, sizeof(jpeg_transform_info)*n);
for(i=0; i<n; i++)
{
@@ -762,10 +763,12 @@ DLLEXPORT int DLLCALL tjTransform(tjhandle hnd,
{
xinfo[i].crop_width=t[i].r.w; xinfo[i].crop_width_set=JCROP_POS;
}
+ else xinfo[i].crop_width=JCROP_UNSET;
if(t[i].r.h!=0)
{
xinfo[i].crop_height=t[i].r.h; xinfo[i].crop_height_set=JCROP_POS;
}
+ else xinfo[i].crop_height=JCROP_UNSET;
}
}