diff options
author | akir <akir> | 2004-09-10 16:48:15 (GMT) |
---|---|---|
committer | akir <akir> | 2004-09-10 16:48:15 (GMT) |
commit | c8f9cf1177b6de1cc210f0706dae302b9aa4f7b5 (patch) | |
tree | ee799ee3af64cfd439abccb6b10371be1a232498 /src/FbTk/Transparent.cc | |
parent | df0c942aa2576a8edaae5a13ace01643729035ea (diff) | |
download | fluxbox-c8f9cf1177b6de1cc210f0706dae302b9aa4f7b5.zip fluxbox-c8f9cf1177b6de1cc210f0706dae302b9aa4f7b5.tar.bz2 |
cosmetic + avoid unneeded App::instance()->display() calls
Diffstat (limited to 'src/FbTk/Transparent.cc')
-rw-r--r-- | src/FbTk/Transparent.cc | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/FbTk/Transparent.cc b/src/FbTk/Transparent.cc index ab6b4d9..9cc377e 100644 --- a/src/FbTk/Transparent.cc +++ b/src/FbTk/Transparent.cc | |||
@@ -1,6 +1,6 @@ | |||
1 | // Transparent.cc for FbTk - Fluxbox Toolkit | 1 | // Transparent.cc for FbTk - Fluxbox Toolkit |
2 | // Copyright (c) 2003 Henrik Kinnunen (fluxgen(at)users.sourceforge.net) | 2 | // Copyright (c) 2003 Henrik Kinnunen (fluxgen(at)users.sourceforge.net) |
3 | // | 3 | // |
4 | // Permission is hereby granted, free of charge, to any person obtaining a | 4 | // Permission is hereby granted, free of charge, to any person obtaining a |
5 | // copy of this software and associated documentation files (the "Software"), | 5 | // copy of this software and associated documentation files (the "Software"), |
6 | // to deal in the Software without restriction, including without limitation | 6 | // to deal in the Software without restriction, including without limitation |
@@ -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: Transparent.cc,v 1.6 2004/06/07 11:46:05 rathnor Exp $ | 22 | // $Id: Transparent.cc,v 1.7 2004/09/10 16:48:15 akir Exp $ |
23 | 23 | ||
24 | #include "Transparent.hh" | 24 | #include "Transparent.hh" |
25 | #include "App.hh" | 25 | #include "App.hh" |
@@ -47,7 +47,7 @@ Picture createAlphaPic(Window drawable, unsigned char alpha) { | |||
47 | XRenderPictFormat pic_format; | 47 | XRenderPictFormat pic_format; |
48 | pic_format.type = PictTypeDirect; | 48 | pic_format.type = PictTypeDirect; |
49 | pic_format.depth = 8; // alpha with bit depth 8 | 49 | pic_format.depth = 8; // alpha with bit depth 8 |
50 | pic_format.direct.alphaMask = 0xff; | 50 | pic_format.direct.alphaMask = 0xff; |
51 | XRenderPictFormat *format = XRenderFindFormat(disp, PictFormatType | | 51 | XRenderPictFormat *format = XRenderFindFormat(disp, PictFormatType | |
52 | PictFormatDepth | PictFormatAlphaMask, | 52 | PictFormatDepth | PictFormatAlphaMask, |
53 | &pic_format, 0); | 53 | &pic_format, 0); |
@@ -109,8 +109,8 @@ Transparent::Transparent(Drawable src, Drawable dest, unsigned char alpha, int s | |||
109 | // check for RENDER support | 109 | // check for RENDER support |
110 | if (!s_init) { | 110 | if (!s_init) { |
111 | int major_opcode, first_event, first_error; | 111 | int major_opcode, first_event, first_error; |
112 | if (XQueryExtension(disp, "RENDER", | 112 | if (XQueryExtension(disp, "RENDER", |
113 | &major_opcode, | 113 | &major_opcode, |
114 | &first_event, &first_error) == False) { | 114 | &first_event, &first_error) == False) { |
115 | s_render = false; | 115 | s_render = false; |
116 | } else { // we got RENDER support | 116 | } else { // we got RENDER support |
@@ -119,7 +119,7 @@ Transparent::Transparent(Drawable src, Drawable dest, unsigned char alpha, int s | |||
119 | s_init = true; | 119 | s_init = true; |
120 | } | 120 | } |
121 | 121 | ||
122 | 122 | ||
123 | #ifdef HAVE_XRENDER | 123 | #ifdef HAVE_XRENDER |
124 | if (!s_render) | 124 | if (!s_render) |
125 | return; | 125 | return; |
@@ -127,13 +127,13 @@ Transparent::Transparent(Drawable src, Drawable dest, unsigned char alpha, int s | |||
127 | allocAlpha(m_alpha); | 127 | allocAlpha(m_alpha); |
128 | 128 | ||
129 | 129 | ||
130 | XRenderPictFormat *format = | 130 | XRenderPictFormat *format = |
131 | XRenderFindVisualFormat(disp, | 131 | XRenderFindVisualFormat(disp, |
132 | DefaultVisual(disp, screen_num)); | 132 | DefaultVisual(disp, screen_num)); |
133 | 133 | ||
134 | 134 | ||
135 | if (src != 0 && format != 0) { | 135 | if (src != 0 && format != 0) { |
136 | m_src_pic = XRenderCreatePicture(disp, src, format, | 136 | m_src_pic = XRenderCreatePicture(disp, src, format, |
137 | 0, 0); | 137 | 0, 0); |
138 | } | 138 | } |
139 | 139 | ||
@@ -181,8 +181,8 @@ void Transparent::setDest(Drawable dest, int screen_num) { | |||
181 | // create new dest pic if we have a valid dest drawable | 181 | // create new dest pic if we have a valid dest drawable |
182 | if (dest != 0) { | 182 | if (dest != 0) { |
183 | 183 | ||
184 | XRenderPictFormat *format = | 184 | XRenderPictFormat *format = |
185 | XRenderFindVisualFormat(disp, | 185 | XRenderFindVisualFormat(disp, |
186 | DefaultVisual(disp, screen_num)); | 186 | DefaultVisual(disp, screen_num)); |
187 | if (format == 0) { | 187 | if (format == 0) { |
188 | _FB_USES_NLS; | 188 | _FB_USES_NLS; |
@@ -191,7 +191,7 @@ void Transparent::setDest(Drawable dest, int screen_num) { | |||
191 | cerr<<endl; | 191 | cerr<<endl; |
192 | } | 192 | } |
193 | m_dest_pic = XRenderCreatePicture(disp, dest, format, 0, 0); | 193 | m_dest_pic = XRenderCreatePicture(disp, dest, format, 0, 0); |
194 | 194 | ||
195 | 195 | ||
196 | } | 196 | } |
197 | m_dest = dest; | 197 | m_dest = dest; |
@@ -208,7 +208,7 @@ void Transparent::setSource(Drawable source, int screen_num) { | |||
208 | if (m_alpha_pic != 0) | 208 | if (m_alpha_pic != 0) |
209 | freeAlpha(); | 209 | freeAlpha(); |
210 | 210 | ||
211 | Display *disp = FbTk::App::instance()->display(); | 211 | Display *disp = FbTk::App::instance()->display(); |
212 | 212 | ||
213 | if (m_src_pic != 0) { | 213 | if (m_src_pic != 0) { |
214 | XRenderFreePicture(disp, m_src_pic); | 214 | XRenderFreePicture(disp, m_src_pic); |
@@ -220,8 +220,8 @@ void Transparent::setSource(Drawable source, int screen_num) { | |||
220 | // create new source pic if we have a valid source drawable | 220 | // create new source pic if we have a valid source drawable |
221 | if (m_source != 0) { | 221 | if (m_source != 0) { |
222 | 222 | ||
223 | XRenderPictFormat *format = | 223 | XRenderPictFormat *format = |
224 | XRenderFindVisualFormat(disp, | 224 | XRenderFindVisualFormat(disp, |
225 | DefaultVisual(disp, screen_num)); | 225 | DefaultVisual(disp, screen_num)); |
226 | if (format == 0) { | 226 | if (format == 0) { |
227 | _FB_USES_NLS; | 227 | _FB_USES_NLS; |
@@ -229,8 +229,8 @@ void Transparent::setSource(Drawable source, int screen_num) { | |||
229 | fprintf(stderr, _FBTKTEXT(Error, NoRenderVisualFormat, "Failed to find format for screen(%d)", "XRenderFindVisualFormat failed... include %d for screen number"), screen_num); | 229 | fprintf(stderr, _FBTKTEXT(Error, NoRenderVisualFormat, "Failed to find format for screen(%d)", "XRenderFindVisualFormat failed... include %d for screen number"), screen_num); |
230 | cerr<<endl; | 230 | cerr<<endl; |
231 | } | 231 | } |
232 | m_src_pic = XRenderCreatePicture(disp, m_source, format, | 232 | m_src_pic = XRenderCreatePicture(disp, m_source, format, |
233 | 0, 0); | 233 | 0, 0); |
234 | } | 234 | } |
235 | 235 | ||
236 | // recreate new alpha | 236 | // recreate new alpha |
@@ -247,13 +247,13 @@ void Transparent::render(int src_x, int src_y, | |||
247 | m_alpha_pic == 0 || !s_render) | 247 | m_alpha_pic == 0 || !s_render) |
248 | return; | 248 | return; |
249 | // render src+alpha to dest picture | 249 | // render src+alpha to dest picture |
250 | XRenderComposite(FbTk::App::instance()->display(), | 250 | XRenderComposite(FbTk::App::instance()->display(), |
251 | PictOpOver, | 251 | PictOpOver, |
252 | m_src_pic, | 252 | m_src_pic, |
253 | m_alpha_pic, | 253 | m_alpha_pic, |
254 | m_dest_pic, | 254 | m_dest_pic, |
255 | src_x, src_y, | 255 | src_x, src_y, |
256 | 0, 0, | 256 | 0, 0, |
257 | dest_x, dest_y, | 257 | dest_x, dest_y, |
258 | width, height); | 258 | width, height); |
259 | 259 | ||
@@ -284,4 +284,4 @@ void Transparent::freeAlpha() { | |||
284 | }; // end namespace FbTk | 284 | }; // end namespace FbTk |
285 | 285 | ||
286 | 286 | ||
287 | 287 | ||