--- rxvt-unicode/src/rxvtperl.xs 2012/06/07 17:21:56 1.184 +++ rxvt-unicode/src/rxvtperl.xs 2012/06/10 15:01:14 1.191 @@ -56,7 +56,9 @@ typedef int render_repeat_mode; +#if HAVE_PIXBUF typedef GdkPixbuf * urxvt__pixbuf; +#endif typedef rxvt_img * urxvt__img; ///////////////////////////////////////////////////////////////////////////// @@ -64,7 +66,7 @@ static void parse_color (rxvt_screen *s, rxvt_color &c, SV *sv) { - //TODO: support component stuff + //TODO: support component stuff, 0..1 c.set (s, SvPVbyte_nolen (sv)); } @@ -2032,6 +2034,13 @@ ############################################################################# # fancy bg bloatstuff (TODO: should be moved up somewhere) +bool +rxvt_term::has_render () + CODE: + RETVAL = THIS->display->flags & DISPLAY_HAS_RENDER; + OUTPUT: + RETVAL + # TODO: ugly void rxvt_term::background_geometry (bool border = false) @@ -2044,20 +2053,17 @@ #if HAVE_IMG -#if 0 - rxvt_img * -rxvt_term::new_img (SV *format, int width, int height) +rxvt_term::new_img (SV *format, int width = 1, int height = 1) CODE: XRenderPictFormat *f = SvOK (format) ? XRenderFindStandardFormat (THIS->dpy, SvIV (format)) : XRenderFindVisualFormat (THIS->dpy, THIS->visual); - RETVAL = new rxvt_img (THIS, f, width, height); + RETVAL = new rxvt_img (THIS, f, 0, 0, width, height); + RETVAL->alloc (); OUTPUT: RETVAL -#endif - #if ENABLE_TRANSPARENCY rxvt_img * @@ -2093,7 +2099,6 @@ rxvt_term::set_background (rxvt_img *img, bool border = false) CODE: THIS->bg_destroy (); - THIS->bg_pixmap = None; THIS->bg_flags &= ~(rxvt_term::BG_NEEDS_REFRESH | rxvt_term::BG_INHIBIT_RENDER | rxvt_term::BG_IS_TRANSPARENT); if (img) // TODO: cannot be false @@ -2101,34 +2106,23 @@ img = img->clone (); // own the img if (img->repeat != RepeatNormal) // X11 only supports RepeatNormal as bg pixmap - { - rxvt_img *img2 = img->sub_rect (0, 0, - border ? THIS->vt_width : THIS->szHint.width, - border ? THIS->vt_height : THIS->szHint.height); - delete img; - img = img2; - } + img->sub_rect (0, 0, + border ? THIS->vt_width : THIS->szHint.width, + border ? THIS->vt_height : THIS->szHint.height) + ->replace (img); + + // just in case, should usually be a nop + img->reify () + ->replace (img); - { - rxvt_img *img2 = img->convert_format (XRenderFindVisualFormat (THIS->dpy, THIS->visual), THIS->pix_colors [Color_bg]); - delete img; - img = img2; - } + img->convert_format (XRenderFindVisualFormat (THIS->dpy, THIS->visual), THIS->pix_colors [Color_bg]) + ->replace (img); - { - // just in case, should usually be a nop - rxvt_img *img2 = img->reify (); - delete img; - img = img2; - } - - THIS->bg_pixmap = img->steal (); + THIS->bg_img = img; THIS->bg_flags |= rxvt_term::BG_NEEDS_REFRESH | rxvt_term::BG_INHIBIT_RENDER; if (!border) THIS->bg_flags |= rxvt_term::BG_IS_TRANSPARENT; - - delete img; } #endif