… | |
… | |
113 | Display *dpy = s->display->dpy; |
113 | Display *dpy = s->display->dpy; |
114 | |
114 | |
115 | XRenderPictureAttributes pa; |
115 | XRenderPictureAttributes pa; |
116 | pa.repeat = repeat; |
116 | pa.repeat = repeat; |
117 | Picture pic = XRenderCreatePicture (dpy, pm, format, CPRepeat, &pa); |
117 | Picture pic = XRenderCreatePicture (dpy, pm, format, CPRepeat, &pa); |
118 | |
|
|
119 | XRectangle clip = { -x, -y, min (w, ref->w), min (h, ref->h) }; |
|
|
120 | XRenderSetPictureClipRectangles (dpy, pic, 0, 0, &clip, 1); |
|
|
121 | |
118 | |
122 | return pic; |
119 | return pic; |
123 | } |
120 | } |
124 | |
121 | |
125 | void |
122 | void |
… | |
… | |
397 | } |
394 | } |
398 | |
395 | |
399 | rxvt_img * |
396 | rxvt_img * |
400 | rxvt_img::reify () |
397 | rxvt_img::reify () |
401 | { |
398 | { |
402 | rxvt_img *img = new rxvt_img (s, format, 0, 0, w, h); |
399 | if (x == 0 && y == 0 && w == ref->w && h == ref->h) |
|
|
400 | return clone (); |
|
|
401 | |
|
|
402 | Display *dpy = s->display->dpy; |
|
|
403 | |
|
|
404 | bool alpha = !format->direct.alphaMask |
|
|
405 | && (x || y) |
|
|
406 | && repeat == RepeatNone; |
|
|
407 | |
|
|
408 | rxvt_img *img = new rxvt_img (s, alpha ? XRenderFindStandardFormat (dpy, PictStandardARGB32) : format, 0, 0, w, h); |
403 | img->alloc (); |
409 | img->alloc (); |
404 | |
|
|
405 | // todo, if x==0 and y==0 and w==real width we could clone |
|
|
406 | // but that involves an rtt to find pixmap width. |
|
|
407 | |
|
|
408 | Display *dpy = s->display->dpy; |
|
|
409 | |
410 | |
410 | Picture src = src_picture (); |
411 | Picture src = src_picture (); |
411 | Picture dst = XRenderCreatePicture (dpy, img->pm, img->format, 0, 0); |
412 | Picture dst = XRenderCreatePicture (dpy, img->pm, img->format, 0, 0); |
412 | |
413 | |
413 | XRenderComposite (dpy, PictOpSrc, src, None, dst, x, y, 0, 0, 0, 0, w, h); |
414 | XRenderComposite (dpy, PictOpSrc, src, None, dst, x, y, 0, 0, 0, 0, w, h); |
… | |
… | |
421 | rxvt_img * |
422 | rxvt_img * |
422 | rxvt_img::sub_rect (int x, int y, int width, int height) |
423 | rxvt_img::sub_rect (int x, int y, int width, int height) |
423 | { |
424 | { |
424 | rxvt_img *img = clone (); |
425 | rxvt_img *img = clone (); |
425 | |
426 | |
426 | //TODO: width > w, must reify |
|
|
427 | |
|
|
428 | img->x += x; |
427 | img->x += x; |
429 | img->y += y; |
428 | img->y += y; |
|
|
429 | |
|
|
430 | if (w != width || h != height) |
|
|
431 | { |
430 | img->w = width; |
432 | img->w = width; |
431 | img->h = height; |
433 | img->h = height; |
|
|
434 | |
|
|
435 | rxvt_img *img2 = img->reify (); |
|
|
436 | delete img; |
|
|
437 | img = img2; |
|
|
438 | } |
432 | |
439 | |
433 | return img; |
440 | return img; |
434 | } |
441 | } |
435 | |
442 | |
436 | rxvt_img * |
443 | rxvt_img * |
… | |
… | |
526 | rxvt_img * |
533 | rxvt_img * |
527 | rxvt_img::blend (rxvt_img *img, double factor) |
534 | rxvt_img::blend (rxvt_img *img, double factor) |
528 | { |
535 | { |
529 | rxvt_img *img2 = clone (); |
536 | rxvt_img *img2 = clone (); |
530 | Display *dpy = s->display->dpy; |
537 | Display *dpy = s->display->dpy; |
531 | Picture src = src_picture (); |
538 | Picture src = img->src_picture (); |
532 | Picture dst = XRenderCreatePicture (dpy, img2->pm, img2->format, 0, 0); |
539 | Picture dst = XRenderCreatePicture (dpy, img2->pm, img2->format, 0, 0); |
533 | Picture mask = create_xrender_mask (dpy, img->pm, False); |
540 | Picture mask = create_xrender_mask (dpy, img->pm, False); |
534 | |
541 | |
535 | XRenderColor mask_c; |
542 | XRenderColor mask_c; |
536 | |
543 | |