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.76 by root, Sun Jun 10 10:29:26 2012 UTC vs.
Revision 1.79 by root, Tue Jun 12 10:45:53 2012 UTC

50 50
51 return img; 51 return img;
52} 52}
53 53
54# if HAVE_PIXBUF 54# if HAVE_PIXBUF
55
55rxvt_img * 56rxvt_img *
56rxvt_img::new_from_pixbuf (rxvt_screen *s, GdkPixbuf *pb) 57rxvt_img::new_from_pixbuf (rxvt_screen *s, GdkPixbuf *pb)
57{ 58{
58 Display *dpy = s->display->dpy; 59 Display *dpy = s->display->dpy;
59 60
166 167
167 g_object_unref (pb); 168 g_object_unref (pb);
168 169
169 return img; 170 return img;
170} 171}
172
171# endif 173# endif
172 174
173void 175void
174rxvt_img::destroy () 176rxvt_img::destroy ()
175{ 177{
224} 226}
225 227
226void 228void
227rxvt_img::fill (const rxvt_color &c) 229rxvt_img::fill (const rxvt_color &c)
228{ 230{
229 XGCValues gcv; 231 rgba cc;
230 gcv.foreground = c; 232 c.get (cc);
231 GC gc = XCreateGC (s->display->dpy, pm, GCForeground, &gcv); 233 XRenderColor rc = { cc.r, cc.g, cc.b, cc.a };
232 XFillRectangle (s->display->dpy, pm, gc, 0, 0, w, h); 234
233 XFreeGC (s->display->dpy, gc); 235 Display *dpy = s->display->dpy;
236 Picture src = src_picture ();
237 XRenderFillRectangle (dpy, PictOpSrc, src, &rc, 0, 0, w, h);
238 XRenderFreePicture (dpy, src);
234} 239}
235 240
236static void 241static void
237get_gaussian_kernel (int radius, int width, double *kernel, XFixed *params) 242get_gaussian_kernel (int radius, int width, double *kernel, XFixed *params)
238{ 243{
308 w, h); 313 w, h);
309 } 314 }
310 315
311 free (kernel); 316 free (kernel);
312 free (params); 317 free (params);
318
313 XRenderFreePicture (dpy, src); 319 XRenderFreePicture (dpy, src);
314 XRenderFreePicture (dpy, dst); 320 XRenderFreePicture (dpy, dst);
315 XRenderFreePicture (dpy, tmp); 321 XRenderFreePicture (dpy, tmp);
316 322
317 return img; 323 return img;
514 520
515 return img; 521 return img;
516} 522}
517 523
518rxvt_img * 524rxvt_img *
519rxvt_img::transform (int new_width, int new_height, double matrix[9]) 525rxvt_img::transform (double matrix[9], int new_width, int new_height)
520{ 526{
521 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);
522 img->alloc (); 528 img->alloc ();
523 529
524 Display *dpy = s->display->dpy; 530 Display *dpy = s->display->dpy;
555 0, h / (double)new_height, 0, 561 0, h / (double)new_height, 0,
556 0, 0, 1 562 0, 0, 1
557 }; 563 };
558 564
559 int old_repeat_mode = repeat; 565 int old_repeat_mode = repeat;
560 repeat = RepeatPad; // not right, but xrender can't proeprly scale it seems 566 repeat = RepeatPad; // not right, but xrender can't properly scale it seems
561 567
562 rxvt_img *img = transform (new_width, new_height, matrix); 568 rxvt_img *img = transform (matrix, new_width, new_height);
563 569
564 repeat = old_repeat_mode; 570 repeat = old_repeat_mode;
565 img->repeat = repeat; 571 img->repeat = repeat;
566 572
567 return img; 573 return img;
568} 574}
569 575
570rxvt_img * 576rxvt_img *
571rxvt_img::rotate (int new_width, int new_height, int x, int y, double phi) 577rxvt_img::rotate (int x, int y, double phi, int new_width, int new_height)
572{ 578{
573 double s = sin (phi); 579 double s = sin (phi);
574 double c = cos (phi); 580 double c = cos (phi);
575 581
576 double matrix[9] = { 582 double matrix[9] = {
577 c, -s, -c * x + s * y + x, 583 c, -s, -c * x + s * y + x,
578 s, c, -s * x - c * y + y, 584 s, c, -s * x - c * y + y,
579 0, 0, 1 585 0, 0, 1
580 }; 586 };
581 587
582 return transform (new_width, new_height, matrix); 588 return transform (matrix, new_width, new_height);
583} 589}
584 590
585rxvt_img * 591rxvt_img *
586rxvt_img::convert_format (XRenderPictFormat *new_format, const rxvt_color &bg) 592rxvt_img::convert_format (XRenderPictFormat *new_format, const rxvt_color &bg)
587{ 593{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines