From: Dana Jansens Date: Sat, 18 Jan 2003 02:38:29 +0000 (+0000) Subject: change the render() interface X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=e6d6a1b6b59d53f9d149f034274b205844eacf1e;p=chaz%2Fopenbox change the render() interface --- diff --git a/otk/rendercontrol.hh b/otk/rendercontrol.hh index e8dcca44..f48f7057 100644 --- a/otk/rendercontrol.hh +++ b/otk/rendercontrol.hh @@ -10,6 +10,7 @@ extern "C" { namespace otk { class ScreenInfo; +class Widget; class RenderControl { protected: @@ -67,7 +68,7 @@ public: static RenderControl *getRenderControl(int screen); - virtual void render(::Window w) = 0; + virtual void render(Widget *wi) = 0; }; } diff --git a/otk/rendertest.cc b/otk/rendertest.cc index c9226b1f..d3e38ae8 100644 --- a/otk/rendertest.cc +++ b/otk/rendertest.cc @@ -14,7 +14,7 @@ int main(int argc, char **argv) otk::RenderControl *rc = otk::RenderControl::getRenderControl(0); - rc->render(foo.window()); + rc->render(&foo); app.run(); diff --git a/otk/truerendercontrol.cc b/otk/truerendercontrol.cc index 0cfa293e..0b033955 100644 --- a/otk/truerendercontrol.cc +++ b/otk/truerendercontrol.cc @@ -7,6 +7,7 @@ #include "truerendercontrol.hh" #include "display.hh" #include "screeninfo.hh" +#include "widget.hh" extern "C" { #ifdef HAVE_STDLIB_H @@ -145,13 +146,15 @@ void renderPixel(XImage *im, unsigned char *dp, unsigned long pixel) } } -void TrueRenderControl::render(::Window win) +void TrueRenderControl::render(Widget *wi) { + assert(wi); + XGCValues gcv; gcv.cap_style = CapProjecting; - int w = 255, h = 32; - Pixmap p = XCreatePixmap(**display, win, w, h, _screen->depth()); + int w = 255, h = 31; + Pixmap p = XCreatePixmap(**display, wi->window(), 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); @@ -171,8 +174,6 @@ void TrueRenderControl::render(::Window win) for (int y = 0; y < 10; ++y) for (int x = 0; x < w; ++x, dp += im->bits_per_pixel/8) renderPixel(im, dp, _blue_color_table[x] << _blue_offset); - for (int x = 0; x < w; ++x, dp += im->bits_per_pixel/8) - renderPixel(im, dp, 0); printf("\nDone\n"); @@ -185,8 +186,8 @@ void TrueRenderControl::render(::Window win) //image->data = NULL; XDestroyImage(im); - XSetWindowBackgroundPixmap(**display, win, p); - XClearWindow(**display, win); + XSetWindowBackgroundPixmap(**display, wi->window(), p); + XClearWindow(**display, wi->window()); XFreePixmap(**display, p); } diff --git a/otk/truerendercontrol.hh b/otk/truerendercontrol.hh index f4057355..574b5272 100644 --- a/otk/truerendercontrol.hh +++ b/otk/truerendercontrol.hh @@ -17,7 +17,7 @@ public: TrueRenderControl(const ScreenInfo *screen); virtual ~TrueRenderControl(); - virtual void render(::Window w); + virtual void render(Widget *wi); }; }