]> git.sesse.net Git - qscale/blobdiff - libqscale.c
Fix a clone bug.
[qscale] / libqscale.c
index c26a4418e91746bf337d7552cd6dc9fc513ce4b6..dc040282001c74dd2fcdd644392d35a786902355 100644 (file)
@@ -500,11 +500,11 @@ qscale_img *qscale_clone(const qscale_img *img)
        }
        {
                dst->data_cb = (unsigned char *)malloc(dst->h1 * dstride1);
-               memcpy(dst->data_cb, img->data_cb, dst->h0 * dstride0);
+               memcpy(dst->data_cb, img->data_cb, dst->h1 * dstride1);
        }
        {
-               dst->data_cr = (unsigned char *)malloc(dst->h1 * dstride1);
-               memcpy(dst->data_cr, img->data_cr, dst->h0 * dstride0);
+               dst->data_cr = (unsigned char *)malloc(dst->h2 * dstride2);
+               memcpy(dst->data_cr, img->data_cr, dst->h2 * dstride2);
        }
 
        return dst;
@@ -608,6 +608,11 @@ int qscale_save_jpeg_to_stdio(const qscale_img *img, FILE *file, unsigned jpeg_q
         cinfo.input_components = 3;
         jpeg_set_defaults(&cinfo);
         jpeg_set_quality(&cinfo, jpeg_quality, FALSE);
+
+       if (jpeg_mode == PROGRESSIVE) {
+               jpeg_simple_progression(&cinfo);
+       }
+
         cinfo.image_width = img->width;
         cinfo.image_height = img->height;
         cinfo.raw_data_in = TRUE;