X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=otk%2Fpseudorendercontrol.cc;h=b3ee06c36de907c81611d2fa8a8afc3ba7ef0fad;hb=5e0fc865a8b6063cbcb3451fbac4cdbe841889df;hp=813eb4d18b750a44627a8c3f344d90cc35e31899;hpb=afb8a28120b21569934202968283e65a173c3bd8;p=chaz%2Fopenbox diff --git a/otk/pseudorendercontrol.cc b/otk/pseudorendercontrol.cc index 813eb4d1..b3ee06c3 100644 --- a/otk/pseudorendercontrol.cc +++ b/otk/pseudorendercontrol.cc @@ -1,8 +1,6 @@ // -*- 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" @@ -25,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); } }