summaryrefslogtreecommitdiff
path: root/math
diff options
context:
space:
mode:
authorBill Fenner <fenner@FreeBSD.org>1998-08-01 07:36:52 +0000
committerBill Fenner <fenner@FreeBSD.org>1998-08-01 07:36:52 +0000
commit72f75f465e68e75188fbf0502b8d33f26471ad2a (patch)
treec1f89cd93a2bfe2c0c8bfcfb0ea4c59f00ef0454 /math
parentupgraded the original distribution: (diff)
Make color plotting work.
Prompted by: Chris Timmons <skynyrd@opus.cts.cwu.edu>
Notes
Notes: svn path=/head/; revision=12241
Diffstat (limited to 'math')
-rw-r--r--math/xplot/files/patch-aa11
-rw-r--r--math/xplot/files/patch-ab84
2 files changed, 84 insertions, 11 deletions
diff --git a/math/xplot/files/patch-aa b/math/xplot/files/patch-aa
index b816568c25b3..4e324d47a478 100644
--- a/math/xplot/files/patch-aa
+++ b/math/xplot/files/patch-aa
@@ -53,14 +53,3 @@
#include "xplot.h"
#include "coord.h"
#include <stdio.h>
---- xplot.c.orig Wed Jan 22 09:38:48 1997
-+++ xplot.c Mon Mar 3 11:41:31 1997
-@@ -46,7 +46,7 @@
- #include <X11/cursorfont.h>
- #include <math.h>
- #include <ctype.h>
--#include <malloc.h>
-+#include <stdlib.h>
- #include "xplot.h"
- #include "coord.h"
-
diff --git a/math/xplot/files/patch-ab b/math/xplot/files/patch-ab
new file mode 100644
index 000000000000..8c35f0da230a
--- /dev/null
+++ b/math/xplot/files/patch-ab
@@ -0,0 +1,84 @@
+--- xplot.c.orig Wed Jul 2 13:26:09 1997
++++ xplot.c Sat Aug 1 00:12:42 1998
+@@ -46,7 +46,7 @@
+ #include <X11/cursorfont.h>
+ #include <math.h>
+ #include <ctype.h>
+-#include <malloc.h>
++#include <stdlib.h>
+ #include "xplot.h"
+ #include "coord.h"
+
+@@ -813,9 +813,7 @@
+ static struct dpy_info {
+ unsigned long line_plane_mask;
+ Colormap clr_map;
+- XColor clr;
+- unsigned long pixel[NCOLORS];
+- int Colors[NCOLORS];
++ unsigned long Colors[NCOLORS];
+ int virgin;
+ Atom xplot_nagle_atom;
+ Display *saved_dpy;
+@@ -842,38 +840,37 @@
+ /* Allocate some color cells */
+
+ if (d_i[d].virgin ) {
++ int usewhite;
++
+ d_i[d].virgin = 0;
+
+ d_i[d].xplot_nagle_atom = XInternAtom(pl->dpy, "XPLOT_NAGLE", False);
+
+ d_i[d].clr_map = DefaultColormap(pl->dpy, DefaultScreen(pl->dpy));
+
+- if ( option_mono ||
+-
+- ! XAllocColorCells(pl->dpy,
+- d_i[d].clr_map, 0,
+- &d_i[d].line_plane_mask, 1,
+- d_i[d].pixel, NColors) )
+- {
+- /* probably only one bit plane, or all the color cells are taken */
+-#if 1
+- if (! option_mono)
+- fputs("XAllocColorCells failed, will only have one plot color\n",
+- stderr);
+-#endif
+- for ( i = 0; i < NColors; i++) {
+- d_i[d].Colors[i] = WhitePixelOfScreen(pl->screen);
+- }
+- } else {
+- for (i = 0; i < NColors; i++) {
+- XParseColor(pl->dpy, d_i[d].clr_map, ColorNames[i], &d_i[d].clr);
+- d_i[d].clr.pixel = d_i[d].pixel[i];
+- XStoreColor (pl->dpy, d_i[d].clr_map, &d_i[d].clr);
+- d_i[d].clr.pixel |= d_i[d].line_plane_mask;
+- XStoreColor (pl->dpy, d_i[d].clr_map, &d_i[d].clr);
+- d_i[d].Colors[i] = d_i[d].clr.pixel;
++ if ( option_mono ) {
++ usewhite = 1;
++ } else {
++ usewhite = 0;
++
++ for (i = 0; i < NColors; i++) {
++ XColor alloc, exact;
++
++ if (XAllocNamedColor(pl->dpy, d_i[d].clr_map, ColorNames[i],
++ &alloc, &exact) == 0) {
++ XFreeColors(pl->dpy, d_i[d].clr_map, d_i[d].Colors, i, NULL);
++ usewhite = 1;
++ fprintf(stderr, "unable to allocate color \"%s\", falling back to only one plot color\n", ColorNames[i]);
++ break;
+ }
++ d_i[d].Colors[i] = alloc.pixel;
++ }
++ }
++ if ( usewhite ) {
++ for ( i = 0; i < NColors; i++) {
++ d_i[d].Colors[i] = WhitePixelOfScreen(pl->screen);
+ }
++ }
+ }
+
+ for (i = 0; i < NColors; i++) {