]>
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());
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.037146 seconds and 4 git commands to generate.