ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/xpm.C
(Generate patch)

Comparing rxvt-unicode/src/xpm.C (file contents):
Revision 1.20 by root, Wed Jan 26 07:08:15 2005 UTC vs.
Revision 1.21 by root, Fri Feb 4 11:41:23 2005 UTC

161{ 161{
162 XGCValues gcvalue; 162 XGCValues gcvalue;
163 GC gc; 163 GC gc;
164 unsigned int width = TermWin_TotalWidth (); 164 unsigned int width = TermWin_TotalWidth ();
165 unsigned int height = TermWin_TotalHeight (); 165 unsigned int height = TermWin_TotalHeight ();
166 dDisp;
166 167
167 if (TermWin.pixmap != None) 168 if (TermWin.pixmap != None)
168 XFreePixmap (display->display, TermWin.pixmap); 169 XFreePixmap (disp, TermWin.pixmap);
169 170
170 if (bgPixmap.pixmap == None) 171 if (bgPixmap.pixmap == None)
171 { /* So be it: I'm not using pixmaps */ 172 { /* So be it: I'm not using pixmaps */
172 TermWin.pixmap = None; 173 TermWin.pixmap = None;
173 174
174 if (!(options & Opt_transparent) || !am_transparent) 175 if (!(options & Opt_transparent) || !am_transparent)
175 XSetWindowBackground (display->display, TermWin.vt, 176 XSetWindowBackground (disp, TermWin.vt,
176 pix_colors[Color_bg]); 177 pix_colors[Color_bg]);
177 178
178 return; 179 return;
179 } 180 }
180 181
181 gcvalue.foreground = pix_colors[Color_bg]; 182 gcvalue.foreground = pix_colors[Color_bg];
182 gc = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); 183 gc = XCreateGC (disp, TermWin.vt, GCForeground, &gcvalue);
183 184
184 if (bgPixmap.pixmap != None) 185 if (bgPixmap.pixmap != None)
185 { /* we have a specified pixmap */ 186 { /* we have a specified pixmap */
186 unsigned int w = bgPixmap.w, h = bgPixmap.h, 187 unsigned int w = bgPixmap.w, h = bgPixmap.h,
187 x = bgPixmap.x, y = bgPixmap.y; 188 x = bgPixmap.x, y = bgPixmap.y;
198 w = 0; /* tile */ 199 w = 0; /* tile */
199 200
200 if (w == 0) 201 if (w == 0)
201 { 202 {
202 /* basic X tiling - let the X server do it */ 203 /* basic X tiling - let the X server do it */
203 TermWin.pixmap = XCreatePixmap (display->display, TermWin.vt, 204 TermWin.pixmap = XCreatePixmap (disp, TermWin.vt,
204 xpmw, xpmh, 205 xpmw, xpmh,
205 (unsigned int)display->depth); 206 (unsigned int)display->depth);
206 XCopyArea (display->display, bgPixmap.pixmap, TermWin.pixmap, gc, 207 XCopyArea (disp, bgPixmap.pixmap, TermWin.pixmap, gc,
207 0, 0, xpmw, xpmh, 0, 0); 208 0, 0, xpmw, xpmh, 0, 0);
208 } 209 }
209 else 210 else
210 { 211 {
211 float incr, p; 212 float incr, p;
212 Pixmap tmp; 213 Pixmap tmp;
213 214
214 TermWin.pixmap = XCreatePixmap (display->display, TermWin.vt, 215 TermWin.pixmap = XCreatePixmap (disp, TermWin.vt,
215 width, height, 216 width, height,
216 (unsigned int)display->depth); 217 (unsigned int)display->depth);
217 /* 218 /*
218 * horizontal scaling 219 * horizontal scaling
219 */ 220 */
220 rxvt_pixmap_incr (&w, &x, &incr, &p, width, xpmw); 221 rxvt_pixmap_incr (&w, &x, &incr, &p, width, xpmw);
221 222
222 tmp = XCreatePixmap (display->display, TermWin.vt, 223 tmp = XCreatePixmap (disp, TermWin.vt,
223 width, xpmh, (unsigned int)display->depth); 224 width, xpmh, (unsigned int)display->depth);
224 XFillRectangle (display->display, tmp, gc, 0, 0, width, 225 XFillRectangle (disp, tmp, gc, 0, 0, width,
225 xpmh); 226 xpmh);
226 227
227 for ( /*nil */ ; x < w; x++, p += incr) 228 for ( /*nil */ ; x < w; x++, p += incr)
228 { 229 {
229 if (p >= xpmw) 230 if (p >= xpmw)
230 p = 0; 231 p = 0;
231 /* copy one column from the original pixmap to the tmp pixmap */ 232 /* copy one column from the original pixmap to the tmp pixmap */
232 XCopyArea (display->display, bgPixmap.pixmap, tmp, gc, 233 XCopyArea (disp, bgPixmap.pixmap, tmp, gc,
233 (int)p, 0, 1, xpmh, (int)x, 0); 234 (int)p, 0, 1, xpmh, (int)x, 0);
234 } 235 }
235 236
236 /* 237 /*
237 * vertical scaling 238 * vertical scaling
238 */ 239 */
239 rxvt_pixmap_incr (&h, &y, &incr, &p, height, xpmh); 240 rxvt_pixmap_incr (&h, &y, &incr, &p, height, xpmh);
240 241
241 if (y > 0) 242 if (y > 0)
242 XFillRectangle (display->display, TermWin.pixmap, gc, 0, 0, width, y); 243 XFillRectangle (disp, TermWin.pixmap, gc, 0, 0, width, y);
243 244
244 if (h < height) 245 if (h < height)
245 XFillRectangle (display->display, TermWin.pixmap, gc, 0, (int)h, width, height - h + 1); 246 XFillRectangle (disp, TermWin.pixmap, gc, 0, (int)h, width, height - h + 1);
246 247
247 for ( /*nil */ ; y < h; y++, p += incr) 248 for ( /*nil */ ; y < h; y++, p += incr)
248 { 249 {
249 if (p >= xpmh) 250 if (p >= xpmh)
250 p = 0; 251 p = 0;
251 252
252 /* copy one row from the tmp pixmap to the main pixmap */ 253 /* copy one row from the tmp pixmap to the main pixmap */
253 XCopyArea (display->display, tmp, TermWin.pixmap, gc, 254 XCopyArea (disp, tmp, TermWin.pixmap, gc,
254 0, (int)p, width, 1, 0, (int)y); 255 0, (int)p, width, 1, 0, (int)y);
255 } 256 }
256 257
257 XFreePixmap (display->display, tmp); 258 XFreePixmap (disp, tmp);
258 } 259 }
259 } 260 }
260 261
261 XSetWindowBackgroundPixmap (display->display, TermWin.vt, TermWin.pixmap); 262 XSetWindowBackgroundPixmap (disp, TermWin.vt, TermWin.pixmap);
262 XFreeGC (display->display, gc); 263 XFreeGC (disp, gc);
263 am_transparent = 0; 264 am_transparent = 0;
264} 265}
265 266
266/* 267/*
267 * Calculate tiling sizes and increments 268 * Calculate tiling sizes and increments
341} 342}
342 343
343Pixmap 344Pixmap
344rxvt_term::set_bgPixmap (const char *file) 345rxvt_term::set_bgPixmap (const char *file)
345{ 346{
346 char *f; 347 char *f;
347 348
348 assert (file != NULL); 349 assert (file != NULL);
349 350
350 if (bgPixmap.pixmap != None) 351 if (bgPixmap.pixmap != None)
351 { 352 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines