CComponentsPicture: use current instance of CPictureViewer

reduce precautionary too much unnecessary impact
This commit is contained in:
2014-06-25 09:58:21 +02:00
parent c2bc275d5d
commit e6f6931b72
3 changed files with 9 additions and 8 deletions

View File

@@ -66,7 +66,7 @@ class CPictureViewer
static double m_aspect_ratio_correction; 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 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); // 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 * getImage (const std::string & name, int width, int height);
fb_pixel_t * getIcon (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); void getSize(const char *name, int* width, int *height);

View File

@@ -34,6 +34,7 @@
#include <unistd.h> #include <unistd.h>
#include <system/debug.h> #include <system/debug.h>
extern CPictureViewer * g_PicViewer;
using namespace std; 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; is_image_painted= false;
do_paint = true; do_paint = true;
getSupportedImageFormats(v_ext); g_PicViewer->getSupportedImageFormats(v_ext);
v_ext.resize(unique(v_ext.begin(), v_ext.end()) - v_ext.begin()); v_ext.resize(unique(v_ext.begin(), v_ext.end()) - v_ext.begin());
initCCItem(); initCCItem();
initParent(parent); initParent(parent);
@@ -129,7 +130,7 @@ void CComponentsPicture::initCCItem()
width = w_pic; width = w_pic;
height = max(h_pic, height); 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) if (width == 0)
width = w_pic; width = w_pic;
if (height == 0) if (height == 0)
@@ -139,7 +140,7 @@ void CComponentsPicture::initCCItem()
//resize/scale image if required, if no icon mode detected, use real image size //resize/scale image if required, if no icon mode detected, use real image size
if (!is_icon){ if (!is_icon){
if (width != w_pic || height != h_pic) 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) void CComponentsPicture::getImageSize(int* width_image, int *height_image)
{ {
if (!is_icon) 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 else
frameBuffer->getIconSize(pic_name.c_str(), width_image, height_image); 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()); dprintf(DEBUG_INFO, "[CComponentsPicture] %s: paint image file: pic_name=%s\n", __func__, pic_name.c_str());
if (cc_allow_paint){ if (cc_allow_paint){
if (!is_icon) 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 else
is_image_painted = frameBuffer->paintIcon(pic_name, x_pic, y_pic, height, 1, do_paint, paint_bg, col_body); 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_id = channelId;
channel_name = channelName; 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) if (!has_logo)
pic_name = alt_pic_name; pic_name = alt_pic_name;

View File

@@ -40,7 +40,7 @@
Picture is usable as an object like each other CCItems. Picture is usable as an object like each other CCItems.
*/ */
class CComponentsPicture : public CComponentsItem, public CPictureViewer class CComponentsPicture : public CComponentsItem
{ {
protected: protected:
///possible image formats ///possible image formats