*** empty log message ***

This commit is contained in:
Dana Jansens 2003-01-18 04:06:39 +00:00
parent 2005c344bd
commit 9f705c02b9
4 changed files with 19 additions and 15 deletions

View file

@ -10,7 +10,7 @@ extern "C" {
namespace otk { namespace otk {
class ScreenInfo; class ScreenInfo;
class Widget; class Surface;
class RenderControl { class RenderControl {
protected: protected:
@ -66,7 +66,7 @@ public:
static RenderControl *getRenderControl(int screen); static RenderControl *getRenderControl(int screen);
virtual void render(Widget *wi) = 0; virtual void render(Surface *sf) = 0;
}; };
} }

View file

@ -3,6 +3,7 @@
#define __surface_hh #define __surface_hh
#include "point.hh" #include "point.hh"
#include "truerendercontrol.hh"
extern "C" { extern "C" {
#include <X11/Xlib.h> #include <X11/Xlib.h>
@ -26,6 +27,8 @@ public:
virtual const Point& size() const { return _size; } virtual const Point& size() const { return _size; }
virtual int width() const { return _size.x(); } virtual int width() const { return _size.x(); }
virtual int height() const { return _size.y(); } virtual int height() const { return _size.y(); }
friend class TrueRenderControl;
}; };
} }

View file

@ -7,7 +7,7 @@
#include "truerendercontrol.hh" #include "truerendercontrol.hh"
#include "display.hh" #include "display.hh"
#include "screeninfo.hh" #include "screeninfo.hh"
#include "widget.hh" #include "surface.hh"
extern "C" { extern "C" {
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
@ -21,7 +21,10 @@ extern "C" {
namespace otk { namespace otk {
TrueRenderControl::TrueRenderControl(const ScreenInfo *screen) TrueRenderControl::TrueRenderControl(const ScreenInfo *screen)
: RenderControl(screen) : RenderControl(screen),
_red_offset(0),
_green_offset(0),
_blue_offset(0)
{ {
printf("Initializing TrueColor RenderControl\n"); printf("Initializing TrueColor RenderControl\n");
@ -99,12 +102,12 @@ static inline void renderPixel(XImage *im, unsigned char *dp,
} }
} }
void TrueRenderControl::render(Widget *wi) void TrueRenderControl::render(Surface *sf)
{ {
assert(wi); assert(sf);
int w = sf->width(), h = sf->height();
int w = wi->width(), h = wi->height();
Pixmap p = XCreatePixmap(**display, wi->window(), w, h, _screen->depth());
XImage *im = XCreateImage(**display, _screen->visual(), _screen->depth(), XImage *im = XCreateImage(**display, _screen->visual(), _screen->depth(),
ZPixmap, 0, NULL, w, h, 32, 0); ZPixmap, 0, NULL, w, h, 32, 0);
@ -125,17 +128,15 @@ void TrueRenderControl::render(Widget *wi)
im->data = (char*) data; im->data = (char*) data;
XPutImage(**display, p, DefaultGC(**display, _screen->screen()), if (!sf->_pm)
sf->_pm = XCreatePixmap(**display, _screen->rootWindow(), w, h,
_screen->depth());
XPutImage(**display, sf->_pm, DefaultGC(**display, _screen->screen()),
im, 0, 0, 0, 0, w, h); im, 0, 0, 0, 0, w, h);
//delete [] image->data; //delete [] image->data;
//image->data = NULL; //image->data = NULL;
XDestroyImage(im); XDestroyImage(im);
XSetWindowBackgroundPixmap(**display, wi->window(), p);
XClearWindow(**display, wi->window());
XFreePixmap(**display, p);
} }
} }

View file

@ -17,7 +17,7 @@ public:
TrueRenderControl(const ScreenInfo *screen); TrueRenderControl(const ScreenInfo *screen);
virtual ~TrueRenderControl(); virtual ~TrueRenderControl();
virtual void render(Widget *wi); virtual void render(Surface *sf);
}; };
} }