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.16 by root, Mon Jun 4 16:12:55 2012 UTC vs.
Revision 1.17 by root, Mon Jun 4 18:17:25 2012 UTC

101 XFixed *params = (XFixed *)malloc ((size + 2) * sizeof (XFixed)); 101 XFixed *params = (XFixed *)malloc ((size + 2) * sizeof (XFixed));
102 102
103 XRenderPictureAttributes pa; 103 XRenderPictureAttributes pa;
104 104
105 pa.repeat = RepeatPad; 105 pa.repeat = RepeatPad;
106 Picture src = XRenderCreatePicture (dpy, pm, format, CPRepeat, &pa); 106 Picture src = XRenderCreatePicture (dpy, pm , format, CPRepeat, &pa);
107 Pixmap tmp = XCreatePixmap (dpy, pm, w, h, format->depth); 107 Pixmap tmp = XCreatePixmap (dpy, pm, w, h, format->depth);
108 Picture dst = XRenderCreatePicture (dpy, tmp, format, CPRepeat, &pa); 108 Picture dst = XRenderCreatePicture (dpy, tmp, format, CPRepeat, &pa);
109 XFreePixmap (dpy, tmp); 109 XFreePixmap (dpy, tmp);
110 110
111 if (kernel && params) 111 if (kernel && params)
346 346
347 for (int i = 0; i < 3; ++i) 347 for (int i = 0; i < 3; ++i)
348 for (int j = 0; j < 3; ++j) 348 for (int j = 0; j < 3; ++j)
349 xfrm.matrix [i][j] = XDoubleToFixed (matrix [i * 3 + j]); 349 xfrm.matrix [i][j] = XDoubleToFixed (matrix [i * 3 + j]);
350 350
351 XRenderSetPictureFilter (dpy, src, "good", 0, 0);
351 XRenderSetPictureTransform (dpy, src, &xfrm); 352 XRenderSetPictureTransform (dpy, src, &xfrm);
352 XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, new_width, new_height); 353 XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, new_width, new_height);
353 354
354 XRenderFreePicture (dpy, src); 355 XRenderFreePicture (dpy, src);
355 XRenderFreePicture (dpy, dst); 356 XRenderFreePicture (dpy, dst);
368 369
369 return transform (new_width, new_height, RepeatNormal, matrix); 370 return transform (new_width, new_height, RepeatNormal, matrix);
370} 371}
371 372
372rxvt_img * 373rxvt_img *
374rxvt_img::rotate (int new_width, int new_height, int repeat, int x, int y, double phi)
375{
376 double s = sin (phi);
377 double c = cos (phi);
378
379 double matrix[9] = {
380 c, -s, -c * x + s * y + x,
381 s, c, -s * x - c * y + y,
382 0, 0, 1
383 };
384
385 return transform (new_width, new_height, repeat, matrix);
386}
387
388rxvt_img *
373rxvt_img::convert_to (XRenderPictFormat *new_format) 389rxvt_img::convert_to (XRenderPictFormat *new_format)
374{ 390{
375 rxvt_img *img = new rxvt_img (s, new_format, w, h); 391 rxvt_img *img = new rxvt_img (s, new_format, w, h);
376 392
377 Display *dpy = s->display->dpy; 393 Display *dpy = s->display->dpy;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines