Add padding if icon width and height differ.

2002-04-21  Anders Carlsson  <andersca@gnu.org>

	* src/iconcache.c (scaled_from_pixdata): Add padding if
	icon width and height differ.
This commit is contained in:
Anders Carlsson 2002-04-21 20:17:44 +00:00 committed by Anders Carlsson
parent f5c10f387b
commit 6603ee6084
2 changed files with 26 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2002-04-21 Anders Carlsson <andersca@gnu.org>
* src/iconcache.c (scaled_from_pixdata): Add padding if
icon width and height differ.
2002-04-17 Havoc Pennington <hp@pobox.com>
* src/screen.c (meta_screen_new): query Xinerama screen

View File

@ -644,6 +644,27 @@ scaled_from_pixdata (guchar *pixdata,
if (src == NULL)
return NULL;
if (w != h)
{
GdkPixbuf *tmp;
int size;
size = MAX (w, h);
tmp = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, size, size);
if (tmp)
{
gdk_pixbuf_fill (tmp, 0);
gdk_pixbuf_copy_area (src, 0, 0, w, h,
tmp,
(size - w) / 2, (size - h) / 2);
g_object_unref (src);
src = tmp;
}
}
if (w != new_w || h != new_h)
{
dest = gdk_pixbuf_scale_simple (src, new_w, new_h, GDK_INTERP_BILINEAR);