]>
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 Size
&size
)
31 void Surface::setPixmap(const RenderColor
&color
)
36 XFillRectangle(**display
, _pixmap
, color
.gc(), 0, 0,
37 _size
.width(), _size
.height());
40 void Surface::setPixmap(XImage
*image
)
42 assert((unsigned)image
->width
== _size
.width());
43 assert((unsigned)image
->height
== _size
.height());
48 XPutImage(**display
, _pixmap
, DefaultGC(**display
, _screen
),
49 image
, 0, 0, 0, 0, _size
.width(), _size
.height());
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
.width(), _size
.height(), info
->depth());
60 assert(_pixmap
!= None
);
62 _xftdraw
= XftDrawCreate(**display
, _pixmap
,
63 info
->visual(), info
->colormap());
67 void Surface::destroyObjects()
70 XftDrawDestroy(_xftdraw
);
74 if (_pixmap
!= None
) {
75 XFreePixmap(**display
, _pixmap
);
This page took 0.036367 seconds and 4 git commands to generate.