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.18 by sf-exg, Tue Jun 5 12:30:37 2012 UTC vs.
Revision 1.19 by root, Tue Jun 5 13:39:26 2012 UTC

310} 310}
311 311
312rxvt_img * 312rxvt_img *
313rxvt_img::clone () 313rxvt_img::clone ()
314{ 314{
315 rxvt_img *img = new rxvt_img (s, format, w, h);
316
315 GC gc = XCreateGC (s->display->dpy, pm, 0, 0); 317 GC gc = XCreateGC (s->display->dpy, pm, 0, 0);
316 Pixmap pm2 = XCreatePixmap (s->display->dpy, pm, w, h, format->depth);
317 XCopyArea (s->display->dpy, pm, pm2, gc, 0, 0, w, h, 0, 0); 318 XCopyArea (s->display->dpy, pm, img->pm, gc, 0, 0, w, h, 0, 0);
318 XFreeGC (s->display->dpy, gc); 319 XFreeGC (s->display->dpy, gc);
319 return new rxvt_img (s, format, w, h, pm2);
320} 320}
321 321
322rxvt_img * 322rxvt_img *
323rxvt_img::sub_rect (int x, int y, int width, int height, int repeat)
324{
325 rxvt_img *img = new rxvt_img (s, format, width, height);
326
327 Display *dpy = s->display->dpy;
328 XRenderPictureAttributes pa;
329 pa.repeat = repeat;
330 Picture src = XRenderCreatePicture (dpy, pm, format, CPRepeat, &pa);
331 Picture dst = XRenderCreatePicture (dpy, img->pm, img->format, 0, 0);
332
333 XRenderComposite (dpy, PictOpSrc, src, None, dst, x, y, 0, 0, 0, 0, width, height);
334
335 XRenderFreePicture (dpy, src);
336 XRenderFreePicture (dpy, dst);
337
338 return img;
339}
340
341rxvt_img *
323rxvt_img::transform (int new_width, int new_height, int repeat, double matrix[9]) 342rxvt_img::transform (int new_width, int new_height, double matrix[9], int repeat)
324{ 343{
325 rxvt_img *img = new rxvt_img (s, format, new_width, new_height); 344 rxvt_img *img = new rxvt_img (s, format, new_width, new_height);
326 345
327 Display *dpy = s->display->dpy; 346 Display *dpy = s->display->dpy;
328 XRenderPictureAttributes pa; 347 XRenderPictureAttributes pa;
353 w / (double)new_width, 0, 0, 372 w / (double)new_width, 0, 0,
354 0, h / (double)new_height, 0, 373 0, h / (double)new_height, 0,
355 0, 0, 1 374 0, 0, 1
356 }; 375 };
357 376
358 return transform (new_width, new_height, RepeatNormal, matrix); 377 return transform (new_width, new_height, matrix);
359} 378}
360 379
361rxvt_img * 380rxvt_img *
362rxvt_img::rotate (int new_width, int new_height, int repeat, int x, int y, double phi) 381rxvt_img::rotate (int new_width, int new_height, int x, int y, double phi, int repeat)
363{ 382{
364 double s = sin (phi); 383 double s = sin (phi);
365 double c = cos (phi); 384 double c = cos (phi);
366 385
367 double matrix[9] = { 386 double matrix[9] = {
368 c, -s, -c * x + s * y + x, 387 c, -s, -c * x + s * y + x,
369 s, c, -s * x - c * y + y, 388 s, c, -s * x - c * y + y,
370 0, 0, 1 389 0, 0, 1
371 }; 390 };
372 391
373 return transform (new_width, new_height, repeat, matrix); 392 return transform (new_width, new_height, matrix, repeat);
374} 393}
375 394
376rxvt_img * 395rxvt_img *
377rxvt_img::convert_to (XRenderPictFormat *new_format) 396rxvt_img::convert_to (XRenderPictFormat *new_format)
378{ 397{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines