// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
-#ifdef HAVE_CONFIG_H
-# include "../config.h"
-#endif // HAVE_CONFIG_H
+#include "config.h"
#include "pseudorendercontrol.hh"
#include "display.hh"
: 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::drawBackground(Surface& sf,
- const RenderTexture &texture) const
+void PseudoRenderControl::reduceDepth(Surface &sf, XImage *im) const
{
- assert(_screen == sf._screen);
- assert(_screen == texture.color().screen());
-
- // in psuedo color, gradients aren't even worth while! just draw a solid!
- //if (texture.gradient() == RenderTexture::Solid) {
- drawSolidBackground(sf, texture);
}
}