ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtimg.C
(Generate patch)

Comparing rxvt-unicode/src/rxvtimg.C (file contents):
Revision 1.41 by root, Thu Jun 7 11:34:09 2012 UTC vs.
Revision 1.43 by sf-exg, Thu Jun 7 13:02:50 2012 UTC

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}
470} 477}
471 478
472rxvt_img * 479rxvt_img *
473rxvt_img::scale (int new_width, int new_height) 480rxvt_img::scale (int new_width, int new_height)
474{ 481{
482 if (w == new_width && h == new_height)
483 return clone ();
484
475 double matrix[9] = { 485 double matrix[9] = {
476 w / (double)new_width, 0, 0, 486 w / (double)new_width, 0, 0,
477 0, h / (double)new_height, 0, 487 0, h / (double)new_height, 0,
478 0, 0, 1 488 0, 0, 1
479 }; 489 };
480 490
491 int old_repeat_mode = repeat;
492 repeat = RepeatPad; // not right, but xrender can't proeprly scale it seems
493
481 return transform (new_width, new_height, matrix); 494 rxvt_img *img = transform (new_width, new_height, matrix);
495
496 repeat = old_repeat_mode;
497 img->repeat = repeat;
498
499 return img;
482} 500}
483 501
484rxvt_img * 502rxvt_img *
485rxvt_img::rotate (int new_width, int new_height, int x, int y, double phi) 503rxvt_img::rotate (int new_width, int new_height, int x, int y, double phi)
486{ 504{
503 return clone (); 521 return clone ();
504 522
505 rxvt_img *img = new rxvt_img (s, new_format, 0, 0, w, h, repeat); 523 rxvt_img *img = new rxvt_img (s, new_format, 0, 0, w, h, repeat);
506 img->alloc (); 524 img->alloc ();
507 525
526 printf ("convert %d to %d\n", format->direct.alphaMask, new_format->direct.alphaMask);//D
527
508 Display *dpy = s->display->dpy; 528 Display *dpy = s->display->dpy;
509 Picture src = src_picture (); 529 Picture src = src_picture ();
510 Picture dst = XRenderCreatePicture (dpy, img->pm, new_format, 0, 0); 530 Picture dst = XRenderCreatePicture (dpy, img->pm, new_format, 0, 0);
511 int op = PictOpSrc; 531 int op = PictOpSrc;
512 532

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines