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.
This commit is contained in:
parent
a5f7ac1dab
commit
efc06f6cc7
2 changed files with 20 additions and 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>
|
2001-06-20 Bradford Hovinen <hovinen@ximian.com>
|
||||||
|
|
||||||
* capplets/new-background-properties/applier.c
|
* capplets/new-background-properties/applier.c
|
||||||
|
|
|
@ -1084,35 +1084,43 @@ get_geometry (wallpaper_type_t wallpaper_type, GdkPixbuf *pixbuf,
|
||||||
else
|
else
|
||||||
factor = 1.0;
|
factor = 1.0;
|
||||||
|
|
||||||
*rwidth = gdk_pixbuf_get_width (pixbuf) * factor;
|
|
||||||
|
|
||||||
/* wallpaper_type could be WPTYPE_TILED too */
|
/* wallpaper_type could be WPTYPE_TILED too */
|
||||||
if (vwidth < gdk_pixbuf_get_width (pixbuf) &&
|
if (vwidth < gdk_pixbuf_get_width (pixbuf) &&
|
||||||
wallpaper_type == WPTYPE_CENTERED)
|
wallpaper_type == WPTYPE_CENTERED)
|
||||||
|
{
|
||||||
*srcx = (gdk_pixbuf_get_width (pixbuf) - vwidth) *
|
*srcx = (gdk_pixbuf_get_width (pixbuf) - vwidth) *
|
||||||
factor / 2;
|
factor / 2;
|
||||||
|
*rwidth = dwidth;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
*srcx = 0;
|
*srcx = 0;
|
||||||
|
*rwidth = gdk_pixbuf_get_width (pixbuf) * factor;
|
||||||
|
}
|
||||||
|
|
||||||
if (dheight != vheight)
|
if (dheight != vheight)
|
||||||
factor = (gdouble) dheight / (gdouble) vheight;
|
factor = (gdouble) dheight / (gdouble) vheight;
|
||||||
else
|
else
|
||||||
factor = 1.0;
|
factor = 1.0;
|
||||||
|
|
||||||
*rheight = gdk_pixbuf_get_height (pixbuf) * factor;
|
|
||||||
|
|
||||||
/* wallpaper_type could be WPTYPE_TILED too */
|
/* wallpaper_type could be WPTYPE_TILED too */
|
||||||
if (vheight < gdk_pixbuf_get_height (pixbuf) &&
|
if (vheight < gdk_pixbuf_get_height (pixbuf) &&
|
||||||
wallpaper_type == WPTYPE_CENTERED)
|
wallpaper_type == WPTYPE_CENTERED)
|
||||||
|
{
|
||||||
*srcy = (gdk_pixbuf_get_height (pixbuf) - vheight) *
|
*srcy = (gdk_pixbuf_get_height (pixbuf) - vheight) *
|
||||||
factor / 2;
|
factor / 2;
|
||||||
|
*rheight = dheight;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
*srcy = 0;
|
*srcy = 0;
|
||||||
|
*rheight = gdk_pixbuf_get_height (pixbuf) * factor;
|
||||||
|
}
|
||||||
|
|
||||||
/* wallpaper_type could be WPTYPE_TILED too */
|
/* wallpaper_type could be WPTYPE_TILED too */
|
||||||
if (wallpaper_type == WPTYPE_CENTERED) {
|
if (wallpaper_type == WPTYPE_CENTERED) {
|
||||||
*xoffset = (dwidth - *rwidth) >> 1;
|
*xoffset = MAX ((dwidth - *rwidth) >> 1, 0);
|
||||||
*yoffset = (dheight - *rheight) >> 1;
|
*yoffset = MAX ((dheight - *rheight) >> 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue