aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/FbDrawable.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/FbDrawable.cc')
-rw-r--r--src/FbTk/FbDrawable.cc25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/FbTk/FbDrawable.cc b/src/FbTk/FbDrawable.cc
index 21f2eba..f10f894 100644
--- a/src/FbTk/FbDrawable.cc
+++ b/src/FbTk/FbDrawable.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: FbDrawable.cc,v 1.2 2003/09/06 15:39:06 fluxgen Exp $ 22// $Id: FbDrawable.cc,v 1.3 2004/09/10 15:46:08 akir Exp $
23 23
24#include "FbDrawable.hh" 24#include "FbDrawable.hh"
25 25
@@ -27,13 +27,22 @@
27 27
28namespace FbTk { 28namespace FbTk {
29 29
30Display *FbDrawable::s_display = 0;
31
32FbDrawable::FbDrawable() {
33
34 if (s_display == 0) {
35 s_display = FbTk::App::instance()->display();
36 }
37}
38
30void FbDrawable::copyArea(Drawable src, GC gc, 39void FbDrawable::copyArea(Drawable src, GC gc,
31 int src_x, int src_y, 40 int src_x, int src_y,
32 int dest_x, int dest_y, 41 int dest_x, int dest_y,
33 unsigned int width, unsigned int height) { 42 unsigned int width, unsigned int height) {
34 if (drawable() == 0 || src == 0 || gc == 0) 43 if (drawable() == 0 || src == 0 || gc == 0)
35 return; 44 return;
36 XCopyArea(FbTk::App::instance()->display(), 45 XCopyArea(s_display,
37 src, drawable(), gc, 46 src, drawable(), gc,
38 src_x, src_y, 47 src_x, src_y,
39 width, height, 48 width, height,
@@ -44,7 +53,7 @@ void FbDrawable::fillRectangle(GC gc, int x, int y,
44 unsigned int width, unsigned int height) { 53 unsigned int width, unsigned int height) {
45 if (drawable() == 0 || gc == 0) 54 if (drawable() == 0 || gc == 0)
46 return; 55 return;
47 XFillRectangle(FbTk::App::instance()->display(), 56 XFillRectangle(s_display,
48 drawable(), gc, 57 drawable(), gc,
49 x, y, 58 x, y,
50 width, height); 59 width, height);
@@ -54,7 +63,7 @@ void FbDrawable::drawRectangle(GC gc, int x, int y,
54 unsigned int width, unsigned int height) { 63 unsigned int width, unsigned int height) {
55 if (drawable() == 0 || gc == 0) 64 if (drawable() == 0 || gc == 0)
56 return; 65 return;
57 XDrawRectangle(FbTk::App::instance()->display(), 66 XDrawRectangle(s_display,
58 drawable(), gc, 67 drawable(), gc,
59 x, y, 68 x, y,
60 width, height); 69 width, height);
@@ -64,7 +73,7 @@ void FbDrawable::drawLine(GC gc, int start_x, int start_y,
64 int end_x, int end_y) { 73 int end_x, int end_y) {
65 if (drawable() == 0 || gc == 0) 74 if (drawable() == 0 || gc == 0)
66 return; 75 return;
67 XDrawLine(FbTk::App::instance()->display(), 76 XDrawLine(s_display,
68 drawable(), 77 drawable(),
69 gc, 78 gc,
70 start_x, start_y, 79 start_x, start_y,
@@ -75,7 +84,7 @@ void FbDrawable::fillPolygon(GC gc, XPoint *points, int npoints,
75 int shape, int mode) { 84 int shape, int mode) {
76 if (drawable() == 0 || gc == 0 || points == 0 || npoints == 0) 85 if (drawable() == 0 || gc == 0 || points == 0 || npoints == 0)
77 return; 86 return;
78 XFillPolygon(FbTk::App::instance()->display(), 87 XFillPolygon(s_display,
79 drawable(), gc, points, npoints, 88 drawable(), gc, points, npoints,
80 shape, mode); 89 shape, mode);
81} 90}
@@ -83,11 +92,11 @@ void FbDrawable::fillPolygon(GC gc, XPoint *points, int npoints,
83void FbDrawable::drawPoint(GC gc, int x, int y) { 92void FbDrawable::drawPoint(GC gc, int x, int y) {
84 if (drawable() == 0 || gc == 0) 93 if (drawable() == 0 || gc == 0)
85 return; 94 return;
86 XDrawPoint(FbTk::App::instance()->display(), drawable(), gc, x, y); 95 XDrawPoint(s_display, drawable(), gc, x, y);
87} 96}
88 97
89XImage *FbDrawable::image(int x, int y, unsigned int width, unsigned int height) const { 98XImage *FbDrawable::image(int x, int y, unsigned int width, unsigned int height) const {
90 return XGetImage(FbTk::App::instance()->display(), drawable(), 99 return XGetImage(s_display, drawable(),
91 x, y, width, height, 100 x, y, width, height,
92 AllPlanes, // plane mask 101 AllPlanes, // plane mask
93 ZPixmap); 102 ZPixmap);