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.23 by root, Wed Feb 16 21:37:10 2005 UTC vs.
Revision 1.27 by root, Wed Jan 4 04:42:45 2006 UTC

136 if (flags & XNegative) 136 if (flags & XNegative)
137 x += 100; 137 x += 100;
138 if (flags & YNegative) 138 if (flags & YNegative)
139 y += 100; 139 y += 100;
140 } 140 }
141 MIN_IT (x, 100); 141 min_it (x, 100);
142 MIN_IT (y, 100); 142 min_it (y, 100);
143 MAX_IT (x, 0); 143 max_it (x, 0);
144 MAX_IT (y, 0); 144 max_it (y, 0);
145 if (bgpixmap->x != x) 145 if (bgpixmap->x != x)
146 { 146 {
147 bgpixmap->x = x; 147 bgpixmap->x = x;
148 changed++; 148 changed++;
149 } 149 }
158} 158}
159 159
160void 160void
161rxvt_term::resize_pixmap () 161rxvt_term::resize_pixmap ()
162{ 162{
163 XGCValues gcvalue; 163 XGCValues gcvalue;
164 GC gc; 164 GC gc;
165 unsigned int width = TermWin_TotalWidth ();
166 unsigned int height = TermWin_TotalHeight ();
167 dDisp; 165 dDisp;
168 166
169 if (TermWin.pixmap != None) 167 if (pixmap != None)
170 XFreePixmap (disp, TermWin.pixmap); 168 XFreePixmap (disp, pixmap);
171 169
172 if (bgPixmap.pixmap == None) 170 if (bgPixmap.pixmap == None)
173 { /* So be it: I'm not using pixmaps */ 171 { /* So be it: I'm not using pixmaps */
174 TermWin.pixmap = None; 172 pixmap = None;
175 173
176 if (!(options & Opt_transparent) || !am_transparent) 174 if (!OPTION (Opt_transparent) || !am_transparent)
177 XSetWindowBackground (disp, TermWin.vt, 175 XSetWindowBackground (disp, vt, pix_colors[Color_bg]);
178 pix_colors[Color_bg]);
179 176
180 return; 177 return;
181 } 178 }
182 179
183 gcvalue.foreground = pix_colors[Color_bg]; 180 gcvalue.foreground = pix_colors[Color_bg];
184 gc = XCreateGC (disp, TermWin.vt, GCForeground, &gcvalue); 181 gc = XCreateGC (disp, vt, GCForeground, &gcvalue);
185 182
186 if (bgPixmap.pixmap != None) 183 if (bgPixmap.pixmap != None)
187 { /* we have a specified pixmap */ 184 { /* we have a specified pixmap */
188 unsigned int w = bgPixmap.w, h = bgPixmap.h, 185 unsigned int w = bgPixmap.w, h = bgPixmap.h,
189 x = bgPixmap.x, y = bgPixmap.y; 186 x = bgPixmap.x, y = bgPixmap.y;
200 w = 0; /* tile */ 197 w = 0; /* tile */
201 198
202 if (w == 0) 199 if (w == 0)
203 { 200 {
204 /* basic X tiling - let the X server do it */ 201 /* basic X tiling - let the X server do it */
205 TermWin.pixmap = XCreatePixmap (disp, TermWin.vt, 202 pixmap = XCreatePixmap (disp, vt, xpmw, xpmh,
206 xpmw, xpmh,
207 (unsigned int)display->depth); 203 (unsigned int)display->depth);
208 XCopyArea (disp, bgPixmap.pixmap, TermWin.pixmap, gc, 204 XCopyArea (disp, bgPixmap.pixmap, pixmap, gc,
209 0, 0, xpmw, xpmh, 0, 0); 205 0, 0, xpmw, xpmh, 0, 0);
210 } 206 }
211 else 207 else
212 { 208 {
213 float incr, p; 209 float incr, p;
214 Pixmap tmp; 210 Pixmap tmp;
215 211
216 TermWin.pixmap = XCreatePixmap (disp, TermWin.vt, 212 pixmap = XCreatePixmap (disp, vt, width, height,
217 width, height,
218 (unsigned int)display->depth); 213 (unsigned int)display->depth);
219 /* 214 /*
220 * horizontal scaling 215 * horizontal scaling
221 */ 216 */
222 rxvt_pixmap_incr (&w, &x, &incr, &p, width, xpmw); 217 rxvt_pixmap_incr (&w, &x, &incr, &p, width, xpmw);
223 218
224 tmp = XCreatePixmap (disp, TermWin.vt, 219 tmp = XCreatePixmap (disp, vt, width, xpmh, (unsigned int)display->depth);
225 width, xpmh, (unsigned int)display->depth);
226 XFillRectangle (disp, tmp, gc, 0, 0, width, 220 XFillRectangle (disp, tmp, gc, 0, 0, width, xpmh);
227 xpmh);
228 221
229 for ( /*nil */ ; x < w; x++, p += incr) 222 for ( /*nil */ ; x < w; x++, p += incr)
230 { 223 {
231 if (p >= xpmw) 224 if (p >= xpmw)
232 p = 0; 225 p = 0;
239 * vertical scaling 232 * vertical scaling
240 */ 233 */
241 rxvt_pixmap_incr (&h, &y, &incr, &p, height, xpmh); 234 rxvt_pixmap_incr (&h, &y, &incr, &p, height, xpmh);
242 235
243 if (y > 0) 236 if (y > 0)
244 XFillRectangle (disp, TermWin.pixmap, gc, 0, 0, width, y); 237 XFillRectangle (disp, pixmap, gc, 0, 0, width, y);
245 238
246 if (h < height) 239 if (h < height)
247 XFillRectangle (disp, TermWin.pixmap, gc, 0, (int)h, width, height - h + 1); 240 XFillRectangle (disp, pixmap, gc, 0, (int)h, width, height - h + 1);
248 241
249 for ( /*nil */ ; y < h; y++, p += incr) 242 for ( /*nil */ ; y < h; y++, p += incr)
250 { 243 {
251 if (p >= xpmh) 244 if (p >= xpmh)
252 p = 0; 245 p = 0;
253 246
254 /* copy one row from the tmp pixmap to the main pixmap */ 247 /* copy one row from the tmp pixmap to the main pixmap */
255 XCopyArea (disp, tmp, TermWin.pixmap, gc, 248 XCopyArea (disp, tmp, pixmap, gc,
256 0, (int)p, width, 1, 0, (int)y); 249 0, (int)p, width, 1, 0, (int)y);
257 } 250 }
258 251
259 XFreePixmap (disp, tmp); 252 XFreePixmap (disp, tmp);
260 } 253 }
261 } 254 }
262 255
263 XSetWindowBackgroundPixmap (disp, TermWin.vt, TermWin.pixmap); 256 XSetWindowBackgroundPixmap (disp, vt, pixmap);
264 XFreeGC (disp, gc); 257 XFreeGC (disp, gc);
265 am_transparent = 0; 258 am_transparent = 0;
266} 259}
267 260
268/* 261/*
352 { 345 {
353 XFreePixmap (display->display, bgPixmap.pixmap); 346 XFreePixmap (display->display, bgPixmap.pixmap);
354 bgPixmap.pixmap = None; 347 bgPixmap.pixmap = None;
355 } 348 }
356 349
357 XSetWindowBackground (display->display, TermWin.vt, pix_colors[Color_bg]); 350 XSetWindowBackground (display->display, vt, pix_colors[Color_bg]);
358 351
359 if (*file != '\0') 352 if (*file != '\0')
360 { 353 {
361 /* XWindowAttributes attr; */ 354 /* XWindowAttributes attr; */
362 355
363 /* 356 /*
364 * we already have the required attributes 357 * we already have the required attributes
365 */ 358 */
366 /* XGetWindowAttributes (display->display, TermWin.vt, &attr); */ 359 /* XGetWindowAttributes (display->display, vt, &attr); */
367 360
368 xpmAttr.closeness = 30000; 361 xpmAttr.closeness = 30000;
369 xpmAttr.colormap = display->cmap; 362 xpmAttr.colormap = display->cmap;
370 xpmAttr.visual = display->visual; 363 xpmAttr.visual = display->visual;
371 xpmAttr.depth = display->depth; 364 xpmAttr.depth = display->depth;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines