From e6f6931b72e74d8b9246b427c7c6040d1f2c5b3d Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 25 Jun 2014 09:58:21 +0200 Subject: [PATCH] CComponentsPicture: use current instance of CPictureViewer reduce precautionary too much unnecessary impact --- src/driver/pictureviewer/pictureviewer.h | 2 +- src/gui/components/cc_item_picture.cpp | 13 +++++++------ src/gui/components/cc_item_picture.h | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/driver/pictureviewer/pictureviewer.h b/src/driver/pictureviewer/pictureviewer.h index 4326c45d4..8183f1943 100644 --- a/src/driver/pictureviewer/pictureviewer.h +++ b/src/driver/pictureviewer/pictureviewer.h @@ -66,7 +66,7 @@ class CPictureViewer static double m_aspect_ratio_correction; bool DisplayImage (const std::string & name, int posx, int posy, int width, int height, int transp=CFrameBuffer::TM_EMPTY); // bool DisplayLogo (uint64_t channel_id, int posx, int posy, int width, int height); - virtual bool GetLogoName(const uint64_t& channel_id, const std::string& ChanName, std::string & name, int *width = NULL, int *height = NULL); + bool GetLogoName(const uint64_t& channel_id, const std::string& ChanName, std::string & name, int *width = NULL, int *height = NULL); fb_pixel_t * getImage (const std::string & name, int width, int height); fb_pixel_t * getIcon (const std::string & name, int *width, int *height); void getSize(const char *name, int* width, int *height); diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index ba9bf9cd4..c34905f94 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -34,6 +34,7 @@ #include #include +extern CPictureViewer * g_PicViewer; using namespace std; @@ -85,7 +86,7 @@ void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w, is_image_painted= false; do_paint = true; - getSupportedImageFormats(v_ext); + g_PicViewer->getSupportedImageFormats(v_ext); v_ext.resize(unique(v_ext.begin(), v_ext.end()) - v_ext.begin()); initCCItem(); initParent(parent); @@ -129,7 +130,7 @@ void CComponentsPicture::initCCItem() width = w_pic; height = max(h_pic, height); } - else{ //defined values ​​in constructor or defined via setters defined, have priority, value 0 is not allowed + else{ //defined values in constructor or defined via setters defined, have priority, value 0 is not allowed if (width == 0) width = w_pic; if (height == 0) @@ -139,7 +140,7 @@ void CComponentsPicture::initCCItem() //resize/scale image if required, if no icon mode detected, use real image size if (!is_icon){ if (width != w_pic || height != h_pic) - rescaleImageDimensions(&w_pic, &h_pic, width, height); + g_PicViewer->rescaleImageDimensions(&w_pic, &h_pic, width, height); } } @@ -159,7 +160,7 @@ void CComponentsPicture::initPosition(int *x_position, int *y_position) void CComponentsPicture::getImageSize(int* width_image, int *height_image) { if (!is_icon) - CPictureViewer::getSize(pic_name.c_str(), width_image, height_image); + g_PicViewer->getSize(pic_name.c_str(), width_image, height_image); else frameBuffer->getIconSize(pic_name.c_str(), width_image, height_image); } @@ -178,7 +179,7 @@ void CComponentsPicture::paintPicture() dprintf(DEBUG_INFO, "[CComponentsPicture] %s: paint image file: pic_name=%s\n", __func__, pic_name.c_str()); if (cc_allow_paint){ if (!is_icon) - is_image_painted = DisplayImage(pic_name, x_pic, y_pic, width, height); + is_image_painted = g_PicViewer->DisplayImage(pic_name, x_pic, y_pic, width, height); else is_image_painted = frameBuffer->paintIcon(pic_name, x_pic, y_pic, height, 1, do_paint, paint_bg, col_body); } @@ -248,7 +249,7 @@ void CComponentsChannelLogo::setChannel(const uint64_t& channelId, const std::st channel_id = channelId; channel_name = channelName; - has_logo = GetLogoName(channel_id, channel_name, pic_name, &width, &height); + has_logo = g_PicViewer->GetLogoName(channel_id, channel_name, pic_name, &width, &height); if (!has_logo) pic_name = alt_pic_name; diff --git a/src/gui/components/cc_item_picture.h b/src/gui/components/cc_item_picture.h index 57b8a97ca..4796d2216 100644 --- a/src/gui/components/cc_item_picture.h +++ b/src/gui/components/cc_item_picture.h @@ -40,7 +40,7 @@ Picture is usable as an object like each other CCItems. */ -class CComponentsPicture : public CComponentsItem, public CPictureViewer +class CComponentsPicture : public CComponentsItem { protected: ///possible image formats