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

Comparing rxvt-unicode/src/xpm.C (file contents):
Revision 1.67 by sasha, Tue Aug 14 14:06:51 2007 UTC vs.
Revision 1.70 by sasha, Thu Aug 16 21:26:20 2007 UTC

84 } 84 }
85# endif 85# endif
86# ifdef ENABLE_TRANSPARENCY 86# ifdef ENABLE_TRANSPARENCY
87 if (flags & isTransparent) 87 if (flags & isTransparent)
88 return true; 88 return true;
89# endif
90 return false;
91}
92
93bool bgPixmap_t::need_client_side_rendering ()
94{
95# ifdef HAVE_AFTERIMAGE
96 if (original_asim != NULL)
97 return true;
98#endif
99# ifdef ENABLE_TRANSPARENCY
100 if (flags & isTransparent)
101 {
102 if ((flags & blurNeeded)
103 || ((flags & tintNeeded) && !(flags & tintServerSide)))
104 return true;
105 }
89# endif 106# endif
90 return false; 107 return false;
91} 108}
92 109
93# ifdef XPM_BACKGROUND 110# ifdef XPM_BACKGROUND
597 if (v_blurRadius != vr) 614 if (v_blurRadius != vr)
598 { 615 {
599 ++changed; 616 ++changed;
600 v_blurRadius = vr; 617 v_blurRadius = vr;
601 } 618 }
619 if (v_blurRadius == 0 && h_blurRadius == 0)
620 flags &= ~blurNeeded;
621 else
622 flags |= blurNeeded;
602 return (changed>0); 623 return (changed>0);
603} 624}
604 625
605static inline unsigned long 626static inline unsigned long
606compute_tint_shade_flags (rxvt_color *tint, int shade) 627compute_tint_shade_flags (rxvt_color *tint, int shade)
891 { 912 {
892 ShadingInfo as_shade; 913 ShadingInfo as_shade;
893 as_shade.shading = (shade == 0) ? 100 : shade; 914 as_shade.shading = (shade == 0) ? 100 : shade;
894 915
895 rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); 916 rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC);
917 if (flags & tintSet)
896 tint.get (c); 918 tint.get (c);
897 as_shade.tintColor.red = c.r; 919 as_shade.tintColor.red = c.r;
898 as_shade.tintColor.green = c.g; 920 as_shade.tintColor.green = c.g;
899 as_shade.tintColor.blue = c.b; 921 as_shade.tintColor.blue = c.b;
900 922
901 as_tint = shading2tint32 (&as_shade); 923 as_tint = shading2tint32 (&as_shade);
902 } 924 }
925
926 if (!(background_flags & transpPmapBlured) && (flags & blurNeeded) && background != NULL)
927 {
928 ASImage* tmp = blur_asimage_gauss (target->asv, background, h_blurRadius, v_blurRadius, 0xFFFFFFFF,
929 (original_asim == NULL || tint == TINT_LEAVE_SAME)?ASA_XImage:ASA_ASImage,
930 100, ASIMAGE_QUALITY_DEFAULT);
931 if (tmp)
932 {
933 destroy_asimage (&background);
934 background = tmp;
935 }
936 }
937
903 if (render_asim (background, as_tint)) 938 if (render_asim (background, as_tint))
904 flags = flags & ~isInvalid; 939 flags = flags & ~isInvalid;
905 if (background) 940 if (background)
906 destroy_asimage (&background); 941 destroy_asimage (&background);
907 } 942 }
914 { 949 {
915 result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); 950 result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap);
916 if (result != NULL && !(background_flags & transpPmapTinted) && (flags & tintNeeded)) 951 if (result != NULL && !(background_flags & transpPmapTinted) && (flags & tintNeeded))
917 { 952 {
918 rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); 953 rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC);
954 if (flags & tintSet)
919 tint.get (c); 955 tint.get (c);
920 ShadeXImage (target, result, shade, c.r, c.g, c.b); 956 ShadeXImage (target, result, shade, c.r, c.g, c.b);
921 } 957 }
922 } 958 }
923# endif 959# endif
924 if (result != NULL) 960 if (result != NULL)
1027 { 1063 {
1028 target->scrollBar.setIdle (); 1064 target->scrollBar.setIdle ();
1029 target->scrollbar_show (0); 1065 target->scrollbar_show (0);
1030 } 1066 }
1031#endif 1067#endif
1068 /* Is that really neccessary? we did a XClearArea to generate Expose events alreday ! */
1032 target->want_refresh = target->want_full_refresh = 1; 1069 target->want_refresh = target->want_full_refresh = 1;
1070 /* TODO: why do we need a flush here ??? It causes segfault on resize ! */
1033 target->flush (); 1071// target->flush ();
1034 } 1072 }
1035} 1073}
1036#endif /* HAVE_BG_PIXMAP */ 1074#endif /* HAVE_BG_PIXMAP */
1037 1075
1038 1076
1039void 1077void
1040rxvt_term::get_window_origin (int &x, int &y) 1078rxvt_term::get_window_origin (int &x, int &y)
1041{ 1079{
1042 Window cr; 1080 Window cr;
1043 XTranslateCoordinates (dpy, parent[0], display->root, 0, 0, &x, &y, &cr); 1081 XTranslateCoordinates (dpy, parent[0], display->root, 0, 0, &x, &y, &cr);
1082/* fprintf( stderr, "origin is %+d%+d\n", x, y);*/
1044} 1083}
1045 1084
1046Pixmap 1085Pixmap
1047rxvt_term::get_pixmap_property (int prop_id) 1086rxvt_term::get_pixmap_property (int prop_id)
1048{ 1087{
1304/* 1343/*
1305 * Check our parents are still who we think they are. 1344 * Check our parents are still who we think they are.
1306 * Do transparency updates if required 1345 * Do transparency updates if required
1307 */ 1346 */
1308int 1347int
1309rxvt_term::check_our_parents () 1348rxvt_term::update_background ()
1310{ 1349{
1311 check_our_parents_ev.stop (); 1350 bgPixmap.invalidate();
1312 check_our_parents_ev.start (NOW + .1); 1351 /* no chance of real time refresh if we are blurring ! */
1352 if (bgPixmap.invalid_since + 0.5 < NOW && !(bgPixmap.flags & bgPixmap_t::blurNeeded))
1353 bgPixmap.render();
1354 else
1355 {
1356 update_background_ev.stop ();
1357 if (!bgPixmap.need_client_side_rendering())
1358 update_background_ev.start (NOW + .05);
1359 else if (bgPixmap.flags & bgPixmap_t::blurNeeded)
1360 update_background_ev.start (NOW + .2); /* very slow !!! */
1361 else
1362 update_background_ev.start (NOW + .07);
1363 }
1313 return 0; 1364 return 0;
1314} 1365}
1315 1366
1367void
1368rxvt_term::update_background_cb (time_watcher &w)
1369{
1370 bgPixmap.render ();
1371}
1372#endif /* HAVE_BG_PIXMAP */
1373
1374
1375#if 0 /* replaced by a bgPixmap_t::render() - leve here temporarily for reference */
1316void 1376void
1317rxvt_term::check_our_parents_cb (time_watcher &w) 1377rxvt_term::check_our_parents_cb (time_watcher &w)
1318{ 1378{
1319#if 0 /* replaced by a bgPixmap_t::render() - leve here temporarily for reference */
1320 1379
1321 int i, aformat, rootdepth; 1380 int i, aformat, rootdepth;
1322 unsigned long nitems, bytes_after; 1381 unsigned long nitems, bytes_after;
1323 Atom atype; 1382 Atom atype;
1324 unsigned char *prop = NULL; 1383 unsigned char *prop = NULL;
1522 want_refresh = want_full_refresh = 1; 1581 want_refresh = want_full_refresh = 1;
1523 if (am_pixmap_trans) 1582 if (am_pixmap_trans)
1524 flush (); 1583 flush ();
1525 } 1584 }
1526 } 1585 }
1586}
1527#endif 1587#endif
1528}
1529#endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines