From 5321c4c754584a2022f6be31d5fa0a52097bc60d Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Tue, 7 Feb 2012 11:12:45 +0000 Subject: [PATCH] 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 Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/6bbef9a0f62eff11dc7b9c13292bad782cfb2c0b Author: Michael Liebmann Date: 2012-02-07 (Tue, 07 Feb 2012) Origin message was: ------------------ * 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 --- src/driver/framebuffer.cpp | 4 +++- src/driver/framebuffer.h | 4 ++-- src/driver/pictureviewer/pictureviewer.cpp | 15 ++++++++++++++- src/driver/pictureviewer/pictureviewer.h | 2 ++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/driver/framebuffer.cpp b/src/driver/framebuffer.cpp index d4ae3c40f..5f84f50f4 100644 --- a/src/driver/framebuffer.cpp +++ b/src/driver/framebuffer.cpp @@ -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 offset is a color offset (probably only useful with palette) */ 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; int width, height; @@ -1053,6 +1053,8 @@ _display: if (h != 0) yy += (h - height) / 2; + if (paintBg) + paintBoxRel(x, yy, width, height, colBg); blit2FB(data, width, height, x, yy, 0, 0, true); return true; diff --git a/src/driver/framebuffer.h b/src/driver/framebuffer.h index d9a498b1c..c042c4d01 100644 --- a/src/driver/framebuffer.h +++ b/src/driver/framebuffer.h @@ -177,8 +177,8 @@ class CFrameBuffer 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 */ - bool paintIcon (const std::string & filename, const int x, const int y, - const int h = 0, const unsigned char offset = 1, bool paint = true); + bool paintIcon (const std::string & filename, const int x, const int y, + 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); void loadPal (const std::string & filename, const unsigned char offset = 0, const unsigned char endidx = 255); diff --git a/src/driver/pictureviewer/pictureviewer.cpp b/src/driver/pictureviewer/pictureviewer.cpp index 83e678220..44209f8ad 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -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) +{ + 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 */ fb_pixel_t * data = getImage(name, width, height); 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); return true; } diff --git a/src/driver/pictureviewer/pictureviewer.h b/src/driver/pictureviewer/pictureviewer.h index bd7c8f295..eb1619ce5 100644 --- a/src/driver/pictureviewer/pictureviewer.h +++ b/src/driver/pictureviewer/pictureviewer.h @@ -64,6 +64,7 @@ class CPictureViewer void SetVisible(int startx, int endx, int starty, int endy); 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, const fb_pixel_t colBg); 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); 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*)); 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); + bool int_DisplayImage (const std::string & name, int posx, int posy, int width, int height, bool paintBg, const fb_pixel_t colBg=0); };