]> granicus.if.org Git - libjpeg-turbo/commitdiff
tjTransform() was not working properly if r.w=0 or r.h=0
authorDRC <dcommander@users.sourceforge.net>
Tue, 15 Mar 2011 20:09:47 +0000 (20:09 +0000)
committerDRC <dcommander@users.sourceforge.net>
Tue, 15 Mar 2011 20:09:47 +0000 (20:09 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@517 632fc199-4ca6-4c93-a231-07263d6284db

turbojpeg.h
turbojpegl.c

index b6a9d91c6422bc98807a3af31f8580b5ce6bbf43..e0752779c3bd08d42db84fe0385d5698baa335b9 100644 (file)
@@ -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
index 2a35e2ff5d92c5858be548594809a48d3a738b36..266e335df9f5d586dc2594a5a3b57266e5384905 100644 (file)
@@ -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;
                }
        }