diff --git a/src/driver/fb_accel.h b/src/driver/fb_accel.h index 92f865f32..b98d2344c 100644 --- a/src/driver/fb_accel.h +++ b/src/driver/fb_accel.h @@ -98,7 +98,7 @@ class CFbAccelCSNevis void paintRect(const int x, const int y, const int dx, const int dy, const fb_pixel_t col); void paintLine(int xa, int ya, int xb, int yb, const fb_pixel_t col); void paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, int radius = 0, int type = CORNER_ALL); - void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp = 0, uint32_t yp = 0, bool transp = false); + void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp = 0, uint32_t yp = 0, bool transp = false, uint32_t unscaled_w = 0, uint32_t unscaled_h = 0); //NI void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff); void waitForIdle(const char *func = NULL); fb_pixel_t * getBackBufferPointer() const; @@ -121,7 +121,7 @@ class CFbAccelCSApollo void paintHLineRelInternal(int x, int dx, int y, const fb_pixel_t col); void paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, int radius = 0, int type = CORNER_ALL); - void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp = 0, uint32_t yp = 0, bool transp = false); + void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp = 0, uint32_t yp = 0, bool transp = false, uint32_t unscaled_w = 0, uint32_t unscaled_h = 0); //NI void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff); void setBlendMode(uint8_t); void setBlendLevel(int); diff --git a/src/driver/fb_accel_cs_apollo.cpp b/src/driver/fb_accel_cs_apollo.cpp index 73dc19d7c..4861308e4 100644 --- a/src/driver/fb_accel_cs_apollo.cpp +++ b/src/driver/fb_accel_cs_apollo.cpp @@ -152,7 +152,7 @@ void CFbAccelCSApollo::paintBoxRel(const int x, const int y, const int dx, const checkFbArea(x, y, dx, dy, false); } -void CFbAccelCSApollo::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp) +void CFbAccelCSApollo::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp, uint32_t unscaled_w, uint32_t unscaled_h) //NI { int xc, yc; xc = (width > xRes) ? xRes : width; @@ -171,7 +171,7 @@ void CFbAccelCSApollo::blit2FB(void *fbbuff, uint32_t width, uint32_t height, ui //printf(">>>>>[%s:%d] Use HW accel\n", __func__, __LINE__); return; } - CFrameBuffer::blit2FB(fbbuff, width, height, xoff, yoff, xp, yp, transp); + CFrameBuffer::blit2FB(fbbuff, width, height, xoff, yoff, xp, yp, transp, unscaled_w, unscaled_h); //NI //printf(">>>>>[%s:%d] NO HW accel\n", __func__, __LINE__); } diff --git a/src/driver/fb_accel_cs_nevis.cpp b/src/driver/fb_accel_cs_nevis.cpp index d13819675..246529020 100644 --- a/src/driver/fb_accel_cs_nevis.cpp +++ b/src/driver/fb_accel_cs_nevis.cpp @@ -284,7 +284,7 @@ void CFbAccelCSNevis::paintBoxRel(const int x, const int y, const int dx, const checkFbArea(x, y, dx, dy, false); } -void CFbAccelCSNevis::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp) +void CFbAccelCSNevis::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp, uint32_t unscaled_w, uint32_t unscaled_h) //NI { int xc, yc; xc = (width > xRes) ? xRes : width; @@ -308,7 +308,7 @@ void CFbAccelCSNevis::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uin //printf(">>>>>[%s:%d] Use HW accel\n", __func__, __LINE__); return; } - CFrameBuffer::blit2FB(fbbuff, width, height, xoff, yoff, xp, yp, transp); + CFrameBuffer::blit2FB(fbbuff, width, height, xoff, yoff, xp, yp, transp, unscaled_w, unscaled_h); //NI //printf(">>>>>[%s:%d] NO HW accel\n", __func__, __LINE__); } diff --git a/src/driver/fb_accel_glfb.cpp b/src/driver/fb_accel_glfb.cpp index f6784c48f..905e83245 100644 --- a/src/driver/fb_accel_glfb.cpp +++ b/src/driver/fb_accel_glfb.cpp @@ -75,9 +75,9 @@ CFbAccelGLFB::~CFbAccelGLFB() } } -void CFbAccelGLFB::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp) +void CFbAccelGLFB::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp, uint32_t unscaled_w, uint32_t unscaled_h) //NI { - CFrameBuffer::blit2FB(fbbuff, width, height, xoff, yoff, xp, yp, transp); + CFrameBuffer::blit2FB(fbbuff, width, height, xoff, yoff, xp, yp, transp, unscaled_w, unscaled_h); //NI blit(); } diff --git a/src/driver/fb_generic.cpp b/src/driver/fb_generic.cpp index 90ac9ad5f..31fbdca31 100644 --- a/src/driver/fb_generic.cpp +++ b/src/driver/fb_generic.cpp @@ -253,7 +253,7 @@ nolfb: } -CFrameBuffer::~CFrameBuffer() +void CFrameBuffer::clearIconCache() { std::map::iterator it; @@ -262,6 +262,11 @@ CFrameBuffer::~CFrameBuffer() cs_free_uncached(it->second.data); } icon_cache.clear(); +} + +CFrameBuffer::~CFrameBuffer() +{ + clearIconCache(); //NI if (background) { delete[] background; @@ -1677,13 +1682,22 @@ void * CFrameBuffer::convertRGBA2FB(unsigned char *rgbbuff, unsigned long x, uns return int_convertRGB2FB(rgbbuff, x, y, 0, true); } -void CFrameBuffer::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool /*transp*/) +void CFrameBuffer::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool /*transp*/, uint32_t unscaled_w, uint32_t unscaled_h) //NI { int xc, yc; xc = (width > xRes) ? xRes : width; yc = (height > yRes) ? yRes : height; +//FIXME +#if 0 + //NI + if(unscaled_w != 0 && (int)unscaled_w < xc) + xc = unscaled_w; + if(unscaled_h != 0 && (int)unscaled_h < yc) + yc = unscaled_h; +#endif + fb_pixel_t* data = (fb_pixel_t *) fbbuff; uint8_t * d = ((uint8_t *)getFrameBufferPointer()) + xoff * sizeof(fb_pixel_t) + stride * yoff; diff --git a/src/driver/fb_generic.h b/src/driver/fb_generic.h index a7e24bf85..892e8b2fd 100644 --- a/src/driver/fb_generic.h +++ b/src/driver/fb_generic.h @@ -266,11 +266,14 @@ class CFrameBuffer : public sigc::trackable void* convertRGB2FB(unsigned char *rgbbuff, unsigned long x, unsigned long y, int transp = 0xFF); void* convertRGBA2FB(unsigned char *rgbbuff, unsigned long x, unsigned long y); void displayRGB(unsigned char *rgbbuff, int x_size, int y_size, int x_pan, int y_pan, int x_offs, int y_offs, bool clearfb = true, int transp = 0xFF); - virtual void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp = 0, uint32_t yp = 0, bool transp = false); + virtual void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp = 0, uint32_t yp = 0, bool transp = false, uint32_t unscaled_w = 0, uint32_t unscaled_h = 0); //NI void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff); virtual void mark(int x, int y, int dx, int dy); + //NI + void clearIconCache(); + enum { TM_EMPTY = 0, diff --git a/src/driver/pictureviewer/pictureviewer.cpp b/src/driver/pictureviewer/pictureviewer.cpp index 08e5980b8..eeb4cbfb6 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -644,8 +644,13 @@ bool CPictureViewer::DisplayImage(const std::string & name, int posx, int posy, //NI bool CPictureViewer::DisplayImage_unscaled(const std::string & name, int posx, int posy, int width, int height, int transp) { - int fb_w = width; - int fb_h = height; + if(width < 1 || height < 1){ + dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] Error: width %i height %i \n", __func__, __LINE__, width, height); + return false; + } + + int unscaled_w = width; + int unscaled_h = height; CFrameBuffer* frameBuffer = CFrameBuffer::getInstance(); if (transp > CFrameBuffer::TM_EMPTY) @@ -658,7 +663,7 @@ bool CPictureViewer::DisplayImage_unscaled(const std::string & name, int posx, i frameBuffer->SetTransparentDefault(); if(data) { - frameBuffer->blit2FB_unscaled(data, width, height, posx, posy, fb_w, fb_h); + frameBuffer->blit2FB(data, width, height, posx, posy, 0, 0, transp, unscaled_w, unscaled_h); cs_free_uncached(data); return true; } diff --git a/src/driver/pictureviewer/pictureviewer.h b/src/driver/pictureviewer/pictureviewer.h index 92e0cb50f..100441b6f 100644 --- a/src/driver/pictureviewer/pictureviewer.h +++ b/src/driver/pictureviewer/pictureviewer.h @@ -76,7 +76,7 @@ class CPictureViewer void getSupportedImageFormats(std::vector& erw); //NI - bool DisplayImage_unscaled(const std::string & name, int posx, int posy, int width, int height, int transp=CFrameBuffer::TM_EMPTY); + bool DisplayImage_unscaled(const std::string & name, int posx, int posy, int width, int height, int transp=0 /*CFrameBuffer::TM_EMPTY*/); private: CFormathandler *fh_root; diff --git a/src/gui/imdb.h b/src/gui/imdb.h index 74296cd30..ffc911ebd 100644 --- a/src/gui/imdb.h +++ b/src/gui/imdb.h @@ -28,6 +28,7 @@ #include #include +#include class CIMDB {