… | |
… | |
425 | |
425 | |
426 | return transform (new_width, new_height, matrix, repeat); |
426 | return transform (new_width, new_height, matrix, repeat); |
427 | } |
427 | } |
428 | |
428 | |
429 | rxvt_img * |
429 | rxvt_img * |
430 | rxvt_img::convert_to (XRenderPictFormat *new_format) |
430 | rxvt_img::convert_to (XRenderPictFormat *new_format, const rxvt_color &bg) |
431 | { |
431 | { |
432 | rxvt_img *img = new rxvt_img (s, new_format, w, h); |
432 | rxvt_img *img = new rxvt_img (s, new_format, w, h); |
433 | |
433 | |
434 | Display *dpy = s->display->dpy; |
434 | Display *dpy = s->display->dpy; |
435 | Picture src = XRenderCreatePicture (dpy, pm, format, 0, 0); |
435 | Picture src = XRenderCreatePicture (dpy, pm, format, 0, 0); |
436 | Picture dst = XRenderCreatePicture (dpy, img->pm, new_format, 0, 0); |
436 | Picture dst = XRenderCreatePicture (dpy, img->pm, new_format, 0, 0); |
|
|
437 | int op = PictOpSrc; |
437 | |
438 | |
|
|
439 | printf ("fa %x,%x fb %x,%x\n", f->direct.alpha, f->direct.alpha_mask, new_format->direct.alpha, new_format->direct.alpha_mask);//D |
|
|
440 | |
|
|
441 | if (f->direct.alpha && !new_format->direct.alpha) |
|
|
442 | { |
|
|
443 | // does it have to be that complicated |
|
|
444 | rgba c; |
|
|
445 | bg.get (c); |
|
|
446 | |
|
|
447 | XRenderColor rc = { c.r, c.g, c.b, 0xffff }; |
|
|
448 | |
|
|
449 | XRenderFillRectangle (dpy, PictOpSrc, dst, &mask_c, 0, 0, w, h); |
|
|
450 | |
|
|
451 | op = PictOpOver; |
|
|
452 | } |
|
|
453 | |
438 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, w, h); |
454 | XRenderComposite (dpy, op, src, None, dst, 0, 0, 0, 0, 0, 0, w, h); |
439 | |
455 | |
440 | XRenderFreePicture (dpy, src); |
456 | XRenderFreePicture (dpy, src); |
441 | XRenderFreePicture (dpy, dst); |
457 | XRenderFreePicture (dpy, dst); |
442 | |
458 | |
443 | return img; |
459 | return img; |