IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37781


Ignore:
Timestamp:
Jan 3, 2015, 7:29:49 AM (12 years ago)
Author:
eugene
Message:

fix problem with round off on wide display

Location:
branches/eam_branches/ipp-20140904/Ohana/src/kapa2/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140904/Ohana/src/kapa2/src/CursorOps.c

    r37780 r37781  
    100100  // Sx, Sy are the screen coordinates of the Ix,Iy pixel
    101101  Image_to_Picture (&Sx, &Sy, Ix, Iy, picture);
     102 
     103  // Sx,Sy should be forced into the pixel
     104  int Sxi = Sx + 0.5;
     105  int Syi = Sy + 0.5;
    102106
    103107  // i_start, j_start are now limited to valid screen coordinates
    104   *i_start = MIN (MAX (Sx, 0), picture[0].dx);
    105   *j_start = MIN (MAX (Sy, 0), picture[0].dy);
     108  *i_start = MIN (MAX (Sxi, 0), picture[0].dx);
     109  *j_start = MIN (MAX (Syi, 0), picture[0].dy);
    106110}
    107111 
     
    127131  Iy = MIN (MAX (Iy, 0), matrix[0].Naxis[1]);
    128132
    129   // I_end, J_end are the last displayed image pixel
    130   // *I_end = Ix;
    131   // *J_end = Iy;
    132 
    133133  // Sx, Sy are the screen coordinates of the Ix,Iy pixel
    134134  Image_to_Picture (&Sx, &Sy, Ix, Iy, picture);
    135135
    136   double IxTest, IyTest;
    137   Picture_to_Image (&IxTest, &IyTest, Sx, Sy, picture);
    138   fprintf (stderr, "dx,dy: %d,%d : %f,%f : %f,%f : %f:%f\n", picture[0].dx, picture[0].dy, Ix, Iy, Sx, Sy, IxTest, IyTest);
     136  // Sx,Sy should be forced into the pixel
     137  int Sxi = Sx + 0.5;
     138  int Syi = Sy + 0.5;
     139
     140  // double IxTest, IyTest;
     141  // Picture_to_Image (&IxTest, &IyTest, Sx, Sy, picture);
     142  // fprintf (stderr, "dx,dy: %d,%d : %f,%f : %f,%f : %f:%f\n", picture[0].dx, picture[0].dy, Ix, Iy, Sx, Sy, IxTest, IyTest);
    139143
    140144  // i_start, j_start are now limited to valid screen coordinates
    141   *i_end = MIN (MAX (Sx, 0), picture[0].dx);
    142   *j_end = MIN (MAX (Sy, 0), picture[0].dy);
     145  // XXX: i_end, j_end *should* be the last valid screen pixel plus 1
     146  *i_end = MIN (MAX (Sxi, 0), picture[0].dx);
     147  *j_end = MIN (MAX (Syi, 0), picture[0].dy);
    143148
    144149  // round off error can leave us with a small number of extra pixels here.
  • branches/eam_branches/ipp-20140904/Ohana/src/kapa2/src/InterpretKeys.c

    r37759 r37781  
    9191# define SET_CHANNEL_CASE(NCHAN) \
    9292    case XK_F##NCHAN: \
     93      image[0].currentChannel = NCHAN-1; \
    9394      image[0].image = &image[0].channel[NCHAN-1]; \
    9495      SetColorScale (graphic, image); \
    95       Remap (graphic, image); \
    9696      Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); \
     97      Screen_to_Image (&X, &Y, (double)(event[0].x + 0.5), (double)(event[0].y + 0.5), &image[0].picture); \
     98      UpdateStatusBox (graphic, image, X, Y, 0.0, 1); \
    9799      break;
     100
     101//    Remap (graphic, image);
    98102
    99103    // the number of entries here must match the value of NCHANNELS in contants.h
  • branches/eam_branches/ipp-20140904/Ohana/src/kapa2/src/LoadPicture.c

    r37759 r37781  
    5959  // image[0].wide.expand = (wx > 1.0) ? ceil (-wx) : floor (1.0 / wx);
    6060  image[0].wide.expand = (wx > 1.0) ? floor (-wx) : ceil (1.0 / wx);
    61   fprintf (stderr, "%d : %f\n", image[0].wide.expand, wx);
     61  // fprintf (stderr, "%d : %f\n", image[0].wide.expand, wx);
    6262  // image[0].wide.expand = (wx > 1.0) ? ceil (-wx) : floor (1.0 / wx);
    6363
Note: See TracChangeset for help on using the changeset viewer.