From: <ai...@us...> - 2009-07-11 17:55:35
|
Revision: 10141 http://plplot.svn.sourceforge.net/plplot/?rev=10141&view=rev Author: airwin Date: 2009-07-11 17:55:34 +0000 (Sat, 11 Jul 2009) Log Message: ----------- Allocate cmap0 colours for plspal0 only if current set is insufficient to contain data in cmap0 palette file. This allows a cmap0 palette file to override the first colours in an existing cmap0 palette without disturbing the rest. Modified Paths: -------------- trunk/src/plctrl.c Modified: trunk/src/plctrl.c =================================================================== --- trunk/src/plctrl.c 2009-07-11 17:26:13 UTC (rev 10140) +++ trunk/src/plctrl.c 2009-07-11 17:55:34 UTC (rev 10141) @@ -1232,13 +1232,21 @@ plwarn(msgbuf); return; } - if (fscanf(fp, "%d\n", &number_colors) != 1 || number_colors < 16) { + if (fscanf(fp, "%d\n", &number_colors) != 1 || number_colors < 1) { snprintf(msgbuf,1024,"Unrecognized cmap0 header\n"); plwarn(msgbuf); fclose(fp); return; } - plscmap0n(number_colors); + + /* Allocate default number of cmap0 colours if cmap0 allocation not + done already. */ + plscmap0n(0); + /* Allocate sufficient cmap0 colours to contain present data. */ + if(number_colors > plsc->ncol0) { + plscmap0n(number_colors); + } + for(i=0;i<number_colors;i++){ fgets(color_info, 30, fp); color_info[strlen(color_info)-1] = '\0'; /* remove return character */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |