From 402c810c11bc01dae86da6450f4750b0a7d6b06f 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 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/96f9eaf287ce584a673d18a661eae7e10b7daab7 Author: Thilo Graf Date: 2016-02-08 (Mon, 08 Feb 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- 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)