move device dependent colors[] array from `graph' to the x11 specific struct
This commit is contained in:
parent
411c6fc8c3
commit
3affeff848
|
|
@ -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
|
2010-11-04 Robert Larice
|
||||||
* src/frontend/com_compose.c ,
|
* src/frontend/com_compose.c ,
|
||||||
* src/frontend/postcoms.c ,
|
* src/frontend/postcoms.c ,
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ typedef struct x11info {
|
||||||
GC gc;
|
GC gc;
|
||||||
int lastx, lasty; /* used in X_DrawLine */
|
int lastx, lasty; /* used in X_DrawLine */
|
||||||
int lastlinestyle; /* used in X_DrawLine */
|
int lastlinestyle; /* used in X_DrawLine */
|
||||||
|
Pixel colors[NUMCOLORS];
|
||||||
} X11devdep;
|
} X11devdep;
|
||||||
|
|
||||||
#define DEVDEP(g) (*((X11devdep *) (g)->devdep))
|
#define DEVDEP(g) (*((X11devdep *) (g)->devdep))
|
||||||
|
|
@ -211,11 +212,11 @@ initcolors(GRAPH *graph)
|
||||||
if (numdispplanes == 1) {
|
if (numdispplanes == 1) {
|
||||||
/* black and white */
|
/* black and white */
|
||||||
xmaxcolors = 2;
|
xmaxcolors = 2;
|
||||||
graph->colors[0] = DEVDEP(graph).view->core.background_pixel;
|
DEVDEP(graph).colors[0] = DEVDEP(graph).view->core.background_pixel;
|
||||||
if (graph->colors[0] == WhitePixel(display, DefaultScreen(display)))
|
if (DEVDEP(graph).colors[0] == WhitePixel(display, DefaultScreen(display)))
|
||||||
graph->colors[1] = BlackPixel(display, DefaultScreen(display));
|
DEVDEP(graph).colors[1] = BlackPixel(display, DefaultScreen(display));
|
||||||
else
|
else
|
||||||
graph->colors[1] = WhitePixel(display, DefaultScreen(display));
|
DEVDEP(graph).colors[1] = WhitePixel(display, DefaultScreen(display));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (numdispplanes < NXPLANES)
|
if (numdispplanes < NXPLANES)
|
||||||
|
|
@ -231,31 +232,31 @@ initcolors(GRAPH *graph)
|
||||||
(void) sprintf(ErrorMessage,
|
(void) sprintf(ErrorMessage,
|
||||||
"can't get color %s\n", colorstring);
|
"can't get color %s\n", colorstring);
|
||||||
externalerror(ErrorMessage);
|
externalerror(ErrorMessage);
|
||||||
graph->colors[i] = i ? BlackPixel(display,
|
DEVDEP(graph).colors[i] = i ? BlackPixel(display,
|
||||||
DefaultScreen(display))
|
DefaultScreen(display))
|
||||||
: WhitePixel(display, DefaultScreen(display));
|
: WhitePixel(display, DefaultScreen(display));
|
||||||
continue;
|
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
|
/* MW. I don't need this, everyone must know what he is doing
|
||||||
if (i > 0 &&
|
if (i > 0 &&
|
||||||
graph->colors[i] == DEVDEP(graph).view->core.background_pixel) {
|
DEVDEP(graph).colors[i] == DEVDEP(graph).view->core.background_pixel) {
|
||||||
graph->colors[i] = graph->colors[0];
|
DEVDEP(graph).colors[i] = DEVDEP(graph).colors[0];
|
||||||
} */
|
} */
|
||||||
|
|
||||||
}
|
}
|
||||||
/* MW. Set Beackgroound here */
|
/* 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) {
|
/* if (DEVDEP(graph).colors[0] != DEVDEP(graph).view->core.background_pixel) {
|
||||||
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++) {
|
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;
|
currentgraph->currentcolor = colorid;
|
||||||
XSetForeground(display, DEVDEP(currentgraph).gc,
|
XSetForeground(display, DEVDEP(currentgraph).gc,
|
||||||
currentgraph->colors[colorid]);
|
DEVDEP(currentgraph).colors[colorid]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,9 +57,6 @@ struct graph {
|
||||||
double width, height;
|
double width, height;
|
||||||
} datawindow;
|
} datawindow;
|
||||||
|
|
||||||
/* note: this int is device dependent */
|
|
||||||
int colors[NUMCOLORS];
|
|
||||||
|
|
||||||
/* cache (datawindow size) / (viewport size) */
|
/* cache (datawindow size) / (viewport size) */
|
||||||
double aspectratiox, aspectratioy;
|
double aspectratiox, aspectratioy;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue