diff options
author | simonb <simonb> | 2005-04-27 17:45:56 (GMT) |
---|---|---|
committer | simonb <simonb> | 2005-04-27 17:45:56 (GMT) |
commit | 690030444b984e6b348284ae3c88671ee65a530b (patch) | |
tree | a0e36a3de8afa6a867f395a37757343e9577a24d /src/FbTk | |
parent | 9970dd11c7f9c0d9d91601c9e9785a857ca2c6d8 (diff) | |
download | fluxbox-690030444b984e6b348284ae3c88671ee65a530b.zip fluxbox-690030444b984e6b348284ae3c88671ee65a530b.tar.bz2 |
add rough support for non-default depth pixmaps. Saves us having ghost
holes in windows
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/FbPixmap.cc | 28 | ||||
-rw-r--r-- | src/FbTk/FbPixmap.hh | 2 | ||||
-rw-r--r-- | src/FbTk/ImageImlib2.cc | 4 |
3 files changed, 24 insertions, 10 deletions
diff --git a/src/FbTk/FbPixmap.cc b/src/FbTk/FbPixmap.cc index e573945..b2937c3 100644 --- a/src/FbTk/FbPixmap.cc +++ b/src/FbTk/FbPixmap.cc | |||
@@ -139,7 +139,8 @@ void FbPixmap::copy(const FbPixmap &the_copy) { | |||
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | void FbPixmap::copy(Pixmap pm) { | 142 | // screen doesn't count if depth is "zero"... |
143 | void FbPixmap::copy(Pixmap pm, int depth, int screen_num) { | ||
143 | free(); | 144 | free(); |
144 | if (pm == 0) | 145 | if (pm == 0) |
145 | return; | 146 | return; |
@@ -157,15 +158,28 @@ void FbPixmap::copy(Pixmap pm) { | |||
157 | &new_width, &new_height, | 158 | &new_width, &new_height, |
158 | &border_width, | 159 | &border_width, |
159 | &bpp); | 160 | &bpp); |
161 | |||
162 | if (depth == 0) | ||
163 | depth = bpp; | ||
164 | |||
160 | // create new pixmap and copy area | 165 | // create new pixmap and copy area |
161 | create(root, new_width, new_height, bpp); | 166 | create(root, new_width, new_height, depth); |
162 | 167 | ||
163 | GC gc = XCreateGC(display(), drawable(), 0, 0); | 168 | GC gc = XCreateGC(display(), drawable(), 0, 0); |
164 | 169 | ||
165 | XCopyArea(display(), pm, drawable(), gc, | 170 | if (depth == bpp) { |
166 | 0, 0, | 171 | XCopyArea(display(), pm, drawable(), gc, |
167 | width(), height(), | 172 | 0, 0, |
168 | 0, 0); | 173 | width(), height(), |
174 | 0, 0); | ||
175 | } else { | ||
176 | XSetForeground(display(), gc, Color("black", screen_num).pixel()); | ||
177 | XSetBackground(display(), gc, Color("white", screen_num).pixel()); | ||
178 | XCopyPlane(display(), pm, drawable(), gc, | ||
179 | 0, 0, | ||
180 | width(), height(), | ||
181 | 0, 0, 1); | ||
182 | } | ||
169 | 183 | ||
170 | XFreeGC(display(), gc); | 184 | XFreeGC(display(), gc); |
171 | } | 185 | } |
@@ -254,7 +268,7 @@ void FbPixmap::tile(unsigned int dest_width, unsigned int dest_height) { | |||
254 | 268 | ||
255 | FbPixmap new_pm(drawable(), width(), height(), depth()); | 269 | FbPixmap new_pm(drawable(), width(), height(), depth()); |
256 | 270 | ||
257 | new_pm.copy(m_pm); | 271 | new_pm.copy(m_pm, 0, 0); |
258 | 272 | ||
259 | resize(dest_width, dest_height); | 273 | resize(dest_width, dest_height); |
260 | 274 | ||
diff --git a/src/FbTk/FbPixmap.hh b/src/FbTk/FbPixmap.hh index a1c17a5..c8640a2 100644 --- a/src/FbTk/FbPixmap.hh +++ b/src/FbTk/FbPixmap.hh | |||
@@ -48,7 +48,7 @@ public: | |||
48 | virtual ~FbPixmap(); | 48 | virtual ~FbPixmap(); |
49 | 49 | ||
50 | void copy(const FbPixmap &the_copy); | 50 | void copy(const FbPixmap &the_copy); |
51 | void copy(Pixmap pixmap); | 51 | void copy(Pixmap pixmap, int depth_convert, int screen_num); |
52 | /// rotates the pixmap 90 deg, not implemented! | 52 | /// rotates the pixmap 90 deg, not implemented! |
53 | void rotate(); | 53 | void rotate(); |
54 | /// scales the pixmap to specified size | 54 | /// scales the pixmap to specified size |
diff --git a/src/FbTk/ImageImlib2.cc b/src/FbTk/ImageImlib2.cc index ca47209..62ed182 100644 --- a/src/FbTk/ImageImlib2.cc +++ b/src/FbTk/ImageImlib2.cc | |||
@@ -147,8 +147,8 @@ PixmapWithMask *ImageImlib2::load(const std::string &filename, int screen_num) c | |||
147 | // pm and mask belong to imlib2, | 147 | // pm and mask belong to imlib2, |
148 | // so we have to copy them | 148 | // so we have to copy them |
149 | PixmapWithMask* result = new PixmapWithMask(); | 149 | PixmapWithMask* result = new PixmapWithMask(); |
150 | result->pixmap().copy(pm); | 150 | result->pixmap().copy(pm, 0, 0); |
151 | result->mask().copy(mask); | 151 | result->mask().copy(mask, 0, 0); |
152 | 152 | ||
153 | // mark pm and mask as freeable in imlib | 153 | // mark pm and mask as freeable in imlib |
154 | imlib_free_image_and_decache(); | 154 | imlib_free_image_and_decache(); |