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.67 by sf-exg, Mon Oct 4 21:56:42 2010 UTC vs.
Revision 1.71 by sf-exg, Wed Oct 6 14:52:14 2010 UTC

458 { 458 {
459 w = h_scale * target_width / 100; 459 w = h_scale * target_width / 100;
460 h = v_scale * target_height / 100; 460 h = v_scale * target_height / 100;
461 } 461 }
462 462
463 if (!w) w = image_width;
464 if (!h) h = image_height;
465
463 if (flags & rootAlign) 466 if (flags & rootAlign)
464 { 467 {
465 target->get_window_origin (x, y); 468 target->get_window_origin (x, y);
466 x = -x; 469 x = -x;
467 y = -y; 470 y = -y;
468 } 471 }
469 else 472 else
470 { 473 {
471 x = make_align_position (h_align, target_width, w > 0 ? w : image_width); 474 x = make_align_position (h_align, target_width, w);
472 y = make_align_position (v_align, target_height, h > 0 ? h : image_height); 475 y = make_align_position (v_align, target_height, h);
473 } 476 }
474 477
475 flags &= ~sizeSensitive; 478 flags &= ~sizeSensitive;
476 if (h_scale != 0 || v_scale != 0 479 if (h_scale != 0 || v_scale != 0
477 || h_align != 0 || v_align != 0 480 || h_align != 0 || v_align != 0
478 || image_width > target_width || image_height > target_height) 481 || w > target_width || h > target_height)
479 flags |= sizeSensitive; 482 flags |= sizeSensitive;
480} 483}
481 484
482# ifdef HAVE_AFTERIMAGE 485# ifdef HAVE_AFTERIMAGE
483bool 486bool
542 545
543 if (!original_asim 546 if (!original_asim
544 || (!(flags & rootAlign) 547 || (!(flags & rootAlign)
545 && (x >= target_width 548 && (x >= target_width
546 || y >= target_height 549 || y >= target_height
547 || (w > 0 && x + w <= 0)
548 || (h > 0 && y + h <= 0)))) 550 || (x + w <= 0)
551 || (y + h <= 0))))
549 { 552 {
550 if (background) 553 if (background)
551 { 554 {
552 new_pmap_width = background->width; 555 new_pmap_width = background->width;
553 new_pmap_height = background->height; 556 new_pmap_height = background->height;
567 } 570 }
568 else 571 else
569 { 572 {
570 result = original_asim; 573 result = original_asim;
571 574
572 if ((w > 0 && w != original_asim->width) 575 if ((w != original_asim->width)
573 || (h > 0 && h != original_asim->height)) 576 || (h != original_asim->height))
574 { 577 {
575 result = scale_asimage (target->asv, original_asim, 578 result = scale_asimage (target->asv, original_asim,
576 w > 0 ? w : original_asim->width, 579 w, h,
577 h > 0 ? h : original_asim->height,
578 background ? ASA_ASImage : ASA_XImage, 580 background ? ASA_ASImage : ASA_XImage,
579 100, ASIMAGE_QUALITY_DEFAULT); 581 100, ASIMAGE_QUALITY_DEFAULT);
580 } 582 }
581 583
582 if (background == NULL) 584 if (background == NULL)
614 layers[0].clip_width = target_width; 616 layers[0].clip_width = target_width;
615 layers[0].clip_height = target_height; 617 layers[0].clip_height = target_height;
616 layers[0].tint = background_tint; 618 layers[0].tint = background_tint;
617 layers[1].im = result; 619 layers[1].im = result;
618 620
619 if (w <= 0) 621 if (h_scale == 0 || v_scale == 0)
620 { 622 {
621 /* tile horizontally */ 623 /* tile horizontally */
622 while (x > 0) x -= (int)result->width; 624 while (x > 0) x -= (int)result->width;
623 layers[1].dst_x = x; 625 layers[1].dst_x = x;
624 layers[1].clip_width = result->width+target_width; 626 layers[1].clip_width = result->width+target_width;
628 /* clip horizontally */ 630 /* clip horizontally */
629 layers[1].dst_x = x; 631 layers[1].dst_x = x;
630 layers[1].clip_width = result->width; 632 layers[1].clip_width = result->width;
631 } 633 }
632 634
633 if (h <= 0) 635 if (h_scale == 0 || v_scale == 0)
634 { 636 {
635 while (y > 0) y -= (int)result->height; 637 while (y > 0) y -= (int)result->height;
636 layers[1].dst_y = y; 638 layers[1].dst_y = y;
637 layers[1].clip_height = result->height + target_height; 639 layers[1].clip_height = result->height + target_height;
638 } 640 }
763 get_image_geometry (image_width, image_height, w, h, x, y); 765 get_image_geometry (image_width, image_height, w, h, x, y);
764 766
765 if (!(flags & rootAlign) 767 if (!(flags & rootAlign)
766 && (x >= target_width 768 && (x >= target_width
767 || y >= target_height 769 || y >= target_height
768 || (w > 0 && x + w <= 0)
769 || (h > 0 && y + h <= 0))) 770 || (x + w <= 0)
771 || (y + h <= 0)))
770 return false; 772 return false;
771 773
772 result = pixbuf; 774 result = pixbuf;
773 775
774 if ((w > 0 && w != image_width) 776 if ((w != image_width)
775 || (h > 0 && h != image_height)) 777 || (h != image_height))
776 { 778 {
777 result = gdk_pixbuf_scale_simple (pixbuf, 779 result = gdk_pixbuf_scale_simple (pixbuf,
778 w > 0 ? w : image_width, 780 w, h,
779 h > 0 ? h : image_height,
780 GDK_INTERP_BILINEAR); 781 GDK_INTERP_BILINEAR);
781 } 782 }
782 783
783 bool ret = false; 784 bool ret = false;
784 785
1047 1048
1048 return false; 1049 return false;
1049} 1050}
1050 1051
1051bool 1052bool
1052bgPixmap_t::tint_pixmap (Pixmap pixmap) 1053bgPixmap_t::tint_pixmap (Pixmap pixmap, Window root, int width, int height)
1053{ 1054{
1054 Window root = target->display->root;
1055 Display *dpy = target->dpy; 1055 Display *dpy = target->dpy;
1056 int window_width = target->szHint.width;
1057 int window_height = target->szHint.height;
1058 bool ret = false; 1056 bool ret = false;
1059 1057
1060 if (flags & tintWholesome) 1058 if (flags & tintWholesome)
1061 { 1059 {
1062 XGCValues gcv; 1060 XGCValues gcv;
1069 gcv.function = GXand; 1067 gcv.function = GXand;
1070 gcv.fill_style = FillSolid; 1068 gcv.fill_style = FillSolid;
1071 gc = XCreateGC (dpy, root, GCFillStyle | GCForeground | GCFunction, &gcv); 1069 gc = XCreateGC (dpy, root, GCFillStyle | GCForeground | GCFunction, &gcv);
1072 if (gc) 1070 if (gc)
1073 { 1071 {
1074 XFillRectangle (dpy, pixmap, gc, 0, 0, window_width, window_height); 1072 XFillRectangle (dpy, pixmap, gc, 0, 0, width, height);
1075 ret = true; 1073 ret = true;
1076 XFreeGC (dpy, gc); 1074 XFreeGC (dpy, gc);
1077 } 1075 }
1078 } 1076 }
1079 else 1077 else
1141 mask_c.alpha = 0; 1139 mask_c.alpha = 0;
1142 mask_c.red = 0xffff - c.r; 1140 mask_c.red = 0xffff - c.r;
1143 mask_c.green = 0xffff - c.g; 1141 mask_c.green = 0xffff - c.g;
1144 mask_c.blue = 0xffff - c.b; 1142 mask_c.blue = 0xffff - c.b;
1145 XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1); 1143 XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1);
1146 XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, window_width, window_height); 1144 XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, width, height);
1147 ret = true; 1145 ret = true;
1148 } 1146 }
1149 1147
1150 XRenderFreePicture (dpy, mask_pic); 1148 XRenderFreePicture (dpy, mask_pic);
1151 XRenderFreePicture (dpy, overlay_pic); 1149 XRenderFreePicture (dpy, overlay_pic);
1294 { 1292 {
1295 if (!need_client_side_rendering ()) 1293 if (!need_client_side_rendering ())
1296 { 1294 {
1297 if ((flags & tintNeeded)) 1295 if ((flags & tintNeeded))
1298 { 1296 {
1299 if (tint_pixmap (tiled_root_pmap)) 1297 if (tint_pixmap (tiled_root_pmap, root, window_width, window_height))
1300 result |= transpPmapTinted; 1298 result |= transpPmapTinted;
1301 } 1299 }
1302 } /* server side rendering completed */ 1300 } /* server side rendering completed */
1303 1301
1304 if (pixmap) 1302 if (pixmap)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines