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

Comparing ray/src/px/x11raster.c (file contents):
Revision 2.8 by greg, Mon Jul 19 15:18:10 1993 UTC vs.
Revision 2.9 by greg, Wed Nov 23 14:24:32 1994 UTC

# Line 99 | Line 99 | BYTE   cmap[][3];
99  
100  
101   Colormap
102 < newcmap(disp, scrn, w, vis)             /* get colormap and fix b & w */
102 > newcmap(disp, scrn, vis)                /* get colormap and fix b & w */
103   Display *disp;
104   int     scrn;
105 Window  w;
105   Visual  *vis;
106   {
107          XColor  thiscolor;
# Line 111 | Line 110 | Visual *vis;
110          int     n;
111          register int    i, j;
112  
113 <        cmap = XCreateColormap(disp, w, vis, AllocNone);
114 <        if (cmap == 0)
115 <                return(0);
113 >        cmap = XCreateColormap(disp, RootWindow(disp,scrn), vis, AllocNone);
114 >        if (cmap == 0 || vis->class != PseudoColor)
115 >                return(cmap);
116          pixels=(unsigned long *)malloc(vis->map_entries*sizeof(unsigned long));
117          if (pixels == NULL)
118                  return(0);
# Line 143 | Line 142 | Visual *vis;
142  
143  
144   unsigned long *
145 < map_rcolors(xr, w)                              /* get and assign pixels */
145 > map_rcolors(xr, w)                      /* get and assign pixels */
146   register XRASTER        *xr;
147   Window  w;
148   {
# Line 160 | Line 159 | Window w;
159          if (xr->visual == DefaultVisual(xr->disp, xr->screen))
160                  xr->cmap = DefaultColormap(xr->disp, xr->screen);
161          else
162 <                xr->cmap = newcmap(xr->disp, xr->screen, w, xr->visual);
162 >                xr->cmap = newcmap(xr->disp, xr->screen, xr->visual);
163          while (XAllocColorCells(xr->disp, xr->cmap, 0,
164                          NULL, 0, xr->pixels, xr->ncolors) == 0)
165                  if (xr->cmap == DefaultColormap(xr->disp, xr->screen))
166 <                        xr->cmap = newcmap(xr->disp, xr->screen, w, xr->visual);
166 >                        xr->cmap = newcmap(xr->disp, xr->screen, xr->visual);
167                  else {
168                          free((char *)xr->pixels);
169                          xr->pixels = NULL;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines