From cdfd1db671fd880a548017f10afda55c9b87d91d Mon Sep 17 00:00:00 2001 From: fgerlits Date: Wed, 6 Dec 2006 16:42:04 +0000 Subject: [PATCH] don't resize the station logo image if we don't have to --- .../gLiveSupport/src/MasterPanelWindow.cxx | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/campcaster/src/products/gLiveSupport/src/MasterPanelWindow.cxx b/campcaster/src/products/gLiveSupport/src/MasterPanelWindow.cxx index 6a8ed17f2..ea3bfe273 100644 --- a/campcaster/src/products/gLiveSupport/src/MasterPanelWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/MasterPanelWindow.cxx @@ -802,17 +802,18 @@ resizeImage(Gtk::Image* image, int width, int height) throw () int imageWidth = pixbuf->get_width(); int imageHeight = pixbuf->get_height(); - // this is integerese for (logoWidth/logoHeight > width/height) - if (imageWidth * height > imageHeight * width) { - // image is wide: squash horizontally - image->set(pixbuf->scale_simple(width, - (imageHeight * width)/imageWidth, - Gdk::INTERP_HYPER )); - } else { - // image is tall: squash vertically - image->set(pixbuf->scale_simple((imageWidth * height)/imageHeight, - height, - Gdk::INTERP_HYPER )); + if (imageWidth > width || imageHeight > height) { + if (imageWidth * height > imageHeight * width) { + // image is wide: squash horizontally + image->set(pixbuf->scale_simple(width, + (imageHeight * width)/imageWidth, + Gdk::INTERP_HYPER )); + } else { + // image is tall: squash vertically + image->set(pixbuf->scale_simple((imageWidth * height)/imageHeight, + height, + Gdk::INTERP_HYPER )); + } } }