]> Dogcows Code - chaz/openbox/blob - otk/pseudorendercontrol.cc
start of pseudo init
[chaz/openbox] / otk / pseudorendercontrol.cc
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2
3 #include "config.h"
4
5 #include "pseudorendercontrol.hh"
6 #include "display.hh"
7 #include "screeninfo.hh"
8 #include "surface.hh"
9 #include "rendertexture.hh"
10
11 extern "C" {
12 #ifdef HAVE_STDLIB_H
13 # include <stdlib.h>
14 #endif // HAVE_STDLIB_H
15
16 #include "../src/gettext.h"
17 #define _(str) gettext(str)
18 }
19
20 namespace otk {
21
22 PseudoRenderControl::PseudoRenderControl(int screen)
23 : RenderControl(screen)
24 {
25 printf("Initializing PseudoColor RenderControl\n");
26 const ScreenInfo *info = display->screenInfo(_screen);
27 int depth = info->depth();
28
29 _cpc = 4; // XXX THIS SHOULD BE A USER OPTION
30 _ncolors = _cpc * _cpc * _cpc;
31
32 if (_cpc < 2 || _ncolors > 1 << depth) {
33 fprintf(stderr,
34 _("PseudoRenderControl: Invalid colormap size. Using maximum size
35 available.\n"));
36 _cpc = 1 << (depth/3);
37 _ncolors = 1 << depth; // _cpc * _cpc * _cpc
38 }
39
40 if (!(_colors = new XColor[_ncolors])) {
41 fprintf(stderr,
42 _("PseudoRenderControl: error allocating colormap\n"));
43 ::exit(1);
44 }
45
46
47 }
48
49 PseudoRenderControl::~PseudoRenderControl()
50 {
51 printf("Destroying PseudoColor RenderControl\n");
52
53 delete _colors;
54 }
55
56 void PseudoRenderControl::reduceDepth(Surface &sf, XImage *im) const
57 {
58 }
59
60 }
This page took 0.03883 seconds and 5 git commands to generate.