diff options
author | Richard Hestilow <hestilow@ximian.com> | 2001-06-20 16:36:01 +0000 |
---|---|---|
committer | Rachel Hestilow <hestgray@src.gnome.org> | 2001-06-20 16:36:01 +0000 |
commit | efc06f6cc780b766a703c5dab4bcecae01bb7a27 (patch) | |
tree | f847c4ba4bfe4a8f3f8cad5ef4ab3917dcb25ac5 | |
parent | a5f7ac1dab3aa2ee086a6b9f36a6fbd4c1df15b0 (diff) | |
download | gnome-control-center-efc06f6cc780b766a703c5dab4bcecae01bb7a27.tar.gz |
Handle properly the case where centered/tiled image is larger than the
2001-06-20 Richard Hestilow <hestilow@ximian.com>
* capplets/new-background-properties/applicer.c
(get_geometry): Handle properly the case where centered/tiled
image is larger than the screen/preview.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | capplets/background/applier.c | 20 |
2 files changed, 20 insertions, 6 deletions
@@ -1,3 +1,9 @@ +2001-06-20 Richard Hestilow <hestilow@ximian.com> + + * capplets/new-background-properties/applicer.c + (get_geometry): Handle properly the case where centered/tiled + image is larger than the screen/preview. + 2001-06-20 Bradford Hovinen <hovinen@ximian.com> * capplets/new-background-properties/applier.c diff --git a/capplets/background/applier.c b/capplets/background/applier.c index 13fd97f2c..61954c2fb 100644 --- a/capplets/background/applier.c +++ b/capplets/background/applier.c @@ -1084,35 +1084,43 @@ get_geometry (wallpaper_type_t wallpaper_type, GdkPixbuf *pixbuf, else factor = 1.0; - *rwidth = gdk_pixbuf_get_width (pixbuf) * factor; - /* wallpaper_type could be WPTYPE_TILED too */ if (vwidth < gdk_pixbuf_get_width (pixbuf) && wallpaper_type == WPTYPE_CENTERED) + { *srcx = (gdk_pixbuf_get_width (pixbuf) - vwidth) * factor / 2; + *rwidth = dwidth; + } else + { *srcx = 0; + *rwidth = gdk_pixbuf_get_width (pixbuf) * factor; + } if (dheight != vheight) factor = (gdouble) dheight / (gdouble) vheight; else factor = 1.0; - *rheight = gdk_pixbuf_get_height (pixbuf) * factor; - /* wallpaper_type could be WPTYPE_TILED too */ if (vheight < gdk_pixbuf_get_height (pixbuf) && wallpaper_type == WPTYPE_CENTERED) + { *srcy = (gdk_pixbuf_get_height (pixbuf) - vheight) * factor / 2; + *rheight = dheight; + } else + { *srcy = 0; + *rheight = gdk_pixbuf_get_height (pixbuf) * factor; + } /* wallpaper_type could be WPTYPE_TILED too */ if (wallpaper_type == WPTYPE_CENTERED) { - *xoffset = (dwidth - *rwidth) >> 1; - *yoffset = (dheight - *rheight) >> 1; + *xoffset = MAX ((dwidth - *rwidth) >> 1, 0); + *yoffset = MAX ((dheight - *rheight) >> 1, 0); } break; |