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.104 by root, Sat Jul 14 08:27:55 2012 UTC vs.
Revision 1.107 by root, Thu May 22 18:54:33 2014 UTC

6 * Copyright (c) 2012 Marc Lehmann <schmorp@schmorp.de> 6 * Copyright (c) 2012 Marc Lehmann <schmorp@schmorp.de>
7 * Copyright (c) 2012 Emanuele Giaquinta <e.giaquinta@glauco.it> 7 * Copyright (c) 2012 Emanuele Giaquinta <e.giaquinta@glauco.it>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or 11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version. 12 * (at your option) any later version.
13 * 13 *
14 * This program is distributed in the hope that it will be useful, 14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
533 return clone (); 533 return clone ();
534 534
535 Display *dpy = s->dpy; 535 Display *dpy = s->dpy;
536 int size = max (rh, rv) * 2 + 1; 536 int size = max (rh, rv) * 2 + 1;
537 nv *kernel = (nv *)malloc (size * sizeof (nv)); 537 nv *kernel = (nv *)malloc (size * sizeof (nv));
538 XFixed *params = (XFixed *)malloc ((size + 2) * sizeof (XFixed)); 538 XFixed *params = rxvt_temp_buf<XFixed> (size + 2);
539 rxvt_img *img = new_empty (); 539 rxvt_img *img = new_empty ();
540 540
541 XRenderPictureAttributes pa; 541 XRenderPictureAttributes pa;
542 pa.repeat = RepeatPad; 542 pa.repeat = RepeatPad;
543 Picture src = XRenderCreatePicture (dpy, pm, format, CPRepeat, &pa); 543 Picture src = XRenderCreatePicture (dpy, pm, format, CPRepeat, &pa);
578 0, 0, 578 0, 0,
579 w, h); 579 w, h);
580 } 580 }
581 581
582 free (kernel); 582 free (kernel);
583 free (params);
584 583
585 XRenderFreePicture (dpy, src); 584 XRenderFreePicture (dpy, src);
586 XRenderFreePicture (dpy, dst); 585 XRenderFreePicture (dpy, dst);
587 XRenderFreePicture (dpy, tmp); 586 XRenderFreePicture (dpy, tmp);
588 587
915 914
916 return cc; 915 return cc;
917} 916}
918 917
919rxvt_img * 918rxvt_img *
919rxvt_img::shade (nv factor, rgba c)
920{
921 clamp_it (factor, -1., 1.);
922 factor++;
923
924 if (factor > 1)
925 {
926 c.r = c.r * (2 - factor);
927 c.g = c.g * (2 - factor);
928 c.b = c.b * (2 - factor);
929 }
930 else
931 {
932 c.r = c.r * factor;
933 c.g = c.g * factor;
934 c.b = c.b * factor;
935 }
936
937 rxvt_img *img = this->tint (c);
938
939 if (factor > 1)
940 {
941 c.a = 0xffff;
942 c.r =
943 c.g =
944 c.b = 0xffff * (factor - 1);
945
946 img->brightness (c.r, c.g, c.b, c.a);
947 }
948
949 return img;
950}
951
952rxvt_img *
920rxvt_img::filter (const char *name, int nparams, nv *params) 953rxvt_img::filter (const char *name, int nparams, nv *params)
921{ 954{
922 composer cc (this); 955 composer cc (this);
923 956
924 XFixed *xparams = rxvt_temp_buf<XFixed> (nparams); 957 XFixed *xparams = rxvt_temp_buf<XFixed> (nparams);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines