ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/background.C
(Generate patch)

Comparing rxvt-unicode/src/background.C (file contents):
Revision 1.227 by sf-exg, Thu May 31 14:02:17 2012 UTC vs.
Revision 1.230 by sf-exg, Sun Jun 3 15:50:22 2012 UTC

484 return false; 484 return false;
485 485
486 bool need_blend = bg_flags & BG_IS_VALID; 486 bool need_blend = bg_flags & BG_IS_VALID;
487 487
488 if (need_blend 488 if (need_blend
489 && !(bg_flags & BG_HAS_RENDER)) 489 && !(display->flags & DISPLAY_HAS_RENDER))
490 return false; 490 return false;
491 491
492 GdkPixbuf *result; 492 GdkPixbuf *result;
493 493
494 int image_width = gdk_pixbuf_get_width (pixbuf); 494 int image_width = gdk_pixbuf_get_width (pixbuf);
673 if (id >= 1) 673 if (id >= 1)
674 GET_R->parse_image (id, XrmQuarkToString (quarks[size-1]), (char *)value->addr); 674 GET_R->parse_image (id, XrmQuarkToString (quarks[size-1]), (char *)value->addr);
675 } 675 }
676 return False; 676 return False;
677} 677}
678# endif
678 679
679void 680void
680rxvt_term::parse_image (int id, const char *type, const char *arg) 681rxvt_term::parse_image (int id, const char *type, const char *arg)
681{ 682{
682 if (image_vec.size () < id + 1) 683 if (image_vec.size () < id + 1)
683 image_vec.resize (id + 1); 684 image_vec.resize (id + 1);
684 685
685 rxvt_image *image = &image_vec[id]; 686 rxvt_image *image = &image_vec[id];
686} 687}
687# endif
688 688
689rxvt_image::rxvt_image () 689rxvt_image::rxvt_image ()
690{ 690{
691 alpha = 0xffff; 691 alpha = 0xffff;
692 flags = 0; 692 flags = 0;
837bool 837bool
838rxvt_term::blur_pixmap (Pixmap pixmap, int width, int height, bool argb, int h_blurRadius, int v_blurRadius) 838rxvt_term::blur_pixmap (Pixmap pixmap, int width, int height, bool argb, int h_blurRadius, int v_blurRadius)
839{ 839{
840 bool ret = false; 840 bool ret = false;
841#if XRENDER 841#if XRENDER
842 if (!(bg_flags & BG_HAS_RENDER_CONV)) 842 if (!(display->flags & DISPLAY_HAS_RENDER_CONV))
843 return false; 843 return false;
844 844
845 int size = max (h_blurRadius, v_blurRadius) * 2 + 1; 845 int size = max (h_blurRadius, v_blurRadius) * 2 + 1;
846 double *kernel = (double *)malloc (size * sizeof (double)); 846 double *kernel = (double *)malloc (size * sizeof (double));
847 XFixed *params = (XFixed *)malloc ((size + 2) * sizeof (XFixed)); 847 XFixed *params = (XFixed *)malloc ((size + 2) * sizeof (XFixed));
931 ret = true; 931 ret = true;
932 XFreeGC (dpy, gc); 932 XFreeGC (dpy, gc);
933 } 933 }
934 } 934 }
935# if XRENDER 935# if XRENDER
936 else if (bg_flags & BG_HAS_RENDER) 936 else if (display->flags & DISPLAY_HAS_RENDER)
937 { 937 {
938 if (shade <= 100) 938 if (shade <= 100)
939 { 939 {
940 c.r = c.r * shade / 100; 940 c.r = c.r * shade / 100;
941 c.g = c.g * shade / 100; 941 c.g = c.g * shade / 100;
1000 * Builds a pixmap of the same size as the terminal window that contains 1000 * Builds a pixmap of the same size as the terminal window that contains
1001 * the tiled portion of the root pixmap that is supposed to be covered by 1001 * the tiled portion of the root pixmap that is supposed to be covered by
1002 * our window. 1002 * our window.
1003 */ 1003 */
1004bool 1004bool
1005rxvt_term::make_transparency_pixmap () 1005rxvt_term::render_root_image ()
1006{ 1006{
1007 bool ret = false; 1007 bool ret = false;
1008 1008
1009 /* root dimensions may change from call to call - but Display structure should 1009 /* root dimensions may change from call to call - but Display structure should
1010 * be always up-to-date, so let's use it : 1010 * be always up-to-date, so let's use it :
1046 Pixmap recoded_root_pmap = root_pixmap; 1046 Pixmap recoded_root_pmap = root_pixmap;
1047 1047
1048 if (root_pixmap != None && root_depth != depth) 1048 if (root_pixmap != None && root_depth != depth)
1049 { 1049 {
1050#if XRENDER 1050#if XRENDER
1051 if (bg_flags & BG_HAS_RENDER) 1051 if (display->flags & DISPLAY_HAS_RENDER)
1052 { 1052 {
1053 recoded_root_pmap = XCreatePixmap (dpy, vt, root_pmap_width, root_pmap_height, depth); 1053 recoded_root_pmap = XCreatePixmap (dpy, vt, root_pmap_width, root_pmap_height, depth);
1054 1054
1055 XRenderPictFormat *src_format = XRenderFindVisualFormat (dpy, DefaultVisual (dpy, screen)); 1055 XRenderPictFormat *src_format = XRenderFindVisualFormat (dpy, DefaultVisual (dpy, screen));
1056 Picture src = XRenderCreatePicture (dpy, root_pixmap, src_format, 0, 0); 1056 Picture src = XRenderCreatePicture (dpy, root_pixmap, src_format, 0, 0);
1150 bg_invalidate (); 1150 bg_invalidate ();
1151# ifdef ENABLE_TRANSPARENCY 1151# ifdef ENABLE_TRANSPARENCY
1152 if (bg_flags & BG_IS_TRANSPARENT) 1152 if (bg_flags & BG_IS_TRANSPARENT)
1153 { 1153 {
1154 /* we need to re-generate transparency pixmap in that case ! */ 1154 /* we need to re-generate transparency pixmap in that case ! */
1155 if (make_transparency_pixmap ()) 1155 if (render_root_image ())
1156 bg_flags |= BG_IS_VALID; 1156 bg_flags |= BG_IS_VALID;
1157 } 1157 }
1158# endif 1158# endif
1159 1159
1160# ifdef BG_IMAGE_FROM_FILE 1160# ifdef BG_IMAGE_FROM_FILE
1183} 1183}
1184 1184
1185void 1185void
1186rxvt_term::bg_init () 1186rxvt_term::bg_init ()
1187{ 1187{
1188 bg_flags &= ~(BG_HAS_RENDER | BG_HAS_RENDER_CONV);
1189#if XRENDER
1190 int major, minor;
1191 if (XRenderQueryVersion (dpy, &major, &minor))
1192 bg_flags |= BG_HAS_RENDER;
1193 XFilters *filters = XRenderQueryFilters (dpy, vt);
1194 if (filters)
1195 {
1196 for (int i = 0; i < filters->nfilter; i++)
1197 if (!strcmp (filters->filter[i], FilterConvolution))
1198 bg_flags |= BG_HAS_RENDER_CONV;
1199
1200 XFree (filters);
1201 }
1202#endif
1203
1204#ifdef BG_IMAGE_FROM_FILE 1188#ifdef BG_IMAGE_FROM_FILE
1205 if (rs[Rs_backgroundPixmap]) 1189 if (rs[Rs_backgroundPixmap])
1206 { 1190 {
1207 rxvt_image *image = new_image (); 1191 rxvt_image *image = new_image ();
1208 if (!image->set_file_geometry (rs[Rs_backgroundPixmap])) 1192 if (!image->set_file_geometry (rs[Rs_backgroundPixmap]))
1209 image_vec.pop_back (); 1193 image_vec.pop_back ();
1210 } 1194 }
1211 1195
1212# ifndef NO_RESOURCES 1196# ifndef NO_RESOURCES
1213 find_resources ("image", "Image", XrmEnumAllLevels, rxvt_define_image); 1197 find_resources ("image", "Image", XrmEnumAllLevels, rxvt_define_image);
1198# endif
1199
1214 vector<rxvt_image>::iterator bg_image = image_vec.begin (); 1200 vector<rxvt_image>::iterator bg_image = image_vec.begin ();
1215 while (bg_image != image_vec.end ()) 1201 while (bg_image != image_vec.end ())
1216 { 1202 {
1217 if (!(bg_image->flags & IM_IS_SET)) 1203 if (!(bg_image->flags & IM_IS_SET))
1218 bg_image = image_vec.erase (bg_image); 1204 bg_image = image_vec.erase (bg_image);
1222 bg_image->flags |= IM_IS_SIZE_SENSITIVE; 1208 bg_image->flags |= IM_IS_SIZE_SENSITIVE;
1223 1209
1224 bg_image++; 1210 bg_image++;
1225 } 1211 }
1226 } 1212 }
1227# endif
1228 1213
1229 if (image_vec.size () > 0 1214 if (image_vec.size () > 0
1230 && !bg_window_position_sensitive ()) 1215 && !bg_window_position_sensitive ())
1231 update_background (); 1216 update_background ();
1232#endif 1217#endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines