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.78 by sf-exg, Wed Oct 13 10:27:22 2010 UTC vs.
Revision 1.79 by sf-exg, Wed Oct 13 23:01:40 2010 UTC

744 return false; 744 return false;
745 745
746 if (!pixbuf) 746 if (!pixbuf)
747 return false; 747 return false;
748 748
749 // TODO: add alpha blending 749#if !XFT
750 if (background_flags) 750 if (background_flags)
751 return false; 751 return false;
752#endif
752 753
753 GdkPixbuf *result; 754 GdkPixbuf *result;
754 755
755 int image_width = gdk_pixbuf_get_width (pixbuf); 756 int image_width = gdk_pixbuf_get_width (pixbuf);
756 int image_height = gdk_pixbuf_get_height (pixbuf); 757 int image_height = gdk_pixbuf_get_height (pixbuf);
788 789
789 if (result) 790 if (result)
790 { 791 {
791 XGCValues gcv; 792 XGCValues gcv;
792 GC gc; 793 GC gc;
794 Pixmap root_pmap;
793 795
794 image_width = gdk_pixbuf_get_width (result); 796 image_width = gdk_pixbuf_get_width (result);
795 image_height = gdk_pixbuf_get_height (result); 797 image_height = gdk_pixbuf_get_height (result);
796 798
799 if (background_flags)
800 {
801 root_pmap = pixmap;
802 pixmap = None;
803 }
804 else
805 {
797 if (h_scale == 0 || v_scale == 0) 806 if (h_scale == 0 || v_scale == 0)
798 { 807 {
799 new_pmap_width = min (image_width, target_width); 808 new_pmap_width = min (image_width, target_width);
800 new_pmap_height = min (image_height, target_height); 809 new_pmap_height = min (image_height, target_height);
810 }
801 } 811 }
802 812
803 if (pixmap) 813 if (pixmap)
804 { 814 {
805 if (pmap_width != new_pmap_width 815 if (pmap_width != new_pmap_width
860 dst_x, dst_y, 870 dst_x, dst_y,
861 dst_width, dst_height, 871 dst_width, dst_height,
862 XLIB_RGB_DITHER_NONE, 872 XLIB_RGB_DITHER_NONE,
863 0, 0); 873 0, 0);
864 } 874 }
875
876#if XFT
877 if (background_flags)
878 {
879 Display *dpy = target->dpy;
880 XRenderPictureAttributes pa;
881
882 XRenderPictFormat *src_format = XRenderFindVisualFormat (dpy, DefaultVisual (dpy, target->display->screen));
883 Picture src = XRenderCreatePicture (dpy, root_pmap, src_format, 0, &pa);
884
885 XRenderPictFormat *dst_format = XRenderFindVisualFormat (dpy, target->visual);
886 Picture dst = XRenderCreatePicture (dpy, pixmap, dst_format, 0, &pa);
887
888 pa.repeat = True;
889 Pixmap mask_pmap = XCreatePixmap (dpy, target->vt, 1, 1, 8);
890 XRenderPictFormat *mask_format = XRenderFindStandardFormat (dpy, PictStandardA8);
891 Picture mask = XRenderCreatePicture (dpy, mask_pmap, mask_format, CPRepeat, &pa);
892 XFreePixmap (dpy, mask_pmap);
893
894 if (src && dst && mask)
895 {
896 XRenderColor mask_c;
897
898 mask_c.alpha = 0x8000;
899 mask_c.red = 0;
900 mask_c.green = 0;
901 mask_c.blue = 0;
902 XRenderFillRectangle (dpy, PictOpSrc, mask, &mask_c, 0, 0, 1, 1);
903 XRenderComposite (dpy, PictOpOver, src, mask, dst, 0, 0, 0, 0, 0, 0, target_width, target_height);
904 }
905
906 XRenderFreePicture (dpy, src);
907 XRenderFreePicture (dpy, dst);
908 XRenderFreePicture (dpy, mask);
909
910 XFreePixmap (dpy, root_pmap);
911 }
912#endif
865 913
866 if (result != pixbuf) 914 if (result != pixbuf)
867 g_object_unref (result); 915 g_object_unref (result);
868 916
869 XFreeGC (target->dpy, gc); 917 XFreeGC (target->dpy, gc);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines