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:
parent
f5c10f387b
commit
6603ee6084
@ -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>
|
2002-04-17 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
* src/screen.c (meta_screen_new): query Xinerama screen
|
* src/screen.c (meta_screen_new): query Xinerama screen
|
||||||
|
@ -644,6 +644,27 @@ scaled_from_pixdata (guchar *pixdata,
|
|||||||
if (src == NULL)
|
if (src == NULL)
|
||||||
return 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)
|
if (w != new_w || h != new_h)
|
||||||
{
|
{
|
||||||
dest = gdk_pixbuf_scale_simple (src, new_w, new_h, GDK_INTERP_BILINEAR);
|
dest = gdk_pixbuf_scale_simple (src, new_w, new_h, GDK_INTERP_BILINEAR);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user