--- rxvt-unicode/src/rxvtimg.C 2012/06/06 20:55:36 1.29 +++ rxvt-unicode/src/rxvtimg.C 2012/06/07 06:08:09 1.31 @@ -4,16 +4,14 @@ #if HAVE_IMG -#define float_to_component(d) ((d) * 65535.99) - rxvt_img::rxvt_img (rxvt_screen *screen, XRenderPictFormat *format, int width, int height) -: s(screen), w(width), h(height), format(format), shared(false) +: s(screen), x(0), y(0), w(width), h(height), format(format), repeat(RepeatNormal), shared(false) { pm = XCreatePixmap (s->display->dpy, s->display->root, w, h, format->depth); } rxvt_img::rxvt_img (rxvt_screen *screen, XRenderPictFormat *format, int width, int height, Pixmap pixmap) -: s(screen), pm(pixmap), w(width), h(height), format(format), shared(false) +: s(screen), x(0), y(0), w(width), h(height), format(format), repeat(RepeatNormal), shared(false), pm(pixmap) { } @@ -202,17 +200,17 @@ } void -rxvt_img::brightness (double r, double g, double b, double a) +rxvt_img::brightness (unsigned short r, unsigned short g, unsigned short b, unsigned short a) { Display *dpy = s->display->dpy; Picture src = create_xrender_mask (dpy, pm, True); Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0); XRenderColor mask_c; - mask_c.red = float_to_component (r); - mask_c.green = float_to_component (g); - mask_c.blue = float_to_component (b); - mask_c.alpha = float_to_component (a); + mask_c.red = r; + mask_c.green = g; + mask_c.blue = b; + mask_c.alpha = a; XRenderFillRectangle (dpy, PictOpSrc, src, &mask_c, 0, 0, 1, 1); XRenderComposite (dpy, PictOpAdd, src, None, dst, 0, 0, 0, 0, 0, 0, w, h); @@ -222,7 +220,7 @@ } void -rxvt_img::contrast (double r, double g, double b, double a) +rxvt_img::contrast (unsigned short r, unsigned short g, unsigned short b, unsigned short a) { if (!(s->display->flags & DISPLAY_HAS_RENDER_MUL)) return; @@ -232,10 +230,10 @@ Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0); XRenderColor mask_c; - mask_c.red = float_to_component (r); - mask_c.green = float_to_component (g); - mask_c.blue = float_to_component (b); - mask_c.alpha = float_to_component (a); + mask_c.red = r; + mask_c.green = g; + mask_c.blue = b; + mask_c.alpha = a; XRenderFillRectangle (dpy, PictOpSrc, src, &mask_c, 0, 0, 1, 1); XRenderComposite (dpy, PictOpMultiply, src, None, dst, 0, 0, 0, 0, 0, 0, w, h); @@ -354,7 +352,7 @@ } rxvt_img * -rxvt_img::sub_rect (int x, int y, int width, int height, int repeat) +rxvt_img::sub_rect (int x, int y, int width, int height) { rxvt_img *img = new rxvt_img (s, format, width, height); @@ -373,7 +371,7 @@ } rxvt_img * -rxvt_img::transform (int new_width, int new_height, double matrix[9], int repeat) +rxvt_img::transform (int new_width, int new_height, double matrix[9]) { rxvt_img *img = new rxvt_img (s, format, new_width, new_height); @@ -412,7 +410,7 @@ } rxvt_img * -rxvt_img::rotate (int new_width, int new_height, int x, int y, double phi, int repeat) +rxvt_img::rotate (int new_width, int new_height, int x, int y, double phi) { double s = sin (phi); double c = cos (phi); @@ -423,7 +421,7 @@ 0, 0, 1 }; - return transform (new_width, new_height, matrix, repeat); + return transform (new_width, new_height, matrix); } rxvt_img *