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.201 by sf-exg, Sat Feb 4 21:47:06 2012 UTC vs.
Revision 1.202 by sf-exg, Sat Feb 25 22:20:47 2012 UTC

427 XDestroyImage (ximage); 427 XDestroyImage (ximage);
428 return true; 428 return true;
429} 429}
430 430
431bool 431bool
432rxvt_term::render_image (unsigned long tr_flags) 432rxvt_term::render_image (bool transparent)
433{ 433{
434 if (!pixbuf) 434 if (!pixbuf)
435 return false; 435 return false;
436 436
437 if (tr_flags 437 if (transparent
438 && !(bg_flags & BG_HAS_RENDER)) 438 && !(bg_flags & BG_HAS_RENDER))
439 return false; 439 return false;
440 440
441 GdkPixbuf *result; 441 GdkPixbuf *result;
442 442
482 Pixmap root_pmap; 482 Pixmap root_pmap;
483 483
484 image_width = gdk_pixbuf_get_width (result); 484 image_width = gdk_pixbuf_get_width (result);
485 image_height = gdk_pixbuf_get_height (result); 485 image_height = gdk_pixbuf_get_height (result);
486 486
487 if (tr_flags) 487 if (transparent)
488 { 488 {
489 root_pmap = bg_pixmap; 489 root_pmap = bg_pixmap;
490 bg_pixmap = None; 490 bg_pixmap = None;
491 } 491 }
492 else 492 else
550 dst_x, dst_y, 550 dst_x, dst_y,
551 dst_width, dst_height); 551 dst_width, dst_height);
552 } 552 }
553 553
554#if XRENDER 554#if XRENDER
555 if (tr_flags) 555 if (transparent)
556 { 556 {
557 XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual); 557 XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual);
558 558
559 Picture src = XRenderCreatePicture (dpy, root_pmap, format, 0, 0); 559 Picture src = XRenderCreatePicture (dpy, root_pmap, format, 0, 0);
560 560
584 } 584 }
585 585
586 if (result != pixbuf) 586 if (result != pixbuf)
587 g_object_unref (result); 587 g_object_unref (result);
588 588
589 if (tr_flags) 589 if (transparent)
590 XFreePixmap (dpy, root_pmap); 590 XFreePixmap (dpy, root_pmap);
591 591
592 return ret; 592 return ret;
593} 593}
594# endif /* HAVE_PIXBUF */ 594# endif /* HAVE_PIXBUF */
922/* 922/*
923 * Builds a pixmap of the same size as the terminal window that contains 923 * Builds a pixmap of the same size as the terminal window that contains
924 * the tiled portion of the root pixmap that is supposed to be covered by 924 * the tiled portion of the root pixmap that is supposed to be covered by
925 * our window. 925 * our window.
926 */ 926 */
927unsigned long 927bool
928rxvt_term::make_transparency_pixmap () 928rxvt_term::make_transparency_pixmap ()
929{ 929{
930 unsigned long result = 0; 930 bool ret = false;
931 931
932 /* root dimensions may change from call to call - but Display structure should 932 /* root dimensions may change from call to call - but Display structure should
933 * be always up-to-date, so let's use it : 933 * be always up-to-date, so let's use it :
934 */ 934 */
935 int screen = display->screen; 935 int screen = display->screen;
1016 gc = XCreateGC (dpy, vt, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv); 1016 gc = XCreateGC (dpy, vt, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv);
1017 1017
1018 if (gc) 1018 if (gc)
1019 { 1019 {
1020 XFillRectangle (dpy, bg_pixmap, gc, 0, 0, window_width, window_height); 1020 XFillRectangle (dpy, bg_pixmap, gc, 0, 0, window_width, window_height);
1021 result |= BG_IS_VALID | (bg_flags & BG_EFFECTS_FLAGS); 1021 ret = true;
1022 unsigned long tr_flags = bg_flags & BG_EFFECTS_FLAGS;
1022 1023
1023 if (!(bg_flags & BG_CLIENT_RENDER)) 1024 if (!(bg_flags & BG_CLIENT_RENDER))
1024 { 1025 {
1025 if (bg_flags & BG_NEEDS_BLUR) 1026 if (bg_flags & BG_NEEDS_BLUR)
1026 { 1027 {
1027 if (blur_pixmap (bg_pixmap, visual, window_width, window_height, depth)) 1028 if (blur_pixmap (bg_pixmap, visual, window_width, window_height, depth))
1028 result &= ~BG_NEEDS_BLUR; 1029 tr_flags &= ~BG_NEEDS_BLUR;
1029 } 1030 }
1030 if (bg_flags & BG_NEEDS_TINT) 1031 if (bg_flags & BG_NEEDS_TINT)
1031 { 1032 {
1032 if (tint_pixmap (bg_pixmap, visual, window_width, window_height)) 1033 if (tint_pixmap (bg_pixmap, visual, window_width, window_height))
1033 result &= ~BG_NEEDS_TINT; 1034 tr_flags &= ~BG_NEEDS_TINT;
1034 } 1035 }
1035 if (result & BG_NEEDS_TINT) 1036 if (tr_flags & BG_NEEDS_TINT)
1036 { 1037 {
1037 XImage *ximage = XGetImage (dpy, bg_pixmap, 0, 0, bg_pmap_width, bg_pmap_height, AllPlanes, ZPixmap); 1038 XImage *ximage = XGetImage (dpy, bg_pixmap, 0, 0, bg_pmap_width, bg_pmap_height, AllPlanes, ZPixmap);
1038 if (ximage) 1039 if (ximage)
1039 { 1040 {
1040 /* our own client-side tinting */ 1041 /* our own client-side tinting */
1050 } 1051 }
1051 1052
1052 if (recoded_root_pmap != root_pixmap) 1053 if (recoded_root_pmap != root_pixmap)
1053 XFreePixmap (dpy, recoded_root_pmap); 1054 XFreePixmap (dpy, recoded_root_pmap);
1054 1055
1055 return result; 1056 return ret;
1056} 1057}
1057 1058
1058void 1059void
1059rxvt_term::bg_set_root_pixmap () 1060rxvt_term::bg_set_root_pixmap ()
1060{ 1061{
1067# endif /* ENABLE_TRANSPARENCY */ 1068# endif /* ENABLE_TRANSPARENCY */
1068 1069
1069bool 1070bool
1070rxvt_term::bg_render () 1071rxvt_term::bg_render ()
1071{ 1072{
1072 unsigned long tr_flags = 0; 1073 bool transparent = false;
1073 1074
1074 bg_invalidate (); 1075 bg_invalidate ();
1075# ifdef ENABLE_TRANSPARENCY 1076# ifdef ENABLE_TRANSPARENCY
1076 if (bg_flags & BG_IS_TRANSPARENT) 1077 if (bg_flags & BG_IS_TRANSPARENT)
1077 { 1078 {
1078 /* we need to re-generate transparency pixmap in that case ! */ 1079 /* we need to re-generate transparency pixmap in that case ! */
1079 tr_flags = make_transparency_pixmap (); 1080 transparent = make_transparency_pixmap ();
1080 if (tr_flags) 1081 if (transparent)
1081 bg_flags |= BG_IS_VALID; 1082 bg_flags |= BG_IS_VALID;
1082 } 1083 }
1083# endif 1084# endif
1084 1085
1085# ifdef BG_IMAGE_FROM_FILE 1086# ifdef BG_IMAGE_FROM_FILE
1086 if ((bg_flags & BG_IS_FROM_FILE) 1087 if (bg_flags & BG_IS_FROM_FILE)
1087 || (tr_flags & BG_EFFECTS_FLAGS))
1088 { 1088 {
1089 if (render_image (tr_flags)) 1089 if (render_image (transparent))
1090 bg_flags |= BG_IS_VALID; 1090 bg_flags |= BG_IS_VALID;
1091 } 1091 }
1092# endif 1092# endif
1093 1093
1094 if (!(bg_flags & BG_IS_VALID)) 1094 if (!(bg_flags & BG_IS_VALID))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines