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

Comparing ray/src/rt/x11.c (file contents):
Revision 2.3 by greg, Fri May 29 15:42:49 1992 UTC vs.
Revision 2.7 by greg, Thu Jun 25 13:32:47 1992 UTC

# Line 1 | Line 1
1 + /* Copyright (c) 1992 Regents of the University of California */
2 +
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
5   #endif
6  
5 /* Copyright (c) 1989 Regents of the University of California */
6
7   /*
8 < *  x11.c - driver for X-windows version 11.3
8 > *  x11.c - driver for X-windows version 11
9   *
10   *     Jan 1990
11   */
# Line 23 | Line 23 | static char SCCSid[] = "$SunId$ LBL";
23   #include  "x11twind.h"
24   #include  "x11icon.h"
25  
26 < #define GAMMA           2.2             /* exponent for color correction */
26 > #define GAMMA           2.2             /* default exponent correction */
27  
28   #define MINWIDTH        (32*COMCW)      /* minimum graphics window width */
29   #define MINHEIGHT       MINWIDTH        /* minimum graphics window height */
# Line 82 | Line 82 | struct driver *
82   x11_init(name, id)              /* initialize driver */
83   char  *name, *id;
84   {
85 +        extern char  *getenv();
86 +        char  *gv;
87          int  nplanes;
88          XSetWindowAttributes    ourwinattr;
89          XWMHints  ourxwmhints;
# Line 94 | Line 96 | char  *name, *id;
96          }
97                                          /* find a usable visual */
98          nplanes = DisplayPlanes(ourdisplay, ourscreen);
99 <        if (    !XMatchVisualInfo(ourdisplay,ourscreen,
100 <                        24,TrueColor,&ourvinfo) &&
101 <                !XMatchVisualInfo(ourdisplay,ourscreen,
102 <                        24,DirectColor,&ourvinfo)       ) {
99 >        if (XMatchVisualInfo(ourdisplay,ourscreen,
100 >                                24,TrueColor,&ourvinfo) ||
101 >                        XMatchVisualInfo(ourdisplay,ourscreen,
102 >                                24,DirectColor,&ourvinfo)) {
103 >                ourblack = 0;
104 >                ourwhite = ourvinfo.red_mask |
105 >                                ourvinfo.green_mask |
106 >                                ourvinfo.blue_mask ;
107 >        } else {
108                  if (nplanes < 4) {
109                          stderr_v("not enough colors\n");
110                          return(NULL);
111 <                } else if (!XMatchVisualInfo(ourdisplay,ourscreen,
111 >                }
112 >                if (!XMatchVisualInfo(ourdisplay,ourscreen,
113                                          nplanes,PseudoColor,&ourvinfo) &&
114                                  !XMatchVisualInfo(ourdisplay,ourscreen,
115                                          nplanes,GrayScale,&ourvinfo)) {
# Line 110 | Line 118 | char  *name, *id;
118                  }
119                  ourblack = BlackPixel(ourdisplay,ourscreen);
120                  ourwhite = WhitePixel(ourdisplay,ourscreen);
113        } else {
114                ourblack = 0;
115                ourwhite = ~0;
121          }
122 <        make_gmap(GAMMA);
123 <        /* open window */
122 >                                        /* set gamma */
123 >        if ((gv = getenv("GAMMA")) != NULL)
124 >                make_gmap(atof(gv));
125 >        else
126 >                make_gmap(GAMMA);
127 >                                        /* open window */
128          ourwinattr.background_pixel = ourblack;
129          ourwinattr.border_pixel = ourblack;
130 <                                        /* this is a waste! */
130 >                                        /* this is stupid */
131          ourwinattr.colormap = XCreateColormap(ourdisplay, ourroot,
132                                  ourvinfo.visual, AllocNone);
133          gwind = XCreateWindow(ourdisplay, ourroot, 0, 0,
# Line 130 | Line 139 | char  *name, *id;
139                  stderr_v("cannot create window\n");
140                  return(NULL);
141          }
142 <        XStoreName(ourdisplay, gwind, id);
142 >        XStoreName(ourdisplay, gwind, id);
143          /* create a cursor */
144          pickcursor = XCreateFontCursor(ourdisplay, XC_diamond_cross);
145          ourgc = XCreateGC(ourdisplay, gwind, 0, NULL);
# Line 398 | Line 407 | freepixels()                           /* free our pixels */
407          if (ncolors == 0)
408                  return;
409          XFreeColors(ourdisplay,ourmap,pixval,ncolors,0L);
410 +        free((char *)pixval);
411 +        pixval = NULL;
412          ncolors = 0;
413          if (ourmap != DefaultColormap(ourdisplay,ourscreen))
414                  XFreeColormap(ourdisplay, ourmap);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines