CComponentsPicture: add methode to get real image size

Origin commit data
------------------
Commit: 0aae491ccc
Author: Thilo Graf <dbt@novatux.de>
Date: 2017-04-25 (Tue, 25 Apr 2017)
This commit is contained in:
2017-04-25 11:21:44 +02:00
parent e1d1338c0a
commit beac8c69aa
2 changed files with 20 additions and 11 deletions

View File

@@ -76,6 +76,7 @@ void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w,
y = y_old = y_pos;
width = width_old = dx = dxc = w;
height = height_old = dy = dyc = h;
dx_orig = dy_orig = 0;
pic_name = pic_name_old = image_name;
shadow = shadow_mode;
shadow_w = OFFSET_SHADOW;
@@ -201,6 +202,9 @@ void CComponentsPicture::initCCItem()
if (height == 0)
height = dy_tmp;
}
dx_orig = width;
dy_orig = height;
/* leave init methode here if we in no scale mode
* otherwise goto next step!
*/
@@ -211,8 +215,12 @@ void CComponentsPicture::initCCItem()
* check internal dimension values (dx/dy) and ensure that values are >0
* real image size
*/
if ((dx != width || dy != height) || (dx == 0 || dy == 0))
g_PicViewer->getSize(pic_name.c_str(), &dx, &dy);
g_PicViewer->getSize(pic_name.c_str(), &dx_orig, &dy_orig);
if ((dx != width || dy != height) || (dx == 0 || dy == 0)){
dx = dx_orig;
dy = dy_orig;
//g_PicViewer->getSize(pic_name.c_str(), &dx, &dy);
}
}
/* on next step check item dimensions (width/height) for 0 values
@@ -269,11 +277,11 @@ void CComponentsPicture::initPosition(int *x_position, int *y_position)
}
// void CComponentsPicture::getSize(int* width_image, int *height_image)
// {
// *width_image = width;
// *height_image = height;
// }
void CComponentsPicture::getRealSize(int* dx_original, int *dy_original)
{
*dx_original = dx_orig;
*dy_original = dy_orig;
}
int CComponentsPicture::getWidth()
{