1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
4 # include "../config.h"
5 #endif // HAVE_CONFIG_H
9 #include "screeninfo.hh"
13 #include <X11/Xutil.h>
18 Surface::Surface(int screen, const Point &size)
31 void Surface::setPixmap(const Color &color)
37 XFillRectangle(**display, _pixmap, p.gc(), 0, 0,
38 _size.x(), _size.y());
41 void Surface::setPixmap(XImage *image)
43 printf("SET PIXMAP\n");
44 assert(image->width == _size.x());
45 assert(image->height == _size.y());
50 XPutImage(**display, _pixmap, DefaultGC(**display, _screen),
51 image, 0, 0, 0, 0, _size.x(), _size.y());
54 void Surface::createObjects()
56 assert(_pixmap == None); assert(!_xftdraw);
58 const ScreenInfo *info = display->screenInfo(_screen);
60 _pixmap = XCreatePixmap(**display, info->rootWindow(),
61 _size.x(), _size.y(), info->depth());
63 _xftdraw = XftDrawCreate(**display, _pixmap,
64 info->visual(), info->colormap());
67 void Surface::destroyObjects()
70 XftDrawDestroy(_xftdraw);
74 if (_pixmap != None) {
75 XFreePixmap(**display, _pixmap);