From 3affeff848b53cd558ea0c474f514acf427d78c3 Mon Sep 17 00:00:00 2001 From: rlar Date: Thu, 4 Nov 2010 19:32:53 +0000 Subject: [PATCH] move device dependent colors[] array from `graph' to the x11 specific struct --- ChangeLog | 5 +++++ src/frontend/plotting/x11.c | 27 ++++++++++++++------------- src/include/graph.h | 3 --- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 53031bfa8..d093c8e26 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-11-04 Robert Larice + * src/frontend/plotting/x11.c , + * src/include/graph.h : + move device dependent colors[] array from `graph' to the x11 specific struct + 2010-11-04 Robert Larice * src/frontend/com_compose.c , * src/frontend/postcoms.c , diff --git a/src/frontend/plotting/x11.c b/src/frontend/plotting/x11.c index eabd71225..bad12008d 100644 --- a/src/frontend/plotting/x11.c +++ b/src/frontend/plotting/x11.c @@ -64,6 +64,7 @@ typedef struct x11info { GC gc; int lastx, lasty; /* used in X_DrawLine */ int lastlinestyle; /* used in X_DrawLine */ + Pixel colors[NUMCOLORS]; } X11devdep; #define DEVDEP(g) (*((X11devdep *) (g)->devdep)) @@ -211,11 +212,11 @@ initcolors(GRAPH *graph) if (numdispplanes == 1) { /* black and white */ xmaxcolors = 2; - graph->colors[0] = DEVDEP(graph).view->core.background_pixel; - if (graph->colors[0] == WhitePixel(display, DefaultScreen(display))) - graph->colors[1] = BlackPixel(display, DefaultScreen(display)); + DEVDEP(graph).colors[0] = DEVDEP(graph).view->core.background_pixel; + if (DEVDEP(graph).colors[0] == WhitePixel(display, DefaultScreen(display))) + DEVDEP(graph).colors[1] = BlackPixel(display, DefaultScreen(display)); else - graph->colors[1] = WhitePixel(display, DefaultScreen(display)); + DEVDEP(graph).colors[1] = WhitePixel(display, DefaultScreen(display)); } else { if (numdispplanes < NXPLANES) @@ -231,31 +232,31 @@ initcolors(GRAPH *graph) (void) sprintf(ErrorMessage, "can't get color %s\n", colorstring); externalerror(ErrorMessage); - graph->colors[i] = i ? BlackPixel(display, + DEVDEP(graph).colors[i] = i ? BlackPixel(display, DefaultScreen(display)) : WhitePixel(display, DefaultScreen(display)); continue; } - graph->colors[i] = visualcolor.pixel; + DEVDEP(graph).colors[i] = visualcolor.pixel; /* MW. I don't need this, everyone must know what he is doing if (i > 0 && - graph->colors[i] == DEVDEP(graph).view->core.background_pixel) { - graph->colors[i] = graph->colors[0]; + DEVDEP(graph).colors[i] == DEVDEP(graph).view->core.background_pixel) { + DEVDEP(graph).colors[i] = DEVDEP(graph).colors[0]; } */ } /* MW. Set Beackgroound here */ - XSetWindowBackground(display, DEVDEP(graph).window, graph->colors[0]); + XSetWindowBackground(display, DEVDEP(graph).window, DEVDEP(graph).colors[0]); -/* if (graph->colors[0] != DEVDEP(graph).view->core.background_pixel) { - graph->colors[0] = DEVDEP(graph).view->core.background_pixel; +/* if (DEVDEP(graph).colors[0] != DEVDEP(graph).view->core.background_pixel) { + DEVDEP(graph).colors[0] = DEVDEP(graph).view->core.background_pixel; } */ } for (i = xmaxcolors; i < NUMCOLORS; i++) { - graph->colors[i] = graph->colors[i + 1 - xmaxcolors]; + DEVDEP(graph).colors[i] = DEVDEP(graph).colors[i + 1 - xmaxcolors]; } } @@ -591,7 +592,7 @@ X11_SetColor(int colorid) currentgraph->currentcolor = colorid; XSetForeground(display, DEVDEP(currentgraph).gc, - currentgraph->colors[colorid]); + DEVDEP(currentgraph).colors[colorid]); return 0; } diff --git a/src/include/graph.h b/src/include/graph.h index 09fd01512..311eb3449 100644 --- a/src/include/graph.h +++ b/src/include/graph.h @@ -57,9 +57,6 @@ struct graph { double width, height; } datawindow; - /* note: this int is device dependent */ - int colors[NUMCOLORS]; - /* cache (datawindow size) / (viewport size) */ double aspectratiox, aspectratioy;