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.197 by sf-exg, Wed Jan 11 13:22:01 2012 UTC vs.
Revision 1.204 by sf-exg, Tue Apr 10 15:19:22 2012 UTC

20 * You should have received a copy of the GNU General Public License 20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software 21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *---------------------------------------------------------------------*/ 23 *---------------------------------------------------------------------*/
24 24
25#include <cmath> 25#include <math.h>
26#include "../config.h" /* NECESSARY */ 26#include "../config.h" /* NECESSARY */
27#include "rxvt.h" /* NECESSARY */ 27#include "rxvt.h" /* NECESSARY */
28 28
29#if XRENDER 29#if XRENDER
30# include <X11/extensions/Xrender.h> 30# include <X11/extensions/Xrender.h>
58# endif 58# endif
59 59
60void 60void
61rxvt_term::bg_destroy () 61rxvt_term::bg_destroy ()
62{ 62{
63#ifdef HAVE_AFTERIMAGE
64 if (original_asim)
65 safe_asimage_destroy (original_asim);
66 if (asv)
67 destroy_asvisual (asv, 0);
68 if (asimman)
69 destroy_image_manager (asimman, 0);
70#endif
71
72#ifdef HAVE_PIXBUF 63#ifdef HAVE_PIXBUF
73 if (pixbuf) 64 if (pixbuf)
74 g_object_unref (pixbuf); 65 g_object_unref (pixbuf);
75#endif 66#endif
76 67
129 120
130 return false; 121 return false;
131} 122}
132 123
133# ifdef BG_IMAGE_FROM_FILE 124# ifdef BG_IMAGE_FROM_FILE
134static inline bool
135check_set_scale_value (int geom_flags, int flag, unsigned int &scale, unsigned int new_value)
136{
137 if (geom_flags & flag)
138 {
139 if (new_value > 1000)
140 new_value = 1000;
141 if (new_value != scale)
142 {
143 scale = new_value;
144 return true;
145 }
146 }
147 return false;
148}
149
150static inline bool
151check_set_align_value (int geom_flags, int flag, int &align, int new_value)
152{
153 if (geom_flags & flag)
154 {
155 if (new_value < -100)
156 new_value = -100;
157 else if (new_value > 200)
158 new_value = 200;
159 if (new_value != align)
160 {
161 align = new_value;
162 return true;
163 }
164 }
165 return false;
166}
167
168static inline int 125static inline int
169make_align_position (int align, int window_size, int image_size) 126make_align_position (int align, int window_size, int image_size)
170{ 127{
171 int diff = window_size - image_size; 128 int diff = window_size - image_size;
172 int smaller = min (image_size, window_size); 129 int smaller = min (image_size, window_size);
200bool 157bool
201rxvt_term::bg_set_geometry (const char *geom, bool update) 158rxvt_term::bg_set_geometry (const char *geom, bool update)
202{ 159{
203 bool changed = false; 160 bool changed = false;
204 int geom_flags = 0; 161 int geom_flags = 0;
205 int x = 0, y = 0; 162 int x = h_align;
163 int y = v_align;
206 unsigned int w = 0, h = 0; 164 unsigned int w = h_scale;
165 unsigned int h = v_scale;
207 unsigned long new_flags = 0; 166 unsigned long new_flags = 0;
208 167
209 if (geom == NULL) 168 if (geom == NULL)
210 return false; 169 return false;
211 170
320 w = h = defaultScale; 279 w = h = defaultScale;
321 else if (!(geom_flags & HeightValue)) 280 else if (!(geom_flags & HeightValue))
322 h = w; 281 h = w;
323 else if (!(geom_flags & WidthValue)) 282 else if (!(geom_flags & WidthValue))
324 w = h; 283 w = h;
325
326 geom_flags |= WidthValue|HeightValue|XValue|YValue;
327 } 284 }
328 285
329 if (check_set_scale_value (geom_flags, WidthValue, h_scale, w)) changed = true; 286 min_it (w, 1000);
330 if (check_set_scale_value (geom_flags, HeightValue, v_scale, h)) changed = true; 287 min_it (h, 1000);
331 if (check_set_align_value (geom_flags, XValue, h_align, x)) changed = true; 288 clamp_it (x, -100, 200);
332 if (check_set_align_value (geom_flags, YValue, v_align, y)) changed = true; 289 clamp_it (y, -100, 200);
333 290
334 if (new_flags != bg_flags) 291 if (bg_flags != new_flags
292 || h_scale != w
293 || v_scale != h
294 || h_align != x
295 || v_align != y)
335 { 296 {
336 bg_flags = new_flags; 297 bg_flags = new_flags;
298 h_scale = w;
299 v_scale = h;
300 h_align = x;
301 v_align = y;
337 changed = true; 302 changed = true;
338 } 303 }
339 304
340 return changed; 305 return changed;
341} 306}
369 { 334 {
370 x = make_align_position (h_align, target_width, w); 335 x = make_align_position (h_align, target_width, w);
371 y = make_align_position (v_align, target_height, h); 336 y = make_align_position (v_align, target_height, h);
372 } 337 }
373 338
374 bg_flags &= ~BG_IS_SIZE_SENSITIVE;
375 if (!(bg_flags & BG_TILE) 339 if (!(bg_flags & BG_TILE)
376 || h_scale || v_scale 340 || h_scale || v_scale
377 || (!(bg_flags & BG_ROOT_ALIGN) && (h_align || v_align)) 341 || (!(bg_flags & BG_ROOT_ALIGN) && (h_align || v_align))
378 || w > target_width || h > target_height) 342 || image_width > target_width || image_height > target_height)
379 bg_flags |= BG_IS_SIZE_SENSITIVE; 343 bg_flags |= BG_IS_SIZE_SENSITIVE;
380}
381
382# ifdef HAVE_AFTERIMAGE
383bool
384rxvt_term::render_image (unsigned long tr_flags)
385{
386 init_asv ();
387
388 ASImage *background = NULL;
389 ARGB32 background_tint = TINT_LEAVE_SAME;
390
391# ifdef ENABLE_TRANSPARENCY
392 if (tr_flags)
393 background = pixmap2ximage (asv, bg_pixmap, 0, 0, bg_pmap_width, bg_pmap_height, AllPlanes, 100);
394
395 if (tr_flags & BG_NEEDS_TINT)
396 {
397 ShadingInfo as_shade;
398 as_shade.shading = shade;
399
400 rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC);
401 if (bg_flags & BG_TINT_SET)
402 tint.get (c);
403 as_shade.tintColor.red = c.r;
404 as_shade.tintColor.green = c.g;
405 as_shade.tintColor.blue = c.b;
406
407 background_tint = shading2tint32 (&as_shade);
408 }
409
410 if ((tr_flags & BG_NEEDS_BLUR) && background != NULL)
411 {
412 ASImage *tmp = blur_asimage_gauss (asv, background, h_blurRadius, v_blurRadius, 0xFFFFFFFF,
413 ASA_XImage,
414 100, ASIMAGE_QUALITY_DEFAULT);
415 if (tmp)
416 {
417 destroy_asimage (&background);
418 background = tmp;
419 }
420 }
421# endif
422
423 ASImage *result = 0;
424
425 int target_width = szHint.width;
426 int target_height = szHint.height;
427 int new_pmap_width = target_width;
428 int new_pmap_height = target_height;
429
430 int x = 0;
431 int y = 0;
432 int w = 0;
433 int h = 0;
434
435 if (original_asim)
436 get_image_geometry (original_asim->width, original_asim->height, w, h, x, y);
437
438 if (!original_asim
439 || (!(bg_flags & BG_ROOT_ALIGN)
440 && (x >= target_width
441 || y >= target_height
442 || x + w <= 0
443 || y + h <= 0)))
444 {
445 if (background)
446 {
447 new_pmap_width = background->width;
448 new_pmap_height = background->height;
449 result = background;
450
451 if (background_tint != TINT_LEAVE_SAME)
452 {
453 ASImage *tmp = tile_asimage (asv, background, 0, 0,
454 target_width, target_height, background_tint,
455 ASA_XImage, 100, ASIMAGE_QUALITY_DEFAULT);
456 if (tmp)
457 result = tmp;
458 }
459 }
460 else
461 new_pmap_width = new_pmap_height = 0;
462 }
463 else 344 else
464 { 345 bg_flags &= ~BG_IS_SIZE_SENSITIVE;
465 result = original_asim;
466
467 if (w != original_asim->width
468 || h != original_asim->height)
469 {
470 result = scale_asimage (asv, original_asim,
471 w, h,
472 ASA_XImage,
473 100, ASIMAGE_QUALITY_DEFAULT);
474 }
475
476 if (background == NULL)
477 {
478 if (bg_flags & BG_TILE)
479 {
480 /* if tiling - pixmap has to be sized exactly as the image,
481 but there is no need to make it bigger than the window! */
482 new_pmap_width = min (result->width, target_width);
483 new_pmap_height = min (result->height, target_height);
484
485 /* we also need to tile our image in both directions */
486 ASImage *tmp = tile_asimage (asv, result,
487 (int)result->width - x,
488 (int)result->height - y,
489 new_pmap_width,
490 new_pmap_height,
491 TINT_LEAVE_SAME, ASA_XImage,
492 100, ASIMAGE_QUALITY_DEFAULT);
493 if (tmp)
494 {
495 if (result != original_asim)
496 destroy_asimage (&result);
497
498 result = tmp;
499 }
500 }
501 }
502 else
503 {
504 /* if blending background and image - pixmap has to be sized same as target window */
505 ASImageLayer *layers = create_image_layers (2);
506
507 layers[0].im = background;
508 layers[0].clip_width = target_width;
509 layers[0].clip_height = target_height;
510 layers[0].tint = background_tint;
511 layers[1].im = result;
512
513 if (bg_flags & BG_TILE)
514 {
515 /* tile horizontally */
516 while (x > 0) x -= (int)result->width;
517 layers[1].dst_x = x;
518 layers[1].clip_width = result->width+target_width;
519 }
520 else
521 {
522 /* clip horizontally */
523 layers[1].dst_x = x;
524 layers[1].clip_width = result->width;
525 }
526
527 if (bg_flags & BG_TILE)
528 {
529 while (y > 0) y -= (int)result->height;
530 layers[1].dst_y = y;
531 layers[1].clip_height = result->height + target_height;
532 }
533 else
534 {
535 layers[1].dst_y = y;
536 layers[1].clip_height = result->height;
537 }
538
539 if (rs[Rs_blendtype])
540 {
541 layers[1].merge_scanlines = blend_scanlines_name2func (rs[Rs_blendtype]);
542 if (layers[1].merge_scanlines == NULL)
543 layers[1].merge_scanlines = alphablend_scanlines;
544 }
545
546 ASImage *tmp = merge_layers (asv, layers, 2, target_width, target_height,
547 ASA_XImage, 0, ASIMAGE_QUALITY_DEFAULT);
548
549 if (tmp)
550 {
551 if (result != original_asim)
552 destroy_asimage (&result);
553
554 result = tmp;
555 }
556
557 free (layers);
558 }
559 }
560
561 bool ret = false;
562
563 if (result)
564 {
565 XGCValues gcv;
566 GC gc;
567
568 /* create Pixmap */
569 if (bg_pixmap == None
570 || bg_pmap_width != new_pmap_width
571 || bg_pmap_height != new_pmap_height)
572 {
573 if (bg_pixmap)
574 XFreePixmap (dpy, bg_pixmap);
575 bg_pixmap = XCreatePixmap (dpy, vt, new_pmap_width, new_pmap_height, depth);
576 bg_pmap_width = new_pmap_width;
577 bg_pmap_height = new_pmap_height;
578 }
579 /* fill with background color (if result's not completely overlapping it) */
580 gcv.foreground = pix_colors[Color_bg];
581 gc = XCreateGC (dpy, vt, GCForeground, &gcv);
582
583 int src_x = 0, src_y = 0, dst_x = 0, dst_y = 0;
584 int dst_width = result->width, dst_height = result->height;
585 if (background == NULL)
586 {
587 if (!(bg_flags & BG_TILE))
588 {
589 src_x = make_clip_rectangle (x, result->width , new_pmap_width , dst_x, dst_width );
590 src_y = make_clip_rectangle (y, result->height, new_pmap_height, dst_y, dst_height);
591 }
592
593 if (dst_x > 0 || dst_y > 0
594 || dst_x + dst_width < new_pmap_width
595 || dst_y + dst_height < new_pmap_height)
596 XFillRectangle (dpy, bg_pixmap, gc, 0, 0, new_pmap_width, new_pmap_height);
597 }
598
599 /* put result on pixmap */
600 if (dst_x < new_pmap_width && dst_y < new_pmap_height)
601 asimage2drawable (asv, bg_pixmap, result, gc, src_x, src_y, dst_x, dst_y, dst_width, dst_height, True);
602
603 if (result != background && result != original_asim)
604 destroy_asimage (&result);
605
606 XFreeGC (dpy, gc);
607
608 ret = true;
609 }
610
611 if (background)
612 destroy_asimage (&background);
613
614 return ret;
615} 346}
616# endif /* HAVE_AFTERIMAGE */
617 347
618# ifdef HAVE_PIXBUF 348# ifdef HAVE_PIXBUF
619bool 349bool
620rxvt_term::pixbuf_to_pixmap (GdkPixbuf *pixbuf, Pixmap pixmap, GC gc, 350rxvt_term::pixbuf_to_pixmap (GdkPixbuf *pixbuf, Pixmap pixmap, GC gc,
621 int src_x, int src_y, int dst_x, int dst_y, 351 int src_x, int src_y, int dst_x, int dst_y,
698 XDestroyImage (ximage); 428 XDestroyImage (ximage);
699 return true; 429 return true;
700} 430}
701 431
702bool 432bool
703rxvt_term::render_image (unsigned long tr_flags) 433rxvt_term::render_image (bool transparent)
704{ 434{
705 if (!pixbuf) 435 if (!pixbuf)
706 return false; 436 return false;
707 437
708 if (tr_flags 438 if (transparent
709 && !(bg_flags & BG_HAS_RENDER)) 439 && !(bg_flags & BG_HAS_RENDER))
710 return false; 440 return false;
711 441
712 GdkPixbuf *result; 442 GdkPixbuf *result;
713 443
753 Pixmap root_pmap; 483 Pixmap root_pmap;
754 484
755 image_width = gdk_pixbuf_get_width (result); 485 image_width = gdk_pixbuf_get_width (result);
756 image_height = gdk_pixbuf_get_height (result); 486 image_height = gdk_pixbuf_get_height (result);
757 487
758 if (tr_flags) 488 if (transparent)
759 { 489 {
760 root_pmap = bg_pixmap; 490 root_pmap = bg_pixmap;
761 bg_pixmap = None; 491 bg_pixmap = None;
762 } 492 }
763 else 493 else
821 dst_x, dst_y, 551 dst_x, dst_y,
822 dst_width, dst_height); 552 dst_width, dst_height);
823 } 553 }
824 554
825#if XRENDER 555#if XRENDER
826 if (tr_flags) 556 if (transparent)
827 { 557 {
828 XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual); 558 XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual);
829 559
830 Picture src = XRenderCreatePicture (dpy, root_pmap, format, 0, 0); 560 Picture src = XRenderCreatePicture (dpy, root_pmap, format, 0, 0);
831 561
855 } 585 }
856 586
857 if (result != pixbuf) 587 if (result != pixbuf)
858 g_object_unref (result); 588 g_object_unref (result);
859 589
860 if (tr_flags) 590 if (transparent)
861 XFreePixmap (dpy, root_pmap); 591 XFreePixmap (dpy, root_pmap);
862 592
863 return ret; 593 return ret;
864} 594}
865# endif /* HAVE_PIXBUF */ 595# endif /* HAVE_PIXBUF */
880 memcpy (f, file, len); 610 memcpy (f, file, len);
881 f[len] = '\0'; 611 f[len] = '\0';
882 file = f; 612 file = f;
883 } 613 }
884 614
885# ifdef HAVE_AFTERIMAGE
886 if (!asimman)
887 asimman = create_generic_imageman (rs[Rs_path]);
888 ASImage *image = get_asimage (asimman, file, 0xFFFFFFFF, 100);
889 if (image)
890 {
891 if (original_asim)
892 safe_asimage_destroy (original_asim);
893 original_asim = image;
894 bg_flags |= BG_IS_FROM_FILE | BG_CLIENT_RENDER;
895 ret = true;
896 }
897# endif
898
899# ifdef HAVE_PIXBUF 615# ifdef HAVE_PIXBUF
900 GdkPixbuf *image = gdk_pixbuf_new_from_file (file, NULL); 616 GdkPixbuf *image = gdk_pixbuf_new_from_file (file, NULL);
901 if (image) 617 if (image)
902 { 618 {
903 if (pixbuf) 619 if (pixbuf)
960 { 676 {
961 changed = true; 677 changed = true;
962 v_blurRadius = vr; 678 v_blurRadius = vr;
963 } 679 }
964 680
965 if (h_blurRadius == 0 || v_blurRadius == 0) 681 if (h_blurRadius && v_blurRadius)
682 bg_flags |= BG_NEEDS_BLUR;
683 else
966 bg_flags &= ~BG_NEEDS_BLUR; 684 bg_flags &= ~BG_NEEDS_BLUR;
967 else
968 bg_flags |= BG_NEEDS_BLUR;
969 685
970 return changed; 686 return changed;
971} 687}
972 688
973void 689void
974rxvt_term::set_tint_shade_flags () 690rxvt_term::set_tint_shade_flags ()
975{ 691{
692 if (shade != 100 || (bg_flags & BG_TINT_SET))
693 bg_flags |= BG_NEEDS_TINT;
694 else
695 bg_flags &= ~BG_NEEDS_TINT;
696}
697
698bool
699rxvt_term::bg_set_tint (rxvt_color &new_tint)
700{
701 if (!(bg_flags & BG_TINT_SET) || tint != new_tint)
702 {
703 tint = new_tint;
704 bg_flags |= BG_TINT_SET;
705
976 rgba c; 706 rgba c;
977 bool has_shade = shade != 100;
978
979 bg_flags &= ~BG_TINT_FLAGS;
980
981 if (bg_flags & BG_TINT_SET)
982 {
983 tint.get (c); 707 tint.get (c);
984 if (!has_shade
985 && (c.r <= 0x00ff || c.r >= 0xff00) 708 if ((c.r <= 0x00ff || c.r >= 0xff00)
986 && (c.g <= 0x00ff || c.g >= 0xff00) 709 && (c.g <= 0x00ff || c.g >= 0xff00)
987 && (c.b <= 0x00ff || c.b >= 0xff00)) 710 && (c.b <= 0x00ff || c.b >= 0xff00))
988 bg_flags |= BG_TINT_BITAND; 711 bg_flags |= BG_TINT_BITAND;
989 } 712 else
990
991 if (has_shade || (bg_flags & BG_TINT_SET))
992 bg_flags |= BG_NEEDS_TINT;
993}
994
995bool
996rxvt_term::bg_set_tint (rxvt_color &new_tint)
997{
998 if (!(bg_flags & BG_TINT_SET) || tint != new_tint)
999 {
1000 tint = new_tint;
1001 bg_flags |= BG_TINT_SET; 713 bg_flags &= ~BG_TINT_BITAND;
714
1002 set_tint_shade_flags (); 715 set_tint_shade_flags ();
1003 return true; 716 return true;
1004 } 717 }
1005 718
1006 return false; 719 return false;
1116bool 829bool
1117rxvt_term::tint_pixmap (Pixmap pixmap, Visual *visual, int width, int height) 830rxvt_term::tint_pixmap (Pixmap pixmap, Visual *visual, int width, int height)
1118{ 831{
1119 bool ret = false; 832 bool ret = false;
1120 833
1121 if (bg_flags & BG_TINT_BITAND) 834 if (shade == 100 && (bg_flags & BG_TINT_BITAND))
1122 { 835 {
1123 XGCValues gcv; 836 XGCValues gcv;
1124 GC gc; 837 GC gc;
1125 838
1126 /* In this case we can tint image server-side getting significant 839 /* In this case we can tint image server-side getting significant
1207/* 920/*
1208 * Builds a pixmap of the same size as the terminal window that contains 921 * Builds a pixmap of the same size as the terminal window that contains
1209 * the tiled portion of the root pixmap that is supposed to be covered by 922 * the tiled portion of the root pixmap that is supposed to be covered by
1210 * our window. 923 * our window.
1211 */ 924 */
1212unsigned long 925bool
1213rxvt_term::make_transparency_pixmap () 926rxvt_term::make_transparency_pixmap ()
1214{ 927{
1215 unsigned long result = 0; 928 bool ret = false;
1216 929
1217 /* root dimensions may change from call to call - but Display structure should 930 /* root dimensions may change from call to call - but Display structure should
1218 * be always up-to-date, so let's use it : 931 * be always up-to-date, so let's use it :
1219 */ 932 */
1220 int screen = display->screen; 933 int screen = display->screen;
1301 gc = XCreateGC (dpy, vt, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv); 1014 gc = XCreateGC (dpy, vt, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv);
1302 1015
1303 if (gc) 1016 if (gc)
1304 { 1017 {
1305 XFillRectangle (dpy, bg_pixmap, gc, 0, 0, window_width, window_height); 1018 XFillRectangle (dpy, bg_pixmap, gc, 0, 0, window_width, window_height);
1306 result |= BG_IS_VALID | (bg_flags & BG_EFFECTS_FLAGS); 1019 ret = true;
1020 unsigned long tr_flags = bg_flags & BG_EFFECTS_FLAGS;
1307 1021
1308 if (!(bg_flags & BG_CLIENT_RENDER)) 1022 if (!(bg_flags & BG_CLIENT_RENDER))
1309 { 1023 {
1310 if (bg_flags & BG_NEEDS_BLUR) 1024 if (bg_flags & BG_NEEDS_BLUR)
1311 { 1025 {
1312 if (blur_pixmap (bg_pixmap, visual, window_width, window_height, depth)) 1026 if (blur_pixmap (bg_pixmap, visual, window_width, window_height, depth))
1313 result &= ~BG_NEEDS_BLUR; 1027 tr_flags &= ~BG_NEEDS_BLUR;
1314 } 1028 }
1315 if (bg_flags & BG_NEEDS_TINT) 1029 if (bg_flags & BG_NEEDS_TINT)
1316 { 1030 {
1317 if (tint_pixmap (bg_pixmap, visual, window_width, window_height)) 1031 if (tint_pixmap (bg_pixmap, visual, window_width, window_height))
1318 result &= ~BG_NEEDS_TINT; 1032 tr_flags &= ~BG_NEEDS_TINT;
1319 } 1033 }
1320# ifndef HAVE_AFTERIMAGE
1321 if (result & BG_NEEDS_TINT) 1034 if (tr_flags & BG_NEEDS_TINT)
1322 { 1035 {
1323 XImage *ximage = XGetImage (dpy, bg_pixmap, 0, 0, bg_pmap_width, bg_pmap_height, AllPlanes, ZPixmap); 1036 XImage *ximage = XGetImage (dpy, bg_pixmap, 0, 0, bg_pmap_width, bg_pmap_height, AllPlanes, ZPixmap);
1324 if (ximage) 1037 if (ximage)
1325 { 1038 {
1326 /* our own client-side tinting */ 1039 /* our own client-side tinting */
1328 1041
1329 XPutImage (dpy, bg_pixmap, gc, ximage, 0, 0, 0, 0, ximage->width, ximage->height); 1042 XPutImage (dpy, bg_pixmap, gc, ximage, 0, 0, 0, 0, ximage->width, ximage->height);
1330 XDestroyImage (ximage); 1043 XDestroyImage (ximage);
1331 } 1044 }
1332 } 1045 }
1333# endif
1334 } /* server side rendering completed */ 1046 } /* server side rendering completed */
1335 1047
1336 XFreeGC (dpy, gc); 1048 XFreeGC (dpy, gc);
1337 } 1049 }
1338 1050
1339 if (recoded_root_pmap != root_pixmap) 1051 if (recoded_root_pmap != root_pixmap)
1340 XFreePixmap (dpy, recoded_root_pmap); 1052 XFreePixmap (dpy, recoded_root_pmap);
1341 1053
1342 return result; 1054 return ret;
1343} 1055}
1344 1056
1345void 1057void
1346rxvt_term::bg_set_root_pixmap () 1058rxvt_term::bg_set_root_pixmap ()
1347{ 1059{
1354# endif /* ENABLE_TRANSPARENCY */ 1066# endif /* ENABLE_TRANSPARENCY */
1355 1067
1356bool 1068bool
1357rxvt_term::bg_render () 1069rxvt_term::bg_render ()
1358{ 1070{
1359 unsigned long tr_flags = 0; 1071 bool transparent = false;
1360 1072
1361 bg_invalidate (); 1073 bg_invalidate ();
1362# ifdef ENABLE_TRANSPARENCY 1074# ifdef ENABLE_TRANSPARENCY
1363 if (bg_flags & BG_IS_TRANSPARENT) 1075 if (bg_flags & BG_IS_TRANSPARENT)
1364 { 1076 {
1365 /* we need to re-generate transparency pixmap in that case ! */ 1077 /* we need to re-generate transparency pixmap in that case ! */
1366 tr_flags = make_transparency_pixmap (); 1078 transparent = make_transparency_pixmap ();
1367 if (tr_flags == 0) 1079 if (transparent)
1368 return false;
1369 bg_flags |= BG_IS_VALID; 1080 bg_flags |= BG_IS_VALID;
1370 } 1081 }
1371# endif 1082# endif
1372 1083
1373# ifdef BG_IMAGE_FROM_FILE 1084# ifdef BG_IMAGE_FROM_FILE
1374 if ((bg_flags & BG_IS_FROM_FILE) 1085 if (bg_flags & BG_IS_FROM_FILE)
1375 || (tr_flags & BG_EFFECTS_FLAGS))
1376 { 1086 {
1377 if (render_image (tr_flags)) 1087 if (render_image (transparent))
1378 bg_flags |= BG_IS_VALID; 1088 bg_flags |= BG_IS_VALID;
1379 } 1089 }
1380# endif 1090# endif
1381 1091
1382 if (!(bg_flags & BG_IS_VALID)) 1092 if (!(bg_flags & BG_IS_VALID))
1420#endif 1130#endif
1421} 1131}
1422 1132
1423#endif /* HAVE_BG_PIXMAP */ 1133#endif /* HAVE_BG_PIXMAP */
1424 1134
1425#if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) 1135#ifdef ENABLE_TRANSPARENCY
1426/* based on code from aterm-0.4.2 */ 1136/* based on code from aterm-0.4.2 */
1427 1137
1428static inline void 1138static inline void
1429fill_lut (uint32_t *lookup, uint32_t mask, int sh, unsigned short low, unsigned short high) 1139fill_lut (uint32_t *lookup, uint32_t mask, int sh, unsigned short low, unsigned short high)
1430{ 1140{
1576 } 1286 }
1577 } 1287 }
1578 1288
1579 free (lookup); 1289 free (lookup);
1580} 1290}
1581#endif /* defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) */ 1291#endif /* ENABLE_TRANSPARENCY */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines