--- rxvt-unicode/src/background.C 2011/08/30 15:00:27 1.172 +++ rxvt-unicode/src/background.C 2011/12/24 09:44:10 1.179 @@ -192,7 +192,7 @@ { char **arr = rxvt_strsplit (':', geom); - for (int i = 0; arr[i]; i++) + for (int i = 0; arr[i]; i++) { if (!strcasecmp (arr[i], "style=tiled")) { @@ -203,7 +203,7 @@ } else if (!strcasecmp (arr[i], "style=aspect-stretched")) { - new_flags = BG_PROP_SCALE; + new_flags = BG_KEEP_ASPECT; w = h = windowScale; x = y = centerAlign; geom_flags = WidthValue|HeightValue|XValue|YValue; @@ -229,9 +229,9 @@ } else if (!strcasecmp (arr[i], "op=tile")) new_flags |= BG_TILE; - else if (!strcasecmp (arr[i], "op=pscale")) - new_flags |= BG_PROP_SCALE; - else if (!strcasecmp (arr[i], "op=root")) + else if (!strcasecmp (arr[i], "op=keep-aspect")) + new_flags |= BG_KEEP_ASPECT; + else if (!strcasecmp (arr[i], "op=root-align")) new_flags |= BG_ROOT_ALIGN; // deprecated @@ -243,7 +243,9 @@ } else if (!strcasecmp (arr[i], "propscale")) { - new_flags |= BG_PROP_SCALE; + new_flags |= BG_KEEP_ASPECT; + w = h = windowScale; + geom_flags |= WidthValue|HeightValue; } else if (!strcasecmp (arr[i], "hscale")) { @@ -324,7 +326,7 @@ w = h_scale * target_width / 100; h = v_scale * target_height / 100; - if (bg_flags & BG_PROP_SCALE) + if (bg_flags & BG_KEEP_ASPECT) { float scale = (float)w / image_width; min_it (scale, (float)h / image_height); @@ -1277,8 +1279,8 @@ } /* straightforward pixmap copy */ - while (sx < 0) sx += root_width; - while (sy < 0) sy += root_height; + while (sx < 0) sx += root_pmap_width; + while (sy < 0) sy += root_pmap_height; gcv.tile = recoded_root_pmap; gcv.fill_style = FillTiled; @@ -1435,6 +1437,18 @@ #if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) /* based on code from aterm-0.4.2 */ +static inline void +fill_lut (uint32_t *lookup, uint32_t mask, int sh, unsigned short low, unsigned short high) +{ + for (int i = 0; i <= mask >> sh; i++) + { + uint32_t tmp; + tmp = i * high; + tmp += (mask >> sh) * low; + lookup[i] = (tmp / 0xffff) << sh; + } +} + static void shade_ximage (Visual *visual, XImage *ximage, int shade, const rgba &c) { @@ -1443,7 +1457,6 @@ uint32_t *lookup, *lookup_r, *lookup_g, *lookup_b; rgba low; rgba high; - int i; int host_byte_order = ecb_big_endian () ? MSBFirst : LSBFirst; if (visual->c_class != TrueColor || ximage->format != ZPixmap) return; @@ -1535,27 +1548,9 @@ } /* fill our lookup tables */ - for (i = 0; i <= mask_r>>sh_r; i++) - { - uint32_t tmp; - tmp = i * high.r; - tmp += (mask_r>>sh_r) * low.r; - lookup_r[i] = (tmp/65535)<>sh_g; i++) - { - uint32_t tmp; - tmp = i * high.g; - tmp += (mask_g>>sh_g) * low.g; - lookup_g[i] = (tmp/65535)<>sh_b; i++) - { - uint32_t tmp; - tmp = i * high.b; - tmp += (mask_b>>sh_b) * low.b; - lookup_b[i] = (tmp/65535)<bits_per_pixel == 32