1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
5 #include "pseudorendercontrol.hh"
7 #include "screeninfo.hh"
9 #include "rendertexture.hh"
14 #endif // HAVE_STDLIB_H
16 #include "../src/gettext.h"
17 #define _(str) gettext(str)
22 PseudoRenderControl::PseudoRenderControl(int screen)
23 : RenderControl(screen)
25 printf("Initializing PseudoColor RenderControl\n");
26 const ScreenInfo *info = display->screenInfo(_screen);
27 int depth = info->depth();
29 _cpc = 4; // XXX THIS SHOULD BE A USER OPTION
30 _ncolors = _cpc * _cpc * _cpc;
32 if (_cpc < 2 || _ncolors > 1 << depth) {
34 _("PseudoRenderControl: Invalid colormap size. Using maximum size
36 _cpc = 1 << (depth/3);
37 _ncolors = 1 << depth; // _cpc * _cpc * _cpc
40 if (!(_colors = new XColor[_ncolors])) {
42 _("PseudoRenderControl: error allocating colormap\n"));
49 PseudoRenderControl::~PseudoRenderControl()
51 printf("Destroying PseudoColor RenderControl\n");
56 void PseudoRenderControl::reduceDepth(Surface &sf, XImage *im) const