* Add paint background to paintIcon() / DisplayImage()

- paint background before display icon in CFrameBuffer::paintIcon()
- paint background before display image in CPictureViewer::DisplayImage()

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@2082 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
micha-bbg
2012-02-07 11:12:45 +00:00
parent e65cd22ebe
commit 6bbef9a0f6
4 changed files with 21 additions and 4 deletions

View File

@@ -956,7 +956,7 @@ bool CFrameBuffer::blitToPrimary(unsigned int *, int, int, int, int)
if height h is given, center vertically between y and y+h if height h is given, center vertically between y and y+h
offset is a color offset (probably only useful with palette) */ offset is a color offset (probably only useful with palette) */
bool CFrameBuffer::paintIcon(const std::string & filename, const int x, const int y, bool CFrameBuffer::paintIcon(const std::string & filename, const int x, const int y,
const int h, const unsigned char offset, bool paint) const int h, const unsigned char offset, bool paint, bool paintBg, const fb_pixel_t colBg)
{ {
struct rawHeader header; struct rawHeader header;
int width, height; int width, height;
@@ -1053,6 +1053,8 @@ _display:
if (h != 0) if (h != 0)
yy += (h - height) / 2; yy += (h - height) / 2;
if (paintBg)
paintBoxRel(x, yy, width, height, colBg);
blit2FB(data, width, height, x, yy, 0, 0, true); blit2FB(data, width, height, x, yy, 0, 0, true);
return true; return true;

View File

@@ -177,8 +177,8 @@ class CFrameBuffer
void getIconSize(const char * const filename, int* width, int *height); void getIconSize(const char * const filename, int* width, int *height);
/* h is the height of the target "window", if != 0 the icon gets centered in that window */ /* h is the height of the target "window", if != 0 the icon gets centered in that window */
bool paintIcon (const std::string & filename, const int x, const int y, bool paintIcon (const std::string & filename, const int x, const int y,
const int h = 0, const unsigned char offset = 1, bool paint = true); const int h = 0, const unsigned char offset = 1, bool paint = true, bool paintBg = false, const fb_pixel_t colBg = 0);
bool paintIcon8(const std::string & filename, const int x, const int y, const unsigned char offset = 0); bool paintIcon8(const std::string & filename, const int x, const int y, const unsigned char offset = 0);
void loadPal (const std::string & filename, const unsigned char offset = 0, const unsigned char endidx = 255); void loadPal (const std::string & filename, const unsigned char offset = 0, const unsigned char endidx = 255);

View File

@@ -548,12 +548,25 @@ void CPictureViewer::rescaleImageDimensions(int *width, int *height, const int m
} }
bool CPictureViewer::DisplayImage (const std::string & name, int posx, int posy, int width, int height) bool CPictureViewer::DisplayImage (const std::string & name, int posx, int posy, int width, int height)
{
return int_DisplayImage(name, posx, posy, width, height, false);
}
bool CPictureViewer::DisplayImage(const std::string & name, int posx, int posy, int width, int height, const fb_pixel_t colBg)
{
return int_DisplayImage(name, posx, posy, width, height, true, colBg);
}
bool CPictureViewer::int_DisplayImage(const std::string & name, int posx, int posy, int width, int height, bool paintBg, const fb_pixel_t colBg)
{ {
/* TODO: cache or check for same */ /* TODO: cache or check for same */
fb_pixel_t * data = getImage(name, width, height); fb_pixel_t * data = getImage(name, width, height);
if(data) { if(data) {
CFrameBuffer::getInstance()->blit2FB(data, width, height, posx, posy); CFrameBuffer* frameBuffer = CFrameBuffer::getInstance();
if (paintBg)
frameBuffer->paintBoxRel(posx, posy, width, height, colBg);
frameBuffer->blit2FB(data, width, height, posx, posy);
cs_free_uncached(data); cs_free_uncached(data);
return true; return true;
} }

View File

@@ -64,6 +64,7 @@ class CPictureViewer
void SetVisible(int startx, int endx, int starty, int endy); void SetVisible(int startx, int endx, int starty, int endy);
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); bool DisplayImage (const std::string & name, int posx, int posy, int width, int height);
bool DisplayImage (const std::string & name, int posx, int posy, int width, int height, const fb_pixel_t colBg);
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);
bool GetLogoName(uint64_t channel_id, std::string ChanName, std::string & name, int *width = NULL, int *height = NULL); bool GetLogoName(uint64_t channel_id, 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);
@@ -111,6 +112,7 @@ class CPictureViewer
void add_format(int (*picsize)(const char *,int *,int*,int,int),int (*picread)(const char *,unsigned char **,int*,int*), int (*id)(const char*)); void add_format(int (*picsize)(const char *,int *,int*,int,int),int (*picread)(const char *,unsigned char **,int*,int*), int (*id)(const char*));
unsigned char * int_Resize(unsigned char *orgin, int ox, int oy, int dx, int dy, ScalingMode type, unsigned char * dst, bool alpha); unsigned char * int_Resize(unsigned char *orgin, int ox, int oy, int dx, int dy, ScalingMode type, unsigned char * dst, bool alpha);
fb_pixel_t * int_getImage(const std::string & name, int *width, int *height, bool GetImage); fb_pixel_t * int_getImage(const std::string & name, int *width, int *height, bool GetImage);
bool int_DisplayImage (const std::string & name, int posx, int posy, int width, int height, bool paintBg, const fb_pixel_t colBg=0);
}; };