From cabe84bf0f203045f5d2a954b220e356035a37e2 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 30 Jun 2015 21:05:01 +0200 Subject: [PATCH] CComponentsButton: fix image scale Wrong ratio calculation. --- src/gui/components/cc_frm_button.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/components/cc_frm_button.cpp b/src/gui/components/cc_frm_button.cpp index 92c193c1f..a12096937 100644 --- a/src/gui/components/cc_frm_button.cpp +++ b/src/gui/components/cc_frm_button.cpp @@ -152,12 +152,12 @@ void CComponentsButton::initIcon() cc_btn_icon = frameBuffer->getIconBasePath() + "/" + cc_btn_icon + ".png"; cc_btn_icon_obj = new CComponentsPicture(fr_thickness, y_icon, cc_btn_icon, this); - h_icon = cc_btn_icon_obj->getHeight(); + cc_btn_icon_obj->getSize(&w_icon, &h_icon); if (h_icon > (height-2*fr_thickness)){ - cc_btn_icon_obj->setHeight(height*80/100); - uint8_t h_ratio = uint8_t(height*100/h_icon); - w_icon = h_ratio*cc_btn_icon_obj->getWidth()/100; + cc_btn_icon_obj->setHeight(height-2*fr_thickness); + uint8_t h_ratio = uint8_t(h_icon/cc_btn_icon_obj->getHeight()); + w_icon = w_icon/h_ratio; cc_btn_icon_obj->setWidth(w_icon); }