Revision: 65271
          http://sourceforge.net/p/brlcad/code/65271
Author:   carlmoore
Date:     2015-06-11 18:22:09 +0000 (Thu, 11 Jun 2015)
Log Message:
-----------
fix bug regarding Y

Modified Paths:
--------------
    brlcad/trunk/src/libicv/crop.c

Modified: brlcad/trunk/src/libicv/crop.c
===================================================================
--- brlcad/trunk/src/libicv/crop.c      2015-06-11 17:55:53 UTC (rev 65270)
+++ brlcad/trunk/src/libicv/crop.c      2015-06-11 18:22:09 UTC (rev 65271)
@@ -34,10 +34,11 @@
     size_t row;
     double *p, *in_data, *out_data;
     size_t widthstep_in, widthstep_out, bytes_row; /**<  */
-    int errorflag = 0;
+    int errorflag;
 
     ICV_IMAGE_VAL_INT(img);
 
+    errorflag=0;
     if (xnum < 1) {
        fprintf(stderr,"icv_rect : ERROR: Horizontal Cut Size\n");
        errorflag=1;
@@ -48,6 +49,7 @@
     }
     if (errorflag) bu_exit(1,NULL);
 
+    errorflag=0;
     if (xorig+xnum > img->width) {
        fprintf(stderr,"icv_rect : Cut not possible; input parameters exceed 
the width.\n");
        errorflag=1;
@@ -67,9 +69,10 @@
     /* Hopes to the initial point to be extracted on the first line */
     in_data = img->data + xorig*img->channels;
 
-    for (row = yorig; row < yorig+ynum ;row++) {
-           VMOVEN(p,in_data,widthstep_out);
-           in_data     += widthstep_in;
+    for (row = 0; row < yorig+ynum ;row++) {
+       VMOVEN(p,in_data,widthstep_out);
+       in_data += widthstep_in;
+       if (row >= yorig)
            p += widthstep_out;
     }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to