]> Dogcows Code - chaz/openbox/blob - otk/truerendercontrol.cc
fuc put it back
[chaz/openbox] / otk / truerendercontrol.cc
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2
3 #ifdef HAVE_CONFIG_H
4 # include "../config.h"
5 #endif // HAVE_CONFIG_H
6
7 #include "truerendercontrol.hh"
8 #include "display.hh"
9 #include "screeninfo.hh"
10
11 extern "C" {
12 #ifdef HAVE_STDLIB_H
13 # include <stdlib.h>
14 #endif // HAVE_STDLIB_H
15
16 #include "gettext.h"
17 #define _(str) gettext(str)
18 }
19
20 namespace otk {
21
22 TrueRenderControl::TrueRenderControl(const ScreenInfo *screen)
23 : RenderControl(screen)
24 {
25 printf("Initializing TrueColor RenderControl\n");
26
27 unsigned long red_mask, green_mask, blue_mask;
28
29 // find the offsets for each color in the visual's masks
30 red_mask = screen->visual()->red_mask;
31 green_mask = screen->visual()->green_mask;
32 blue_mask = screen->visual()->blue_mask;
33
34 while (! (red_mask & 1)) { _red_offset++; red_mask >>= 1; }
35 while (! (green_mask & 1)) { _green_offset++; green_mask >>= 1; }
36 while (! (blue_mask & 1)) { _blue_offset++; blue_mask >>= 1; }
37
38 // use the mask to determine the number of bits for each shade of color
39 // so, best case, red_mask == 0xff (255), with each bit as a different
40 // shade!
41 _red_bits = 255 / red_mask;
42 _green_bits = 255 / green_mask;
43 _blue_bits = 255 / blue_mask;
44
45 // compute color tables, based on the number of bits for each shade
46 for (int i = 0; i < 256; i++) {
47 _red_color_table[i] = i / _red_bits;
48 _green_color_table[i] = i / _green_bits;
49 _blue_color_table[i] = i / _blue_bits;
50 }
51 }
52
53 TrueRenderControl::~TrueRenderControl()
54 {
55 printf("Destroying TrueColor RenderControl\n");
56
57
58 }
59
60 void TrueRenderControl::render(::Drawable d)
61 {
62 Pixmap p = XCreatePixmap(**display, d, 255, 30, _screen->depth());
63
64
65
66 XFreePixmap(**display, p);
67 }
68
69 }
This page took 0.041646 seconds and 5 git commands to generate.