… | |
… | |
520 | |
520 | |
521 | return img; |
521 | return img; |
522 | } |
522 | } |
523 | |
523 | |
524 | rxvt_img * |
524 | rxvt_img * |
525 | rxvt_img::transform (int new_width, int new_height, double matrix[9]) |
525 | rxvt_img::transform (double matrix[9], int new_width, int new_height) |
526 | { |
526 | { |
527 | rxvt_img *img = new rxvt_img (s, format, 0, 0, new_width, new_height, repeat); |
527 | rxvt_img *img = new rxvt_img (s, format, 0, 0, new_width, new_height, repeat); |
528 | img->alloc (); |
528 | img->alloc (); |
529 | |
529 | |
530 | Display *dpy = s->display->dpy; |
530 | Display *dpy = s->display->dpy; |
… | |
… | |
563 | }; |
563 | }; |
564 | |
564 | |
565 | int old_repeat_mode = repeat; |
565 | int old_repeat_mode = repeat; |
566 | repeat = RepeatPad; // not right, but xrender can't properly scale it seems |
566 | repeat = RepeatPad; // not right, but xrender can't properly scale it seems |
567 | |
567 | |
568 | rxvt_img *img = transform (new_width, new_height, matrix); |
568 | rxvt_img *img = transform (matrix, new_width, new_height); |
569 | |
569 | |
570 | repeat = old_repeat_mode; |
570 | repeat = old_repeat_mode; |
571 | img->repeat = repeat; |
571 | img->repeat = repeat; |
572 | |
572 | |
573 | return img; |
573 | return img; |
574 | } |
574 | } |
575 | |
575 | |
576 | rxvt_img * |
576 | rxvt_img * |
577 | rxvt_img::rotate (int new_width, int new_height, int x, int y, double phi) |
577 | rxvt_img::rotate (int x, int y, double phi, int new_width, int new_height) |
578 | { |
578 | { |
579 | double s = sin (phi); |
579 | double s = sin (phi); |
580 | double c = cos (phi); |
580 | double c = cos (phi); |
581 | |
581 | |
582 | double matrix[9] = { |
582 | double matrix[9] = { |
583 | c, -s, -c * x + s * y + x, |
583 | c, -s, -c * x + s * y + x, |
584 | s, c, -s * x - c * y + y, |
584 | s, c, -s * x - c * y + y, |
585 | 0, 0, 1 |
585 | 0, 0, 1 |
586 | }; |
586 | }; |
587 | |
587 | |
588 | return transform (new_width, new_height, matrix); |
588 | return transform (matrix, new_width, new_height); |
589 | } |
589 | } |
590 | |
590 | |
591 | rxvt_img * |
591 | rxvt_img * |
592 | rxvt_img::convert_format (XRenderPictFormat *new_format, const rxvt_color &bg) |
592 | rxvt_img::convert_format (XRenderPictFormat *new_format, const rxvt_color &bg) |
593 | { |
593 | { |