start of pseudocolor init

This commit is contained in:
Dana Jansens 2003-02-12 01:12:34 +00:00
parent 325a909dcd
commit 5e0fc865a8

View file

@ -23,13 +23,34 @@ PseudoRenderControl::PseudoRenderControl(int screen)
: RenderControl(screen)
{
printf("Initializing PseudoColor RenderControl\n");
const ScreenInfo *info = display->screenInfo(_screen);
int depth = info->depth();
_cpc = 4; // XXX THIS SHOULD BE A USER OPTION
_ncolors = _cpc * _cpc * _cpc;
if (_cpc < 2 || ncolors > 1 << depth) {
fprintf(stderr,
_("PseudoRenderControl: Invalid colormap size. Using maximum size
available.\n"));
_cpc = 1 << (depth/3);
_ncolors = 1 << depth; // _cpc * _cpc * _cpc
}
if (!(_colors = new XColor[_ncolors])) {
fprintf(stderr,
_("PseudoRenderControl: error allocating colormap\n"));
::exit(1);
}
}
PseudoRenderControl::~PseudoRenderControl()
{
printf("Destroying PseudoColor RenderControl\n");
delete _colors;
}
void PseudoRenderControl::reduceDepth(Surface &sf, XImage *im) const