--- rxvt-unicode/src/rxvtimg.C 2012/07/14 08:27:55 1.104 +++ rxvt-unicode/src/rxvtimg.C 2014/05/22 18:54:33 1.107 @@ -8,7 +8,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, @@ -535,7 +535,7 @@ Display *dpy = s->dpy; int size = max (rh, rv) * 2 + 1; nv *kernel = (nv *)malloc (size * sizeof (nv)); - XFixed *params = (XFixed *)malloc ((size + 2) * sizeof (XFixed)); + XFixed *params = rxvt_temp_buf (size + 2); rxvt_img *img = new_empty (); XRenderPictureAttributes pa; @@ -580,7 +580,6 @@ } free (kernel); - free (params); XRenderFreePicture (dpy, src); XRenderFreePicture (dpy, dst); @@ -917,6 +916,40 @@ } rxvt_img * +rxvt_img::shade (nv factor, rgba c) +{ + clamp_it (factor, -1., 1.); + factor++; + + if (factor > 1) + { + c.r = c.r * (2 - factor); + c.g = c.g * (2 - factor); + c.b = c.b * (2 - factor); + } + else + { + c.r = c.r * factor; + c.g = c.g * factor; + c.b = c.b * factor; + } + + rxvt_img *img = this->tint (c); + + if (factor > 1) + { + c.a = 0xffff; + c.r = + c.g = + c.b = 0xffff * (factor - 1); + + img->brightness (c.r, c.g, c.b, c.a); + } + + return img; +} + +rxvt_img * rxvt_img::filter (const char *name, int nparams, nv *params) { composer cc (this);