… | |
… | |
409 | img->alloc (); |
409 | img->alloc (); |
410 | |
410 | |
411 | Picture src = src_picture (); |
411 | Picture src = src_picture (); |
412 | Picture dst = XRenderCreatePicture (dpy, img->pm, img->format, 0, 0); |
412 | Picture dst = XRenderCreatePicture (dpy, img->pm, img->format, 0, 0); |
413 | |
413 | |
|
|
414 | if (alpha) |
|
|
415 | { |
|
|
416 | XRenderColor rc = { 0, 0, 0, 0 }; |
|
|
417 | XRenderFillRectangle (dpy, PictOpSrc, dst, &rc, 0, 0, w, h); |
|
|
418 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, -x, -y, ref->w, ref->h); |
|
|
419 | } |
|
|
420 | else |
414 | XRenderComposite (dpy, PictOpSrc, src, None, dst, x, y, 0, 0, 0, 0, w, h); |
421 | XRenderComposite (dpy, PictOpSrc, src, None, dst, x, y, 0, 0, 0, 0, w, h); |
415 | |
422 | |
416 | XRenderFreePicture (dpy, src); |
423 | XRenderFreePicture (dpy, src); |
417 | XRenderFreePicture (dpy, dst); |
424 | XRenderFreePicture (dpy, dst); |
418 | |
425 | |
419 | return img; |
426 | return img; |
420 | } |
427 | } |
… | |
… | |
476 | w / (double)new_width, 0, 0, |
483 | w / (double)new_width, 0, 0, |
477 | 0, h / (double)new_height, 0, |
484 | 0, h / (double)new_height, 0, |
478 | 0, 0, 1 |
485 | 0, 0, 1 |
479 | }; |
486 | }; |
480 | |
487 | |
|
|
488 | int old_repeat_mode = repeat; |
|
|
489 | repeat = RepeatPad; // not right, but xrender can't proeprly scale it seems |
|
|
490 | |
481 | return transform (new_width, new_height, matrix); |
491 | rxvt_img *img = transform (new_width, new_height, matrix); |
|
|
492 | |
|
|
493 | repeat = old_repeat_mode; |
|
|
494 | img->repeat = repeat; |
|
|
495 | |
|
|
496 | return img; |
482 | } |
497 | } |
483 | |
498 | |
484 | rxvt_img * |
499 | rxvt_img * |
485 | rxvt_img::rotate (int new_width, int new_height, int x, int y, double phi) |
500 | rxvt_img::rotate (int new_width, int new_height, int x, int y, double phi) |
486 | { |
501 | { |
… | |
… | |
503 | return clone (); |
518 | return clone (); |
504 | |
519 | |
505 | rxvt_img *img = new rxvt_img (s, new_format, 0, 0, w, h, repeat); |
520 | rxvt_img *img = new rxvt_img (s, new_format, 0, 0, w, h, repeat); |
506 | img->alloc (); |
521 | img->alloc (); |
507 | |
522 | |
|
|
523 | printf ("convert %d to %d\n", format->direct.alphaMask, new_format->direct.alphaMask);//D |
|
|
524 | |
508 | Display *dpy = s->display->dpy; |
525 | Display *dpy = s->display->dpy; |
509 | Picture src = src_picture (); |
526 | Picture src = src_picture (); |
510 | Picture dst = XRenderCreatePicture (dpy, img->pm, new_format, 0, 0); |
527 | Picture dst = XRenderCreatePicture (dpy, img->pm, new_format, 0, 0); |
511 | int op = PictOpSrc; |
528 | int op = PictOpSrc; |
512 | |
529 | |