summaryrefslogtreecommitdiff
path: root/otk/surface.cc
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-02-11 21:50:06 +0000
committerDana Jansens <danakj@orodu.net>2003-02-11 21:50:06 +0000
commit58847af218e486f5c1a34ffe947a961a74f97c0a (patch)
tree99effbba133c3d8d139b2c334cc7360bac872b7e /otk/surface.cc
parente429ce39deaf4a8d5975e871af0530634ea2a63e (diff)
store the pixel32 data in the surface so it can be reused
Diffstat (limited to 'otk/surface.cc')
-rw-r--r--otk/surface.cc12
1 files changed, 12 insertions, 0 deletions
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 <X11/Xutil.h>
+#include <cstring>
}
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)