… | |
… | |
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 |
483 | bool |
486 | bool |
… | |
… | |
539 | |
542 | |
540 | if (original_asim) |
543 | if (original_asim) |
541 | get_image_geometry (original_asim->width, original_asim->height, w, h, x, y); |
544 | get_image_geometry (original_asim->width, original_asim->height, w, h, x, y); |
542 | |
545 | |
543 | if (!original_asim |
546 | if (!original_asim |
|
|
547 | || (!(flags & rootAlign) |
544 | || x >= target_width |
548 | && (x >= target_width |
545 | || y >= target_height |
549 | || y >= target_height |
546 | || (w > 0 && x + w <= 0) |
550 | || (x + w <= 0) |
547 | || (h > 0 && y + h <= 0)) |
551 | || (y + h <= 0)))) |
548 | { |
552 | { |
549 | if (background) |
553 | if (background) |
550 | { |
554 | { |
551 | new_pmap_width = background->width; |
555 | new_pmap_width = background->width; |
552 | new_pmap_height = background->height; |
556 | new_pmap_height = background->height; |
… | |
… | |
566 | } |
570 | } |
567 | else |
571 | else |
568 | { |
572 | { |
569 | result = original_asim; |
573 | result = original_asim; |
570 | |
574 | |
571 | if ((w > 0 && w != original_asim->width) |
575 | if ((w != original_asim->width) |
572 | || (h > 0 && h != original_asim->height)) |
576 | || (h != original_asim->height)) |
573 | { |
577 | { |
574 | result = scale_asimage (target->asv, original_asim, |
578 | result = scale_asimage (target->asv, original_asim, |
575 | w > 0 ? w : original_asim->width, |
579 | w, h, |
576 | h > 0 ? h : original_asim->height, |
|
|
577 | background ? ASA_ASImage : ASA_XImage, |
580 | background ? ASA_ASImage : ASA_XImage, |
578 | 100, ASIMAGE_QUALITY_DEFAULT); |
581 | 100, ASIMAGE_QUALITY_DEFAULT); |
579 | } |
582 | } |
580 | |
583 | |
581 | if (background == NULL) |
584 | if (background == NULL) |
… | |
… | |
759 | int w = 0; |
762 | int w = 0; |
760 | int h = 0; |
763 | int h = 0; |
761 | |
764 | |
762 | get_image_geometry (image_width, image_height, w, h, x, y); |
765 | get_image_geometry (image_width, image_height, w, h, x, y); |
763 | |
766 | |
|
|
767 | if (!(flags & rootAlign) |
764 | if (x >= target_width |
768 | && (x >= target_width |
765 | || y >= target_height |
769 | || y >= target_height |
766 | || (w > 0 && x + w <= 0) |
770 | || (x + w <= 0) |
767 | || (h > 0 && y + h <= 0)) |
771 | || (y + h <= 0))) |
768 | return false; |
772 | return false; |
769 | |
773 | |
770 | result = pixbuf; |
774 | result = pixbuf; |
771 | |
775 | |
772 | if ((w > 0 && w != image_width) |
776 | if ((w != image_width) |
773 | || (h > 0 && h != image_height)) |
777 | || (h != image_height)) |
774 | { |
778 | { |
775 | result = gdk_pixbuf_scale_simple (pixbuf, |
779 | result = gdk_pixbuf_scale_simple (pixbuf, |
776 | w > 0 ? w : image_width, |
780 | w, h, |
777 | h > 0 ? h : image_height, |
|
|
778 | GDK_INTERP_BILINEAR); |
781 | GDK_INTERP_BILINEAR); |
779 | } |
782 | } |
780 | |
783 | |
781 | bool ret = false; |
784 | bool ret = false; |
782 | |
785 | |
… | |
… | |
1045 | |
1048 | |
1046 | return false; |
1049 | return false; |
1047 | } |
1050 | } |
1048 | |
1051 | |
1049 | bool |
1052 | bool |
1050 | bgPixmap_t::tint_pixmap (Pixmap pixmap) |
1053 | bgPixmap_t::tint_pixmap (Pixmap pixmap, Window root, int width, int height) |
1051 | { |
1054 | { |
1052 | Window root = target->display->root; |
|
|
1053 | Display *dpy = target->dpy; |
1055 | Display *dpy = target->dpy; |
1054 | int window_width = target->szHint.width; |
|
|
1055 | int window_height = target->szHint.height; |
|
|
1056 | bool ret = false; |
1056 | bool ret = false; |
1057 | |
1057 | |
1058 | if (flags & tintWholesome) |
1058 | if (flags & tintWholesome) |
1059 | { |
1059 | { |
1060 | XGCValues gcv; |
1060 | XGCValues gcv; |
… | |
… | |
1067 | gcv.function = GXand; |
1067 | gcv.function = GXand; |
1068 | gcv.fill_style = FillSolid; |
1068 | gcv.fill_style = FillSolid; |
1069 | gc = XCreateGC (dpy, root, GCFillStyle | GCForeground | GCFunction, &gcv); |
1069 | gc = XCreateGC (dpy, root, GCFillStyle | GCForeground | GCFunction, &gcv); |
1070 | if (gc) |
1070 | if (gc) |
1071 | { |
1071 | { |
1072 | XFillRectangle (dpy, pixmap, gc, 0, 0, window_width, window_height); |
1072 | XFillRectangle (dpy, pixmap, gc, 0, 0, width, height); |
1073 | ret = true; |
1073 | ret = true; |
1074 | XFreeGC (dpy, gc); |
1074 | XFreeGC (dpy, gc); |
1075 | } |
1075 | } |
1076 | } |
1076 | } |
1077 | else |
1077 | else |
… | |
… | |
1139 | mask_c.alpha = 0; |
1139 | mask_c.alpha = 0; |
1140 | mask_c.red = 0xffff - c.r; |
1140 | mask_c.red = 0xffff - c.r; |
1141 | mask_c.green = 0xffff - c.g; |
1141 | mask_c.green = 0xffff - c.g; |
1142 | mask_c.blue = 0xffff - c.b; |
1142 | mask_c.blue = 0xffff - c.b; |
1143 | XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1); |
1143 | XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1); |
1144 | 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); |
1145 | ret = true; |
1145 | ret = true; |
1146 | } |
1146 | } |
1147 | |
1147 | |
1148 | XRenderFreePicture (dpy, mask_pic); |
1148 | XRenderFreePicture (dpy, mask_pic); |
1149 | XRenderFreePicture (dpy, overlay_pic); |
1149 | XRenderFreePicture (dpy, overlay_pic); |
… | |
… | |
1292 | { |
1292 | { |
1293 | if (!need_client_side_rendering ()) |
1293 | if (!need_client_side_rendering ()) |
1294 | { |
1294 | { |
1295 | if ((flags & tintNeeded)) |
1295 | if ((flags & tintNeeded)) |
1296 | { |
1296 | { |
1297 | if (tint_pixmap (tiled_root_pmap)) |
1297 | if (tint_pixmap (tiled_root_pmap, root, window_width, window_height)) |
1298 | result |= transpPmapTinted; |
1298 | result |= transpPmapTinted; |
1299 | } |
1299 | } |
1300 | } /* server side rendering completed */ |
1300 | } /* server side rendering completed */ |
1301 | |
1301 | |
1302 | if (pixmap) |
1302 | if (pixmap) |