From 77349f68783319c638f822d1f6dc5b3214742309 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Mon, 4 Nov 2002 20:34:25 +0000 Subject: [PATCH] fix bug I introduced in case where scaling was done in both directions. 2002-11-04 Havoc Pennington * src/theme.c (scale_and_alpha_pixbuf): fix bug I introduced in case where scaling was done in both directions. --- ChangeLog | 5 +++++ src/theme.c | 20 ++++++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8aec4a415..db1b59c51 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2002-11-04 Havoc Pennington + + * src/theme.c (scale_and_alpha_pixbuf): fix bug I introduced in + case where scaling was done in both directions. + 2002-11-04 Havoc Pennington Patch from Brian Cameron to implement the vertical/horizontal diff --git a/src/theme.c b/src/theme.c index 8ab23dee7..76e9ee605 100644 --- a/src/theme.c +++ b/src/theme.c @@ -2918,20 +2918,24 @@ scale_and_alpha_pixbuf (GdkPixbuf *src, } else { - int src_h, src_w, dest_h, dest_w, pixbuf_width, pixbuf_height; + int src_h, src_w, dest_h, dest_w; src_h = gdk_pixbuf_get_height (src); src_w = gdk_pixbuf_get_width (src); - if (vertical_stripes) - { - dest_w = width; - dest_h = gdk_pixbuf_get_height (src); - } - else if (horizontal_stripes) + /* prefer to replicate_cols if possible, as that + * is faster (no memory reads) + */ + if (horizontal_stripes) { dest_w = gdk_pixbuf_get_width (src); dest_h = height; } + else if (vertical_stripes) + { + dest_w = width; + dest_h = gdk_pixbuf_get_height (src); + } + else { dest_w = width; @@ -2941,7 +2945,7 @@ scale_and_alpha_pixbuf (GdkPixbuf *src, if (dest_w == src_w && dest_h == src_h) { temp_pixbuf = src; - g_object_ref (G_OBJECT (tmp_pixbuf)); + g_object_ref (G_OBJECT (temp_pixbuf)); } else {