|
From: Daniel J S. <dan...@ie...> - 2005-11-16 10:27:49
|
Petr Mikulik wrote: > This is an old bug (August 2004, see below). What do you think nowadays > about fixing it? Petr, Attached is a freshened version of the patch for the bug fix. Give it a try and if you think it solves the problem please consider moving into CVS. As a reminder to others, we had a big discussion about this bug. (Go back to about Sep 9, 2004.) In addition to the initial problem Petr found, I think this patch also has a bug fix for what I thought was a memory leak. It also rid that difficult to decipher code with "recursive" in it. In summary, it is a linked list of color maps separate from the linked list for X11 plots. (Hey, I like linked lists; what can I say?) Basically, whenever a new palette (i.e., different than any other already in the list) comes over the link it is placed in the list. Whenever a figure is destroyed and the associated palette is not used by a different plot, that palette is discarded from the list. Dan > *** > > There is a bug in the color palette treatment in the X11 terminal: when > using multiple X11 terminals, window redraw (requested e.g. by a window > manager) will change its palette. > > Try this script: > > > set pm3d map > > set term x11 10 > set title '10 gray levels' > set palette gray > set palette maxcolors 10 > splot x*x > > set term x11 2 > set title '2 colors' > set palette color > set palette maxcolors 2 > splot x > > > Now, maximize or resize window #10 by mouse => it will change from gray map > with 10 gray levels to color map with 2 colors. > > > > >>> Yes, every x11 windows should have its own copy of the palette. When >>> there >>> is a new (re)plot, x11 should copy the current gnuplot palette into >>> palette >>> of the active window, and use that. >> >> >> I don't like hacking stuff, and this may take some consideration. I'm >> wondering how this should be structured, and whether we should be >> conservative with palette usage in order to not consume too much >> memory. Are palettes memory consumers? If so, it might be wise to not >> save a color map with every plot. That is, say there is a fairly >> large palette, and then someone creates twenty plots. If all those >> plots have a similar palette, it may be an inefficient use of memory. >> >> Rather, it might be wise to have a linked-list of palettes. Whenever >> a new palette is created, it is put in the linked list. Then, when a >> palette is changed at the gnuplot command line, gplt_x11.c will search >> through the plot list and see if any of the plots is using the old >> palette. If not, that color map can be discarded from the list. >> >> It sounds unnecessarily tedious, but it really does seem like the >> thing to do, and it actually might simplify the various uses of >> XAllocColor and XFreeColors. > > > > ------------------------------------------------------- > SF.Net email is sponsored by: > Tame your development challenges with Apache's Geronimo App Server. > Download > it for free - -and be entered to win a 42" plasma tv or your very own > Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php > _______________________________________________ > gnuplot-beta mailing list > gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-beta > -- Dan Sebald phone: 608 256 7718 email: daniel DOT sebald AT ieee DOT org URL: http://webpages DOT charter DOT net/dsebald/ |