all repos — openbox @ 6b1381d69daf7c325d4a8165a8b0006d0dce85a5

openbox fork - make it a bit more like ryudo

otk/pseudorendercontrol.cc (raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-

#include "config.h"

#include "pseudorendercontrol.hh"
#include "display.hh"
#include "screeninfo.hh"
#include "surface.hh"
#include "rendertexture.hh"

extern "C" {
#ifdef    HAVE_STDLIB_H
#  include <stdlib.h>
#endif // HAVE_STDLIB_H

#include "../src/gettext.h"
#define _(str) gettext(str)
}

namespace otk {

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::reduceDepth(Surface &sf, XImage *im) const
{
}

}