ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/x11image.c
(Generate patch)

Comparing ray/src/px/x11image.c (file contents):
Revision 1.18 by greg, Fri May 3 09:49:02 1991 UTC vs.
Revision 1.21 by greg, Fri May 3 12:01:44 1991 UTC

# Line 81 | Line 81 | double  exposure = 1.0;                        /* exposure compensation use
81  
82   int  wrongformat = 0;                   /* input in another format? */
83  
84 + int  imready = 0;                       /* is image up? */
85 +
86   GC      revgc;                          /* graphics context with GXinvert */
87  
88   XRASTER *ourras;                        /* our stored image */
# Line 246 | Line 248 | init()                 /* get data and open window */
248          XSetFont(thedisplay, ourgc, fontid);
249          revgc = XCreateGC(thedisplay, wind, 0, 0);
250          XSetFunction(thedisplay, revgc, GXinvert);
249        XStoreName(thedisplay, wind, fname == NULL ? progname : fname);
251          XDefineCursor(thedisplay, wind, XCreateFontCursor(thedisplay,
252                          XC_diamond_cross));
253          if (geometry != NULL) {
# Line 281 | Line 282 | init()                 /* get data and open window */
282                          |ButtonMotionMask|StructureNotifyMask
283                          |KeyPressMask|ExposureMask);
284          XMapWindow(thedisplay, wind);
285 +                                /* make sure the image is up */
286 +        do
287 +                getevent();
288 +        while (!imready);
289 +                                /* store name as ready signal */
290 +        XStoreName(thedisplay, wind, fname == NULL ? progname : fname);
291          return;
292   memerr:
293          quiterr("out of memory");
# Line 387 | Line 394 | getevent()                             /* process the next event */
394                  break;
395          case Expose:
396                  redraw(e.e.x, e.e.y, e.e.width, e.e.height);
397 +                imready++;
398                  break;
399          case ButtonPress:
400                  if (e.b.state & (ShiftMask|ControlMask))
# Line 652 | Line 660 | add2icon(y, scan)              /* add a scanline to our icon data
660   int  y;
661   COLR  *scan;
662   {
655        static char  *dp = NULL;
663          static short  cerr[ICONSIZ];
664 +        static int  ynext;
665 +        static char  *dp;
666          register int  err;
667 <        register int    x, xi;
667 >        register int    x, ti;
668  
669          if (iconheight == 0) {          /* initialize */
670                  if (xmax <= ICONSIZ && ymax <= ICONSIZ) {
# Line 668 | Line 677 | COLR  *scan;
677                          iconwidth = ICONSIZ*xmax/ymax;
678                          iconheight = ICONSIZ;
679                  }
680 +                ynext = 0;
681                  dp = icondata - 1;
682          }
683 <        if (dp == NULL)                 /* done already */
683 >        if (y < ynext*ymax/iconheight)  /* skip this one */
684                  return;
675        if (y % (ymax/iconheight))      /* skip this one */
676                return;
685          err = 0;
686          for (x = 0; x < iconwidth; x++) {
687                  if (!(x&7))
688                          *++dp = 0;
689 <                xi = x*xmax/iconwidth;
690 <                err += normbright(scan[xi]) + cerr[x];
689 >                ti = x*xmax/iconwidth;
690 >                err += normbright(scan[ti]) + cerr[x];
691                  if (err > 127)
692                          err -= 255;
693                  else
694                          *dp |= 1<<(x&07);
695                  cerr[x] = err >>= 1;
696          }
697 <        if (y >= ymax - ymax/iconheight)        /* all done */
690 <                dp = NULL;
697 >        ynext++;
698   }
699  
700  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines