From 96f9eaf287ce584a673d18a661eae7e10b7daab7 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 8 Feb 2016 21:14:41 +0100 Subject: [PATCH] CComponentsPicture: move resize to end of methode --- src/gui/components/cc_item_picture.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index c0828fbcd..0dc7abb45 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -109,6 +109,8 @@ void CComponentsPicture::setPicture(const std::string& picture_name) { if (pic_name == picture_name) return; + width = dx = dxc = 0; + height = dy = dyc = 0; need_init = true; clearCache(); pic_name = picture_name; @@ -209,17 +211,10 @@ void CComponentsPicture::initCCItem() if (width == dx && height == dy) return; - /* finally handle scale behavior * This evaluates the parameters given * by setters setWidth/setHeight - */ - //resize image and apply current assigned scale values - int w_2scale = width; - int h_2scale = height; - g_PicViewer->rescaleImageDimensions(&width, &height, w_2scale, h_2scale); - - /* these steps are required to assign the current image dimensions to item dimensions + * these steps are required to assign the current image dimensions to item dimensions */ if (keep_dx_aspect){ float h_ratio = float(height)*100/(float)dy; @@ -233,6 +228,11 @@ void CComponentsPicture::initCCItem() float w_ratio = float(width)*100/(float)dx; height = int(w_ratio*(float)dy/100); } + + //resize image and apply current assigned scale values + int w_2scale = width; + int h_2scale = height; + g_PicViewer->rescaleImageDimensions(&width, &height, w_2scale, h_2scale); } void CComponentsPicture::initPosition(int *x_position, int *y_position)