--- rxvt-unicode/src/background.C 2010/10/04 20:45:45 1.65 +++ rxvt-unicode/src/background.C 2010/10/04 22:06:26 1.69 @@ -228,10 +228,8 @@ int diff = window_size - image_size; int smaller = min (image_size, window_size); - if (align >= 0 && align <= 50) + if (align >= 0 && align <= 100) return diff * align / 100; - else if (align > 50 && align <= 100) - return window_size - image_size - diff * (100 - align) / 100; else if (align > 100 && align <= 200 ) return ((align - 100) * smaller / 100) + window_size - smaller; else if (align >= -100 && align < 0) @@ -243,15 +241,14 @@ make_clip_rectangle (int pos, int size, int target_size, int &dst_pos, int &dst_size) { int src_pos = 0; - dst_pos = 0; + dst_pos = pos; dst_size = size; if (pos < 0) { src_pos = -pos; + dst_pos = 0; dst_size += pos; } - else if (pos > 0) - dst_pos = pos; if (dst_pos + dst_size > target_size) dst_size = target_size - dst_pos; @@ -463,6 +460,9 @@ h = v_scale * target_height / 100; } + if (!w) w = image_width; + if (!h) h = image_height; + if (flags & rootAlign) { target->get_window_origin (x, y); @@ -471,14 +471,14 @@ } else { - x = make_align_position (h_align, target_width, w > 0 ? w : image_width); - y = make_align_position (v_align, target_height, h > 0 ? h : image_height); + x = make_align_position (h_align, target_width, w); + y = make_align_position (v_align, target_height, h); } flags &= ~sizeSensitive; if (h_scale != 0 || v_scale != 0 || h_align != 0 || v_align != 0 - || image_width > target_width || image_height > target_height) + || w > target_width || h > target_height) flags |= sizeSensitive; } @@ -544,10 +544,11 @@ get_image_geometry (original_asim->width, original_asim->height, w, h, x, y); if (!original_asim - || x >= target_width - || y >= target_height - || (w > 0 && x + w <= 0) - || (h > 0 && y + h <= 0)) + || (!(flags & rootAlign) + && (x >= target_width + || y >= target_height + || (x + w <= 0) + || (y + h <= 0)))) { if (background) { @@ -571,12 +572,11 @@ { result = original_asim; - if ((w > 0 && w != original_asim->width) - || (h > 0 && h != original_asim->height)) + if ((w != original_asim->width) + || (h != original_asim->height)) { result = scale_asimage (target->asv, original_asim, - w > 0 ? w : original_asim->width, - h > 0 ? h : original_asim->height, + w, h, background ? ASA_ASImage : ASA_XImage, 100, ASIMAGE_QUALITY_DEFAULT); } @@ -764,20 +764,20 @@ get_image_geometry (image_width, image_height, w, h, x, y); - if (x >= target_width - || y >= target_height - || (w > 0 && x + w <= 0) - || (h > 0 && y + h <= 0)) + if (!(flags & rootAlign) + && (x >= target_width + || y >= target_height + || (x + w <= 0) + || (y + h <= 0))) return false; result = pixbuf; - if ((w > 0 && w != image_width) - || (h > 0 && h != image_height)) + if ((w != image_width) + || (h != image_height)) { result = gdk_pixbuf_scale_simple (pixbuf, - w > 0 ? w : image_width, - h > 0 ? h : image_height, + w, h, GDK_INTERP_BILINEAR); }