CComponentsPicture: add methode to get real image size

This commit is contained in:
2017-04-25 11:21:44 +02:00
parent cffab5f8f9
commit 0aae491ccc
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; y = y_old = y_pos;
width = width_old = dx = dxc = w; width = width_old = dx = dxc = w;
height = height_old = dy = dyc = h; height = height_old = dy = dyc = h;
dx_orig = dy_orig = 0;
pic_name = pic_name_old = image_name; pic_name = pic_name_old = image_name;
shadow = shadow_mode; shadow = shadow_mode;
shadow_w = OFFSET_SHADOW; shadow_w = OFFSET_SHADOW;
@@ -201,6 +202,9 @@ void CComponentsPicture::initCCItem()
if (height == 0) if (height == 0)
height = dy_tmp; height = dy_tmp;
} }
dx_orig = width;
dy_orig = height;
/* leave init methode here if we in no scale mode /* leave init methode here if we in no scale mode
* otherwise goto next step! * otherwise goto next step!
*/ */
@@ -211,8 +215,12 @@ void CComponentsPicture::initCCItem()
* check internal dimension values (dx/dy) and ensure that values are >0 * check internal dimension values (dx/dy) and ensure that values are >0
* real image size * real image size
*/ */
if ((dx != width || dy != height) || (dx == 0 || dy == 0)) g_PicViewer->getSize(pic_name.c_str(), &dx_orig, &dy_orig);
g_PicViewer->getSize(pic_name.c_str(), &dx, &dy); 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 /* 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) void CComponentsPicture::getRealSize(int* dx_original, int *dy_original)
// { {
// *width_image = width; *dx_original = dx_orig;
// *height_image = height; *dy_original = dy_orig;
// } }
int CComponentsPicture::getWidth() int CComponentsPicture::getWidth()
{ {

View File

@@ -54,9 +54,10 @@ class CComponentsPicture : public CComponentsItem
///screen cache content for painted image ///screen cache content for painted image
fb_pixel_t *image_cache; fb_pixel_t *image_cache;
///current original image dimensions ///current image dimensions
int dx, dy; int dx, dy;
///original image dimensions
int dx_orig, dy_orig;
///cached image dimensions ///cached image dimensions
int dxc, dyc; int dxc, dyc;
@@ -146,8 +147,8 @@ class CComponentsPicture : public CComponentsItem
///returns current assigned image name ///returns current assigned image name
std::string getPictureName(){return pic_name;} std::string getPictureName(){return pic_name;}
// ///handle image size ///get original image size
// void getSize(int* width_image, int *height_image); void getRealSize(int* dx_orig, int *dy_orig);
///return width of item ///return width of item
int getWidth(); int getWidth();
///return height of item ///return height of item