X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=otk%2Ftruerendercontrol.cc;h=26fa06a73a551c7cd844667e6026a678f61b3ecb;hb=1a5fb96b415488a4dd48cef7ce90dea058f0de85;hp=95a567bcc98b91d8a9885e78e2b25ecb3fb4d136;hpb=67bb7f8ce08d3ef625843ab7ea2c4434b1620ecf;p=chaz%2Fopenbox diff --git a/otk/truerendercontrol.cc b/otk/truerendercontrol.cc index 95a567bc..26fa06a7 100644 --- a/otk/truerendercontrol.cc +++ b/otk/truerendercontrol.cc @@ -57,4 +57,45 @@ TrueRenderControl::~TrueRenderControl() } +void TrueRenderControl::render(::Drawable d) +{ + XGCValues gcv; + gcv.cap_style = CapProjecting; + + int w = 255, h = 32; + Pixmap p = XCreatePixmap(**display, d, w, h, _screen->depth()); + XImage *im = XCreateImage(**display, _screen->visual(), _screen->depth(), + ZPixmap, 0, NULL, w, h, 32, 0); + //GC gc = XCreateGC(**display, _screen->rootWindow(), GCCapStyle, &gcv); + + im->data = new char[im->bytes_per_line * (h + 1)]; // XXX + 1? + char *dp = im->data; + + for (int x = 0; x < w; ++x, ++dp) + *dp = 0; + for (int y = 0; y < 10; ++h) + for (int x = 0; x < w; ++x, ++dp) + *dp = _red_color_table[x] << _red_offset; + for (int y = 0; y < 10; ++h) + for (int x = 0; x < w; ++x, ++dp) + *dp = _green_color_table[x] << _green_offset; + for (int y = 0; y < 10; ++h) + for (int x = 0; x < w; ++x, ++dp) + *dp = _blue_color_table[x] << _blue_offset; + for (int x = 0; x < w; ++x, ++dp) + *dp = 0; + + XPutImage(**display, p, DefaultGC(**display, _screen->screen()), + im, 0, 0, 0, 0, w, h); + + //delete [] image->data; + //image->data = NULL; + XDestroyImage(im); + + XCopyArea(**display, p, d, DefaultGC(**display, _screen->screen()), + 0, 0, w, h, 0, 0); + + XFreePixmap(**display, p); +} + }