]>
Dogcows Code - chaz/openbox/blob - otk/surface.cc
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
4 # include "../config.h"
5 #endif // HAVE_CONFIG_H
9 #include "screeninfo.hh"
10 #include "rendercolor.hh"
13 #include <X11/Xutil.h>
18 Surface::Surface(int screen
, const Point
&size
)
31 void Surface::setPixmap(const RenderColor
&color
)
36 XFillRectangle(**display
, _pixmap
, color
.gc(), 0, 0,
37 _size
.x(), _size
.y());
40 void Surface::setPixmap(XImage
*image
)
42 assert(image
->width
== _size
.x());
43 assert(image
->height
== _size
.y());
48 XPutImage(**display
, _pixmap
, DefaultGC(**display
, _screen
),
49 image
, 0, 0, 0, 0, _size
.x(), _size
.y());
52 void Surface::createObjects()
54 assert(_pixmap
== None
); assert(!_xftdraw
);
56 const ScreenInfo
*info
= display
->screenInfo(_screen
);
58 _pixmap
= XCreatePixmap(**display
, info
->rootWindow(),
59 _size
.x(), _size
.y(), info
->depth());
61 _xftdraw
= XftDrawCreate(**display
, _pixmap
,
62 info
->visual(), info
->colormap());
65 void Surface::destroyObjects()
68 XftDrawDestroy(_xftdraw
);
72 if (_pixmap
!= None
) {
73 XFreePixmap(**display
, _pixmap
);
This page took 0.040182 seconds and 4 git commands to generate.