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.214 by sf-exg, Thu May 17 10:18:32 2012 UTC vs.
Revision 1.215 by sf-exg, Thu May 17 10:31:26 2012 UTC

452 XDestroyImage (ximage); 452 XDestroyImage (ximage);
453 return true; 453 return true;
454} 454}
455 455
456bool 456bool
457rxvt_term::render_image (rxvt_image &image, bool transparent) 457rxvt_term::render_image (rxvt_image &image)
458{ 458{
459 GdkPixbuf *pixbuf = image.pixbuf; 459 GdkPixbuf *pixbuf = image.pixbuf;
460 if (!pixbuf) 460 if (!pixbuf)
461 return false; 461 return false;
462 462
463 if (transparent 463 bool need_blend = bg_flags & BG_IS_VALID;
464
465 if (need_blend
464 && !(bg_flags & BG_HAS_RENDER)) 466 && !(bg_flags & BG_HAS_RENDER))
465 return false; 467 return false;
466 468
467 GdkPixbuf *result; 469 GdkPixbuf *result;
468 470
503 505
504 bool ret = false; 506 bool ret = false;
505 507
506 XGCValues gcv; 508 XGCValues gcv;
507 GC gc; 509 GC gc;
508 Pixmap root_pmap; 510 Pixmap tmp_pixmap;
509 511
510 image_width = gdk_pixbuf_get_width (result); 512 image_width = gdk_pixbuf_get_width (result);
511 image_height = gdk_pixbuf_get_height (result); 513 image_height = gdk_pixbuf_get_height (result);
512 514
513 if (transparent) 515 if (need_blend)
514 { 516 {
515 root_pmap = bg_pixmap; 517 tmp_pixmap = bg_pixmap;
516 bg_pixmap = None; 518 bg_pixmap = None;
517 } 519 }
518 else 520 else
519 { 521 {
520 if (image.flags & IM_TILE) 522 if (image.flags & IM_TILE)
576 dst_x, dst_y, 578 dst_x, dst_y,
577 dst_width, dst_height); 579 dst_width, dst_height);
578 } 580 }
579 581
580#if XRENDER 582#if XRENDER
581 if (transparent) 583 if (need_blend)
582 { 584 {
583 XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual); 585 XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual);
584 586
585 Picture src = XRenderCreatePicture (dpy, root_pmap, format, 0, 0); 587 Picture src = XRenderCreatePicture (dpy, tmp_pixmap, format, 0, 0);
586 588
587 Picture dst = XRenderCreatePicture (dpy, bg_pixmap, format, 0, 0); 589 Picture dst = XRenderCreatePicture (dpy, bg_pixmap, format, 0, 0);
588 590
589 Picture mask = create_xrender_mask (dpy, vt, False, False); 591 Picture mask = create_xrender_mask (dpy, vt, False, False);
590 592
610 } 612 }
611 613
612 if (result != pixbuf) 614 if (result != pixbuf)
613 g_object_unref (result); 615 g_object_unref (result);
614 616
615 if (transparent) 617 if (need_blend)
616 XFreePixmap (dpy, root_pmap); 618 XFreePixmap (dpy, tmp_pixmap);
617 619
618 return ret; 620 return ret;
619} 621}
620# endif /* HAVE_PIXBUF */ 622# endif /* HAVE_PIXBUF */
621 623
1064# endif /* ENABLE_TRANSPARENCY */ 1066# endif /* ENABLE_TRANSPARENCY */
1065 1067
1066bool 1068bool
1067rxvt_term::bg_render () 1069rxvt_term::bg_render ()
1068{ 1070{
1069 bool transparent = false;
1070
1071 bg_invalidate (); 1071 bg_invalidate ();
1072# ifdef ENABLE_TRANSPARENCY 1072# ifdef ENABLE_TRANSPARENCY
1073 if (bg_flags & BG_IS_TRANSPARENT) 1073 if (bg_flags & BG_IS_TRANSPARENT)
1074 { 1074 {
1075 /* we need to re-generate transparency pixmap in that case ! */ 1075 /* we need to re-generate transparency pixmap in that case ! */
1076 transparent = make_transparency_pixmap (); 1076 if (make_transparency_pixmap ())
1077 if (transparent)
1078 bg_flags |= BG_IS_VALID; 1077 bg_flags |= BG_IS_VALID;
1079 } 1078 }
1080# endif 1079# endif
1081 1080
1082# ifdef BG_IMAGE_FROM_FILE 1081# ifdef BG_IMAGE_FROM_FILE
1083 if (bg_image.flags & IM_IS_SET) 1082 if (bg_image.flags & IM_IS_SET)
1084 { 1083 {
1085 if (render_image (bg_image, transparent)) 1084 if (render_image (bg_image))
1086 bg_flags |= BG_IS_VALID; 1085 bg_flags |= BG_IS_VALID;
1087 } 1086 }
1088# endif 1087# endif
1089 1088
1090 if (!(bg_flags & BG_IS_VALID)) 1089 if (!(bg_flags & BG_IS_VALID))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines