X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=otk%2Fpseudorendercontrol.cc;h=c30e77f9b32c0609caae6bd7abd9976978f35ca8;hb=a0738a0197b23d1bb2b2a58ae8d82a998fbf2d99;hp=e239a4f040172a996d8b9b775de69e0fb72118fc;hpb=115fedf432d73f17ade48eaa2fa12dfd333bfcaa;p=chaz%2Fopenbox diff --git a/otk/pseudorendercontrol.cc b/otk/pseudorendercontrol.cc index e239a4f0..c30e77f9 100644 --- a/otk/pseudorendercontrol.cc +++ b/otk/pseudorendercontrol.cc @@ -23,22 +23,38 @@ 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::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); } }