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

Comparing ray/src/px/vgaimage.c (file contents):
Revision 2.4 by greg, Mon Nov 2 16:01:17 1992 UTC vs.
Revision 2.5 by greg, Wed Nov 11 17:34:14 1992 UTC

# Line 186 | Line 186 | init()                 /* initialize and load display */
186          ms_init();
187          initialized = 1;
188          _getvideoconfig(&config);
189 <        if (maxcolors == 0)
190 <                maxcolors = config.numcolors;
191 <        if (maxcolors > 4) {
192 <                maxcolors -= minpix = 2;
193 <                _settextcolor(ourwhite);
194 <        }
189 >        if (maxcolors == 0 | maxcolors > config.numcolors)
190 >                maxcolors = config.numcolors-2;
191 >        if (maxcolors <= config.numcolors-2)
192 >                minpix = 2;
193 >        else
194 >                ourwhite = maxcolors-1;
195 >        _settextcolor(ourwhite);
196          cheight = config.numypixels/config.numtextrows;
197          cwidth = config.numxpixels/config.numtextcols;
198                                  /* clear scan position array */
# Line 375 | Line 376 | setpalette()                   /* set our palette using clrtab */
376          long    cvals[256];
377          register int    i;
378  
379 <        if (minpix >= 2) {
380 <                cvals[ourblack] = _BLACK; cvals[ourwhite] = _BRIGHTWHITE;
380 <        }
379 >        cvals[ourblack] = _BLACK;
380 >        cvals[ourwhite] = _BRIGHTWHITE;
381          for (i = 0; i < maxcolors; i++)
382                  cvals[i+minpix] = clrtab[i][BLU]<<14 & 0x3f0000L |
383                                    clrtab[i][GRN]<<6 & 0x3f00 |
# Line 395 | Line 395 | greyimage()                    /* display greyscale image */
395          setcolrgam(gamcor);
396                                          /* set up color map */
397          for (x = 0; x < maxcolors; x++)
398 <                clrtab[x][RED] = clrtab[x][GRN] =
399 <                        clrtab[x][BLU] = ((long)x*256+maxcolors/2)/maxcolors;
398 >                clrtab[x][RED] = clrtab[x][GRN] = clrtab[x][BLU] =
399 >                                ((long)x*256 + 128)/maxcolors;
400          setpalette();
401          _setplotaction(_GPSET);
402                                          /* read and display file */
# Line 404 | Line 404 | greyimage()                    /* display greyscale image */
404                  getscan(y);
405                  if (scale)
406                          shiftcolrs(scanline, xmax, scale);
407 +                for (x = 0; x < xmax; x++)
408 +                        scanline[x][GRN] = normbright(scanline[x]);
409                  colrs_gambs(scanline, xmax);
410                  if (maxcolors < 256)
411                          for (x = 0; x < xmax; x++) {
412 <                                thiscolor = ((long)normbright(scanline[x]) *
413 <                                        maxcolors + 128) >> 8;
412 >                                thiscolor = ((long)scanline[x][GRN] *
413 >                                                maxcolors + maxcolors/2) / 256;
414                                  if (thiscolor != lastcolor)
415                                          _setcolor((lastcolor=thiscolor)+minpix);
416                                  _setpixel(x, y);
417                          }
418                  else
419                          for (x = 0; x < xmax; x++) {
420 <                                thiscolor = normbright(scanline[x]);
420 >                                thiscolor = scanline[x][GRN];
421                                  if (thiscolor != lastcolor)
422                                          _setcolor((lastcolor=thiscolor)+minpix);
423                                  _setpixel(x, y);
# Line 476 | Line 478 | int  y;
478                  if (fseek(fin, scanpos[y], 0) == -1)
479                          quiterr("fseek error");
480                  cury = y;
481 <        } else if (scanpos != NULL && scanpos[y] == -1)
481 >        } else if (fin != stdin && scanpos[y] == -1)
482                  scanpos[y] = ftell(fin);
483  
484          if (freadcolrs(scanline, xmax, fin) < 0)
# Line 597 | Line 599 | ms_done()
599      inregs.w.ax = 0;
600      int386 (0x33, &inregs, &outregs);
601   }
600

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines