… | |
… | |
13 | rxvt_img::rxvt_img (const rxvt_img &img) |
13 | rxvt_img::rxvt_img (const rxvt_img &img) |
14 | : s(img.s), x(img.x), y(img.y), w(img.w), h(img.h), format(img.format), repeat(img.repeat), pm(img.pm), ref(img.ref) |
14 | : s(img.s), x(img.x), y(img.y), w(img.w), h(img.h), format(img.format), repeat(img.repeat), pm(img.pm), ref(img.ref) |
15 | { |
15 | { |
16 | ++ref->cnt; |
16 | ++ref->cnt; |
17 | } |
17 | } |
18 | |
|
|
19 | #if 0 |
|
|
20 | rxvt_img::rxvt_img (rxvt_screen *screen, XRenderPictFormat *format, int width, int height, Pixmap pixmap) |
|
|
21 | : s(screen), x(0), y(0), w(width), h(height), format(format), repeat(RepeatNormal), shared(false), pm(pixmap) |
|
|
22 | { |
|
|
23 | } |
|
|
24 | #endif |
|
|
25 | |
18 | |
26 | rxvt_img * |
19 | rxvt_img * |
27 | rxvt_img::new_from_root (rxvt_screen *s) |
20 | rxvt_img::new_from_root (rxvt_screen *s) |
28 | { |
21 | { |
29 | Display *dpy = s->display->dpy; |
22 | Display *dpy = s->display->dpy; |
… | |
… | |
272 | double *kernel = (double *)malloc (size * sizeof (double)); |
265 | double *kernel = (double *)malloc (size * sizeof (double)); |
273 | XFixed *params = (XFixed *)malloc ((size + 2) * sizeof (XFixed)); |
266 | XFixed *params = (XFixed *)malloc ((size + 2) * sizeof (XFixed)); |
274 | rxvt_img *img = new rxvt_img (s, format, x, y, w, h, repeat); |
267 | rxvt_img *img = new rxvt_img (s, format, x, y, w, h, repeat); |
275 | img->alloc (); |
268 | img->alloc (); |
276 | |
269 | |
277 | Picture src = src_picture (); |
|
|
278 | |
|
|
279 | XRenderPictureAttributes pa; |
270 | XRenderPictureAttributes pa; |
280 | pa.repeat = RepeatPad; |
271 | pa.repeat = RepeatPad; |
281 | Picture dst = XRenderCreatePicture (dpy, img->pm, format, CPRepeat, &pa); |
272 | Picture src = XRenderCreatePicture (dpy, pm, format, CPRepeat, &pa); |
|
|
273 | Picture dst = XRenderCreatePicture (dpy, img->pm, format, 0, 0); |
282 | |
274 | |
283 | Pixmap tmp_pm = XCreatePixmap (dpy, pm, w, h, format->depth); |
275 | Pixmap tmp_pm = XCreatePixmap (dpy, pm, w, h, format->depth); |
284 | Picture tmp = XRenderCreatePicture (dpy, tmp_pm , format, CPRepeat, &pa); |
276 | Picture tmp = XRenderCreatePicture (dpy, tmp_pm , format, CPRepeat, &pa); |
285 | XFreePixmap (dpy, tmp_pm); |
277 | XFreePixmap (dpy, tmp_pm); |
286 | |
278 | |
… | |
… | |
302 | |
294 | |
303 | size = rv * 2 + 1; |
295 | size = rv * 2 + 1; |
304 | get_gaussian_kernel (rv, size, kernel, params); |
296 | get_gaussian_kernel (rv, size, kernel, params); |
305 | ::swap (params[0], params[1]); |
297 | ::swap (params[0], params[1]); |
306 | |
298 | |
307 | XRenderSetPictureFilter (dpy, src, FilterConvolution, params, size+2); |
299 | XRenderSetPictureFilter (dpy, tmp, FilterConvolution, params, size+2); |
308 | XRenderComposite (dpy, |
300 | XRenderComposite (dpy, |
309 | PictOpSrc, |
301 | PictOpSrc, |
310 | tmp, |
302 | tmp, |
311 | None, |
303 | None, |
312 | dst, |
304 | dst, |