From 58847af218e486f5c1a34ffe947a961a74f97c0a Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Tue, 11 Feb 2003 21:50:06 +0000 Subject: store the pixel32 data in the surface so it can be reused --- otk/surface.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'otk/surface.cc') diff --git a/otk/surface.cc b/otk/surface.cc index 7d7c0c53..3f5624d7 100644 --- a/otk/surface.cc +++ b/otk/surface.cc @@ -9,6 +9,7 @@ extern "C" { #include +#include } namespace otk { @@ -16,6 +17,7 @@ namespace otk { Surface::Surface(int screen, const Size &size) : _screen(screen), _size(size), + _pixel_data(new pixel32[size.width()*size.height()]), _pixmap(None), _xftdraw(0) { @@ -24,6 +26,7 @@ Surface::Surface(int screen, const Size &size) Surface::~Surface() { destroyObjects(); + delete [] _pixel_data; } void Surface::setPixmap(const RenderColor &color) @@ -33,6 +36,15 @@ void Surface::setPixmap(const RenderColor &color) XFillRectangle(**display, _pixmap, color.gc(), 0, 0, _size.width(), _size.height()); + + pixel32 val = 0; // XXX set this from the color and shift amounts! + for (unsigned int i = 0, s = _size.width() * _size.height(); i < s; ++i) { + unsigned char *p = (unsigned char*)&_pixel_data[i]; + *p = (unsigned char) (val >> 24); + *++p = (unsigned char) (val >> 16); + *++p = (unsigned char) (val >> 8); + *++p = (unsigned char) val; + } } void Surface::setPixmap(XImage *image) -- cgit v1.2.3