diff --git a/src/driver/fb_window.h b/src/driver/fb_window.h index 10d806b6b..ec8fa857e 100644 --- a/src/driver/fb_window.h +++ b/src/driver/fb_window.h @@ -26,11 +26,7 @@ class CFBWindow { public: -#ifdef FB_USE_PALETTE - typedef unsigned short color_t; -#else typedef unsigned int color_t; -#endif typedef void * font_t; typedef void * private_data_t; diff --git a/src/driver/framebuffer.cpp b/src/driver/framebuffer.cpp index 2f4d89002..51a478933 100644 --- a/src/driver/framebuffer.cpp +++ b/src/driver/framebuffer.cpp @@ -228,7 +228,7 @@ void CFrameBuffer::init(const char * const fbDevice) } #ifdef USE_NEVIS_GXA - /* Open 7dev/mem for HW-register access */ + /* Open /dev/mem for HW-register access */ devmem_fd = open("/dev/mem", O_RDWR | O_SYNC); if (devmem_fd < 0) { perror("Unable to open /dev/mem"); @@ -331,6 +331,14 @@ nolfb: CFrameBuffer::~CFrameBuffer() { + std::map::iterator it; + + for(it = icon_cache.begin(); it != icon_cache.end(); it++) { + /* printf("FB: delete cached icon %s: %x\n", it->first.c_str(), (int) it->second.data); */ + cs_free_uncached(it->second.data); + } + icon_cache.clear(); + if (background) { delete[] background; background = NULL; @@ -740,32 +748,20 @@ void CFrameBuffer::paintVLineRel(int x, int y, int dy, const fb_pixel_t col) return; #ifdef USE_NEVIS_GXA - /* draw a single vertical line from point x/y with hight dx */ - unsigned int cmd = GXA_CMD_NOT_TEXT | GXA_SRC_BMP_SEL(2) | GXA_DST_BMP_SEL(2) | GXA_PARAM_COUNT(2) | GXA_CMD_NOT_ALPHA; + /* draw a single vertical line from point x/y with hight dx */ + unsigned int cmd = GXA_CMD_NOT_TEXT | GXA_SRC_BMP_SEL(2) | GXA_DST_BMP_SEL(2) | GXA_PARAM_COUNT(2) | GXA_CMD_NOT_ALPHA; - _write_gxa(gxa_base, GXA_FG_COLOR_REG, (unsigned int) col); /* setup the drawing color */ - _write_gxa(gxa_base, GXA_LINE_CONTROL_REG, 0x00000404); /* X is major axis, skip last pixel */ - _write_gxa(gxa_base, cmd, GXA_POINT(x, y + dy)); /* end point */ - _write_gxa(gxa_base, cmd, GXA_POINT(x, y)); /* start point */ + _write_gxa(gxa_base, GXA_FG_COLOR_REG, (unsigned int) col); /* setup the drawing color */ + _write_gxa(gxa_base, GXA_LINE_CONTROL_REG, 0x00000404); /* X is major axis, skip last pixel */ + _write_gxa(gxa_base, cmd, GXA_POINT(x, y + dy)); /* end point */ + _write_gxa(gxa_base, cmd, GXA_POINT(x, y)); /* start point */ #else /* USE_NEVIS_GXA */ -#if 0 - fb_fillrect fillrect; - fillrect.dx = x; - fillrect.dy = y; - fillrect.width = 1; - fillrect.height = dy; - fillrect.color = col; - fillrect.rop = ROP_COPY; - ioctl(fd, FBIO_FILL_RECT, &fillrect); - return; -#else uint8_t * pos = ((uint8_t *)getFrameBufferPointer()) + x * sizeof(fb_pixel_t) + stride * y; for(int count=0;count::iterator it; - char *ptr = rindex(filename, '.'); - if (ptr) { - *ptr = 0; - std::string newname = iconBasePath + std::string(filename) + ".gif"; - *ptr = '.'; - if (!access(newname.c_str(), F_OK)) - return g_PicViewer->getHeight(newname.c_str()); + *width = 0; + *height = 0; + + /* if code ask for size, lets cache it. assume we have enough ram for cache */ + /* FIXME offset seems never used in code, always default = 1 ? */ + if(paintIcon(filename, 0, 0, 0, 1, false)) { + it = icon_cache.find(filename); + if(it != icon_cache.end()) { + *width = it->second.width; + *height = it->second.height; + } } - - icon_fd = open(filename, O_RDONLY); - - if (icon_fd == -1) - { - printf("Framebuffer getIconHeight: error while loading icon: %s\n", filename); - return 0; - } - else - { - read(icon_fd, &header, sizeof(struct rawHeader)); - height = (header.height_hi << 8) | header.height_lo; - } - - close(icon_fd); - return height; -} - -int CFrameBuffer::getIconWidth(const char * const filename) -{ - struct rawHeader header; - uint16_t width; - int icon_fd; - - char *ptr = rindex(filename, '.'); - if (ptr) { - *ptr = 0; - std::string newname = iconBasePath + std::string(filename) + ".gif"; - *ptr = '.'; - if (!access(newname.c_str(), F_OK)) - return g_PicViewer->getWidth(newname.c_str()); - } - - icon_fd = open(filename, O_RDONLY); - - if (icon_fd == -1) - { - printf("Framebuffer getIconWidth: error while loading icon: %s\n", filename); - width = 0; - } - else - { - read(icon_fd, &header, sizeof(struct rawHeader)); - width = (header.width_hi << 8) | header.width_lo; - } - - close(icon_fd); - return width; } bool CFrameBuffer::paintIcon8(const std::string & filename, const int x, const int y, const unsigned char offset) @@ -932,12 +882,12 @@ bool CFrameBuffer::paintIcon8(const std::string & filename, const int x, const i bool CFrameBuffer::blitToPrimary(unsigned int * data, int dx, int dy, int sw, int sh) { +#ifdef USE_NEVIS_GXA u32 cmd; void * uKva; -#ifdef USE_NEVIS_GXA uKva = cs_phys_addr(data); -printf("CFrameBuffer::blitToPrimary: data %x Kva %x\n", data, uKva); +printf("CFrameBuffer::blitToPrimary: data %x Kva %x\n", (int) data, (int) uKva); if(uKva == NULL) return false; @@ -960,7 +910,7 @@ printf("CFrameBuffer::blitToPrimary: data %x Kva %x\n", data, uKva); 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) + const int h, const unsigned char offset, bool paint) { struct rawHeader header; int width, height; @@ -1050,13 +1000,17 @@ bool CFrameBuffer::paintIcon(const std::string & filename, const int x, const in height = it->second.height; //printf("paintIcon: already cached %s %d x %d\n", newname.c_str(), width, height); } + if(!paint) + return true; + _display: if (h != 0) yy += (h - height) / 2; - if(blitToPrimary(data, x, y, width, height)) - return true; + blit2FB(data, width, height, x, yy, 0, 0, true); + return true; +#if 0 uint8_t * d = ((uint8_t *)getFrameBufferPointer()) + x * sizeof(fb_pixel_t) + stride * yy; fb_pixel_t * d2; @@ -1075,14 +1029,17 @@ _display: } return true; +#endif } +#if 0 bool CFrameBuffer::paintIcon(const char * const filename, const int x, const int y, const int h, const unsigned char offset) { //printf("%s(%s, %d, %d, %d)\n", __FUNCTION__, filename, x, y, offset); return paintIcon(std::string(filename), x, y, h, offset); } +#endif void CFrameBuffer::loadPal(const std::string & filename, const unsigned char offset, const unsigned char endidx) { @@ -1552,3 +1509,105 @@ void CFrameBuffer::Unlock() { locked = false; } + +void * CFrameBuffer::convertRGB2FB(unsigned char *rgbbuff, unsigned long x, unsigned long y, int transp) +{ + unsigned long i; + unsigned int *fbbuff; + unsigned long count = x*y; + + fbbuff = (unsigned int *) malloc(count * sizeof(unsigned int)); + if(fbbuff == NULL) + { + printf("convertRGB2FB: Error: malloc\n"); + return NULL; + } + + for(i = 0; i < count ; i++) + fbbuff[i] = (transp << 24) | ((rgbbuff[i*3] << 16) & 0xFF0000) | ((rgbbuff[i*3+1] << 8) & 0xFF00) | (rgbbuff[i*3+2] & 0xFF); + + return (void *) fbbuff; +} + +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) +{ + int xc, yc; + + xc = (width > xRes) ? xRes : width; + yc = (height > yRes) ? yRes : height; + +#ifdef USE_NEVIS_GXA + u32 cmd; + void * uKva; + + uKva = cs_phys_addr(fbbuff); + printf("CFrameBuffer::blit2FB: data %x Kva %x\n", (int) fbbuff, (int) uKva); + + if(uKva != NULL) { + cmd = GXA_CMD_BLT | GXA_CMD_NOT_TEXT | GXA_SRC_BMP_SEL(1) | GXA_DST_BMP_SEL(2) | GXA_PARAM_COUNT(3); + + _write_gxa(gxa_base, GXA_BMP1_TYPE_REG, (3 << 16) | width); + _write_gxa(gxa_base, GXA_BMP1_ADDR_REG, (unsigned int) uKva); + + _write_gxa(gxa_base, cmd, GXA_POINT(xoff, yoff)); /* destination pos */ + _write_gxa(gxa_base, cmd, GXA_POINT(xc, yc)); /* source width, FIXME real or adjusted xc, yc ? */ + _write_gxa(gxa_base, cmd, GXA_POINT(xp, yp)); /* source pos */ + + return; + } +#endif + + fb_pixel_t* data = (fb_pixel_t *) fbbuff; + + uint8_t * d = ((uint8_t *)getFrameBufferPointer()) + xoff * sizeof(fb_pixel_t) + stride * yoff; + fb_pixel_t * d2; + + for (int count = 0; count < yc; count++ ) { + fb_pixel_t *pixpos = &data[(count + yp) * width]; + d2 = (fb_pixel_t *) d; + for (int count2 = 0; count2 < xc; count2++ ) { + fb_pixel_t pix = *(pixpos + xp); + if (!transp || (pix != 0)) { + *d2 = pix; + } + d2++; + pixpos++; + } + d += stride; + } +#if 0 + for(int i = 0; i < yc; i++){ + memcpy(clfb + (i + yoff)*stride + xoff*4, ip + (i + yp)*width + xp, xc*4); + } +#endif +} + +void CFrameBuffer::displayRGB(unsigned char *rgbbuff, int x_size, int y_size, int x_pan, int y_pan, int x_offs, int y_offs, bool clearfb, int transp) +{ + void *fbbuff = NULL; + + if(rgbbuff == NULL) + return; + + /* correct panning */ + if(x_pan > x_size - (int)xRes) x_pan = 0; + if(y_pan > y_size - (int)yRes) y_pan = 0; + + /* correct offset */ + if(x_offs + x_size > (int)xRes) x_offs = 0; + if(y_offs + y_size > (int)yRes) y_offs = 0; + + /* blit buffer 2 fb */ + fbbuff = convertRGB2FB(rgbbuff, x_size, y_size, transp); + if(fbbuff==NULL) + return; + + /* ClearFB if image is smaller */ + /* if(x_size < (int)xRes || y_size < (int)yRes) */ + if(clearfb) + CFrameBuffer::getInstance()->Clear(); + + blit2FB(fbbuff, x_size, y_size, x_offs, y_offs, x_pan, y_pan); + free(fbbuff); +} + diff --git a/src/driver/framebuffer.h b/src/driver/framebuffer.h index 0960473ea..bf4d40e83 100644 --- a/src/driver/framebuffer.h +++ b/src/driver/framebuffer.h @@ -122,9 +122,6 @@ class CFrameBuffer static CFrameBuffer* getInstance(); - int getIconWidth(const char * const filename); // infos about icon dimensions - int getIconHeight(const char * const filename); - void init(const char * const fbDevice = "/dev/fb/0"); int setMode(unsigned int xRes, unsigned int yRes, unsigned int bpp); @@ -173,11 +170,10 @@ class CFrameBuffer void setIconBasePath(const std::string & iconPath); + 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 char * const filename, const int x, const int y, - const int h = 0, const unsigned char offset = 1); bool paintIcon (const std::string & filename, const int x, const int y, - const int h = 0, const unsigned char offset = 1); + const int h = 0, const unsigned char offset = 1, bool paint = true); 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); @@ -215,6 +211,9 @@ class CFrameBuffer #else inline void waitForIdle(void) {}; #endif + void* convertRGB2FB(unsigned char *rgbbuff, unsigned long x, unsigned long y, int transp = 0xFF); + 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); + 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); bool blitToPrimary(unsigned int * data, int dx, int dy, int sw, int sh); }; diff --git a/src/driver/pictureviewer/Makefile.am b/src/driver/pictureviewer/Makefile.am index 8f87bf002..b1b505c02 100644 --- a/src/driver/pictureviewer/Makefile.am +++ b/src/driver/pictureviewer/Makefile.am @@ -11,6 +11,5 @@ INCLUDES = \ noinst_LIBRARIES = libneutrino_pictureviewer.a libneutrino_pictureviewer_a_SOURCES = \ - pictureviewer.cpp fb_display.cpp \ - png.cpp bmp.cpp resize.cpp jpeg.cpp \ - gif.cpp crw.cpp make15color_errdiff.cpp + pictureviewer.cpp png.cpp bmp.cpp \ + jpeg.cpp gif.cpp crw.cpp diff --git a/src/driver/pictureviewer/fb_display.cpp b/src/driver/pictureviewer/fb_display.cpp index e6b37d517..02a61f60f 100644 --- a/src/driver/pictureviewer/fb_display.cpp +++ b/src/driver/pictureviewer/fb_display.cpp @@ -51,9 +51,10 @@ void fb_display(unsigned char *rgbbuff, int x_size, int y_size, int x_pan, int y return; /* ClearFB if image is smaller */ - //if(x_size < (int)var->xres || y_size < (int)var->yres) + /* if(x_size < (int)var->xres || y_size < (int)var->yres) */ if(clearfb) CFrameBuffer::getInstance()->Clear(); + blit2FB(fbbuff, x_size, y_size, var->xres, var->yres, x_pan, y_pan, x_offs, y_offs); free(fbbuff); } diff --git a/src/driver/pictureviewer/pictureviewer.cpp b/src/driver/pictureviewer/pictureviewer.cpp index ce44c3127..73f558026 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -2,7 +2,6 @@ #include #include "pictureviewer.h" #include "config.h" -#include "fb_display.h" #include "driver/framebuffer.h" @@ -12,11 +11,6 @@ #include "init_cs.h" -/* resize.cpp */ -extern unsigned char *simple_resize (unsigned char *orgin, int ox, int oy, int dx, int dy); -extern unsigned char *color_average_resize (unsigned char *orgin, int ox, int oy, int dx, int dy); - - #ifdef FBV_SUPPORT_GIF extern int fh_gif_getsize (const char *, int *, int *, int, int); extern int fh_gif_load (const char *, unsigned char **, int *, int *); @@ -77,13 +71,13 @@ void CPictureViewer::init_handlers (void) CPictureViewer::CFormathandler * CPictureViewer::fh_getsize (const char *name, int *x, int *y, int width_wanted, int height_wanted) { - CFormathandler *fh; - for (fh = fh_root; fh != NULL; fh = fh->next) { - if (fh->id_pic (name)) - if (fh->get_size (name, x, y, width_wanted, height_wanted) == FH_ERROR_OK) - return (fh); - } - return (NULL); + CFormathandler *fh; + for (fh = fh_root; fh != NULL; fh = fh->next) { + if (fh->id_pic (name)) + if (fh->get_size (name, x, y, width_wanted, height_wanted) == FH_ERROR_OK) + return (fh); + } + return (NULL); } bool CPictureViewer::DecodeImage (const std::string & name, bool showBusySign, bool unscaled) @@ -128,10 +122,7 @@ bool CPictureViewer::DecodeImage (const std::string & name, bool showBusySign, b imx = (int) ((1.0 / m_aspect_ratio_correction) * x * (m_endy - m_starty) / y); imy = (m_endy - m_starty); } - if (m_scaling == SIMPLE) - m_NextPic_Buffer = simple_resize (m_NextPic_Buffer, x, y, imx, imy); - else - m_NextPic_Buffer = color_average_resize (m_NextPic_Buffer, x, y, imx, imy); + m_NextPic_Buffer = Resize(m_NextPic_Buffer, x, y, imx, imy, m_scaling); x = imx; y = imy; } @@ -195,89 +186,88 @@ bool CPictureViewer::DecodeImage (const std::string & name, bool showBusySign, b void CPictureViewer::SetVisible (int startx, int endx, int starty, int endy) { - m_startx = startx; - m_endx = endx; - m_starty = starty; - m_endy = endy; + m_startx = startx; + m_endx = endx; + m_starty = starty; + m_endy = endy; } bool CPictureViewer::ShowImage (const std::string & filename, bool unscaled) { -// dbout("Show Image {\n"); - // Wird eh ueberschrieben ,also schonmal freigeben... (wenig speicher) - if (m_CurrentPic_Buffer != NULL) { - free (m_CurrentPic_Buffer); - m_CurrentPic_Buffer = NULL; - } - DecodeImage (filename, true, unscaled); - DisplayNextImage (); -// dbout("Show Image }\n"); - return true; + // dbout("Show Image {\n"); + // Wird eh ueberschrieben ,also schonmal freigeben... (wenig speicher) + if (m_CurrentPic_Buffer != NULL) { + free (m_CurrentPic_Buffer); + m_CurrentPic_Buffer = NULL; + } + DecodeImage (filename, true, unscaled); + DisplayNextImage (); + // dbout("Show Image }\n"); + return true; } bool CPictureViewer::DisplayNextImage () { -// dbout("DisplayNextImage {\n"); - if (m_CurrentPic_Buffer != NULL) { - free (m_CurrentPic_Buffer); - m_CurrentPic_Buffer = NULL; - } - if (m_NextPic_Buffer != NULL) - fb_display (m_NextPic_Buffer, m_NextPic_X, m_NextPic_Y, m_NextPic_XPan, m_NextPic_YPan, m_NextPic_XPos, m_NextPic_YPos); -// dbout("DisplayNextImage fb_disp done\n"); - m_CurrentPic_Buffer = m_NextPic_Buffer; - m_NextPic_Buffer = NULL; - m_CurrentPic_Name = m_NextPic_Name; - m_CurrentPic_X = m_NextPic_X; - m_CurrentPic_Y = m_NextPic_Y; - m_CurrentPic_XPos = m_NextPic_XPos; - m_CurrentPic_YPos = m_NextPic_YPos; - m_CurrentPic_XPan = m_NextPic_XPan; - m_CurrentPic_YPan = m_NextPic_YPan; -// dbout("DisplayNextImage }\n"); - return true; + // dbout("DisplayNextImage {\n"); + if (m_CurrentPic_Buffer != NULL) { + free (m_CurrentPic_Buffer); + m_CurrentPic_Buffer = NULL; + } + if (m_NextPic_Buffer != NULL) + //fb_display (m_NextPic_Buffer, m_NextPic_X, m_NextPic_Y, m_NextPic_XPan, m_NextPic_YPan, m_NextPic_XPos, m_NextPic_YPos); + CFrameBuffer::getInstance()->displayRGB(m_NextPic_Buffer, m_NextPic_X, m_NextPic_Y, m_NextPic_XPan, m_NextPic_YPan, m_NextPic_XPos, m_NextPic_YPos); + // dbout("DisplayNextImage fb_disp done\n"); + m_CurrentPic_Buffer = m_NextPic_Buffer; + m_NextPic_Buffer = NULL; + m_CurrentPic_Name = m_NextPic_Name; + m_CurrentPic_X = m_NextPic_X; + m_CurrentPic_Y = m_NextPic_Y; + m_CurrentPic_XPos = m_NextPic_XPos; + m_CurrentPic_YPos = m_NextPic_YPos; + m_CurrentPic_XPan = m_NextPic_XPan; + m_CurrentPic_YPan = m_NextPic_YPan; + // dbout("DisplayNextImage }\n"); + return true; } void CPictureViewer::Zoom (float factor) { -// dbout("Zoom %f\n",factor); - showBusy (m_startx + 3, m_starty + 3, 10, 0xff, 0xff, 00); + // dbout("Zoom %f\n",factor); + showBusy (m_startx + 3, m_starty + 3, 10, 0xff, 0xff, 00); - int oldx = m_CurrentPic_X; - int oldy = m_CurrentPic_Y; - unsigned char *oldBuf = m_CurrentPic_Buffer; - m_CurrentPic_X = (int) (factor * m_CurrentPic_X); - m_CurrentPic_Y = (int) (factor * m_CurrentPic_Y); + int oldx = m_CurrentPic_X; + int oldy = m_CurrentPic_Y; + unsigned char *oldBuf = m_CurrentPic_Buffer; + m_CurrentPic_X = (int) (factor * m_CurrentPic_X); + m_CurrentPic_Y = (int) (factor * m_CurrentPic_Y); - if (m_scaling == COLOR) - m_CurrentPic_Buffer = color_average_resize (m_CurrentPic_Buffer, oldx, oldy, m_CurrentPic_X, m_CurrentPic_Y); - else - m_CurrentPic_Buffer = simple_resize (m_CurrentPic_Buffer, oldx, oldy, m_CurrentPic_X, m_CurrentPic_Y); + m_CurrentPic_Buffer = Resize(m_CurrentPic_Buffer, oldx, oldy, m_CurrentPic_X, m_CurrentPic_Y, m_scaling); - if (m_CurrentPic_Buffer == oldBuf) { - // resize failed - hideBusy (); - return; - } + if (m_CurrentPic_Buffer == oldBuf) { + // resize failed + hideBusy (); + return; + } - if (m_CurrentPic_X < (m_endx - m_startx)) - m_CurrentPic_XPos = (m_endx - m_startx - m_CurrentPic_X) / 2 + m_startx; - else - m_CurrentPic_XPos = m_startx; - if (m_CurrentPic_Y < (m_endy - m_starty)) - m_CurrentPic_YPos = (m_endy - m_starty - m_CurrentPic_Y) / 2 + m_starty; - else - m_CurrentPic_YPos = m_starty; - if (m_CurrentPic_X > (m_endx - m_startx)) - m_CurrentPic_XPan = (m_CurrentPic_X - (m_endx - m_startx)) / 2; - else - m_CurrentPic_XPan = 0; - if (m_CurrentPic_Y > (m_endy - m_starty)) - m_CurrentPic_YPan = (m_CurrentPic_Y - (m_endy - m_starty)) / 2; - else - m_CurrentPic_YPan = 0; - fb_display (m_CurrentPic_Buffer, m_CurrentPic_X, m_CurrentPic_Y, m_CurrentPic_XPan, m_CurrentPic_YPan, m_CurrentPic_XPos, m_CurrentPic_YPos); + if (m_CurrentPic_X < (m_endx - m_startx)) + m_CurrentPic_XPos = (m_endx - m_startx - m_CurrentPic_X) / 2 + m_startx; + else + m_CurrentPic_XPos = m_startx; + if (m_CurrentPic_Y < (m_endy - m_starty)) + m_CurrentPic_YPos = (m_endy - m_starty - m_CurrentPic_Y) / 2 + m_starty; + else + m_CurrentPic_YPos = m_starty; + if (m_CurrentPic_X > (m_endx - m_startx)) + m_CurrentPic_XPan = (m_CurrentPic_X - (m_endx - m_startx)) / 2; + else + m_CurrentPic_XPan = 0; + if (m_CurrentPic_Y > (m_endy - m_starty)) + m_CurrentPic_YPan = (m_CurrentPic_Y - (m_endy - m_starty)) / 2; + else + m_CurrentPic_YPan = 0; + //fb_display (m_CurrentPic_Buffer, m_CurrentPic_X, m_CurrentPic_Y, m_CurrentPic_XPan, m_CurrentPic_YPan, m_CurrentPic_XPos, m_CurrentPic_YPos); + CFrameBuffer::getInstance()->displayRGB(m_CurrentPic_Buffer, m_CurrentPic_X, m_CurrentPic_Y, m_CurrentPic_XPan, m_CurrentPic_YPan, m_CurrentPic_XPos, m_CurrentPic_YPos); } void CPictureViewer::Move (int dx, int dy) @@ -313,7 +303,8 @@ void CPictureViewer::Move (int dx, int dy) // dbout("Display x(%d) y(%d) xpan(%d) ypan(%d) xpos(%d) ypos(%d)\n",m_CurrentPic_X, m_CurrentPic_Y, // m_CurrentPic_XPan, m_CurrentPic_YPan, m_CurrentPic_XPos, m_CurrentPic_YPos); - fb_display (m_CurrentPic_Buffer, m_CurrentPic_X, m_CurrentPic_Y, m_CurrentPic_XPan, m_CurrentPic_YPan, m_CurrentPic_XPos, m_CurrentPic_YPos); + //fb_display (m_CurrentPic_Buffer, m_CurrentPic_X, m_CurrentPic_Y, m_CurrentPic_XPan, m_CurrentPic_YPan, m_CurrentPic_XPos, m_CurrentPic_YPos); + CFrameBuffer::getInstance()->displayRGB(m_CurrentPic_Buffer, m_CurrentPic_X, m_CurrentPic_Y, m_CurrentPic_XPan, m_CurrentPic_YPan, m_CurrentPic_XPos, m_CurrentPic_YPos); } CPictureViewer::CPictureViewer () @@ -357,185 +348,177 @@ CPictureViewer::CPictureViewer () void CPictureViewer::showBusy (int sx, int sy, int width, char r, char g, char b) { -// dbout("Show Busy{\n"); - unsigned char rgb_buffer[3]; - unsigned char *fb_buffer; - unsigned char *busy_buffer_wrk; - int cpp = 4; - struct fb_var_screeninfo *var; - var = CFrameBuffer::getInstance()->getScreenInfo (); + // dbout("Show Busy{\n"); + unsigned char rgb_buffer[3]; + unsigned char *fb_buffer; + unsigned char *busy_buffer_wrk; + int cpp = 4; - rgb_buffer[0] = r; - rgb_buffer[1] = g; - rgb_buffer[2] = b; + rgb_buffer[0] = r; + rgb_buffer[1] = g; + rgb_buffer[2] = b; - fb_buffer = (unsigned char *) convertRGB2FB (rgb_buffer, 1, 1); - if (fb_buffer == NULL) { - printf ("showBusy: Error: malloc 1\n"); - return; - } - if (m_busy_buffer != NULL) { - free (m_busy_buffer); - m_busy_buffer = NULL; - } - m_busy_buffer = (unsigned char *) malloc (width * width * cpp); - if (m_busy_buffer == NULL) { - printf ("showBusy: Error: malloc 2: \n"); - return; - } - busy_buffer_wrk = m_busy_buffer; - unsigned char *fb = (unsigned char *) CFrameBuffer::getInstance()->getFrameBufferPointer(); - unsigned int stride = CFrameBuffer::getInstance ()->getStride (); - - for (int y = sy; y < sy + width; y++) { - for (int x = sx; x < sx + width; x++) { - memcpy (busy_buffer_wrk, fb + y * stride + x * cpp, cpp); - busy_buffer_wrk += cpp; - memcpy (fb + y * stride + x * cpp, fb_buffer, cpp); + fb_buffer = (unsigned char *) CFrameBuffer::getInstance()->convertRGB2FB (rgb_buffer, 1, 1); + if (fb_buffer == NULL) { + printf ("showBusy: Error: malloc 1\n"); + return; } - } - m_busy_x = sx; - m_busy_y = sy; - m_busy_width = width; - m_busy_cpp = cpp; - free (fb_buffer); -// dbout("Show Busy}\n"); + if (m_busy_buffer != NULL) { + free (m_busy_buffer); + m_busy_buffer = NULL; + } + m_busy_buffer = (unsigned char *) malloc (width * width * cpp); + if (m_busy_buffer == NULL) { + printf ("showBusy: Error: malloc 2: \n"); + return; + } + busy_buffer_wrk = m_busy_buffer; + unsigned char *fb = (unsigned char *) CFrameBuffer::getInstance()->getFrameBufferPointer(); + unsigned int stride = CFrameBuffer::getInstance ()->getStride (); + + for (int y = sy; y < sy + width; y++) { + for (int x = sx; x < sx + width; x++) { + memcpy (busy_buffer_wrk, fb + y * stride + x * cpp, cpp); + busy_buffer_wrk += cpp; + memcpy (fb + y * stride + x * cpp, fb_buffer, cpp); + } + } + m_busy_x = sx; + m_busy_y = sy; + m_busy_width = width; + m_busy_cpp = cpp; + free (fb_buffer); + // dbout("Show Busy}\n"); } void CPictureViewer::hideBusy () { -// dbout("Hide Busy{\n"); - if (m_busy_buffer != NULL) { - unsigned char *fb = (unsigned char *) CFrameBuffer::getInstance ()->getFrameBufferPointer (); - unsigned int stride = CFrameBuffer::getInstance ()->getStride (); - unsigned char *busy_buffer_wrk = m_busy_buffer; + // dbout("Hide Busy{\n"); + if (m_busy_buffer != NULL) { + unsigned char *fb = (unsigned char *) CFrameBuffer::getInstance ()->getFrameBufferPointer (); + unsigned int stride = CFrameBuffer::getInstance ()->getStride (); + unsigned char *busy_buffer_wrk = m_busy_buffer; - for (int y = m_busy_y; y < m_busy_y + m_busy_width; y++) { - for (int x = m_busy_x; x < m_busy_x + m_busy_width; x++) { - memcpy (fb + y * stride + x * m_busy_cpp, busy_buffer_wrk, m_busy_cpp); - busy_buffer_wrk += m_busy_cpp; - } + for (int y = m_busy_y; y < m_busy_y + m_busy_width; y++) { + for (int x = m_busy_x; x < m_busy_x + m_busy_width; x++) { + memcpy (fb + y * stride + x * m_busy_cpp, busy_buffer_wrk, m_busy_cpp); + busy_buffer_wrk += m_busy_cpp; + } + } + free (m_busy_buffer); + m_busy_buffer = NULL; } - free (m_busy_buffer); - m_busy_buffer = NULL; - } -// dbout("Hide Busy}\n"); + // dbout("Hide Busy}\n"); } void CPictureViewer::Cleanup () { - if (m_busy_buffer != NULL) { - free (m_busy_buffer); - m_busy_buffer = NULL; - } - if (m_NextPic_Buffer != NULL) { - free (m_NextPic_Buffer); - m_NextPic_Buffer = NULL; - } - if (m_CurrentPic_Buffer != NULL) { - free (m_CurrentPic_Buffer); - m_CurrentPic_Buffer = NULL; - } + if (m_busy_buffer != NULL) { + free (m_busy_buffer); + m_busy_buffer = NULL; + } + if (m_NextPic_Buffer != NULL) { + free (m_NextPic_Buffer); + m_NextPic_Buffer = NULL; + } + if (m_CurrentPic_Buffer != NULL) { + free (m_CurrentPic_Buffer); + m_CurrentPic_Buffer = NULL; + } } + +void CPictureViewer::getSize(const char* name, int* width, int *height) +{ + CFormathandler *fh; + + fh = fh_getsize(name, width, height, INT_MAX, INT_MAX); + if (fh == NULL) { + *width = 0; + *height = 0; + } +} + #define LOGO_DIR1 "/share/tuxbox/neutrino/icons/logo" #define LOGO_DIR2 "/var/share/icons/logo" #define LOGO_FMT ".jpg" +bool CPictureViewer::GetLogoName(uint64_t channel_id, std::string ChannelName, std::string & name, int *width, int *height) +{ + int i, j; + char strChanId[16]; + + sprintf(strChanId, "%llx", channel_id & 0xFFFFFFFFFFFFULL); + /* first the channel-id, then the channelname */ + std::string strLogoName[2] = { (std::string)strChanId, ChannelName }; + /* first jpg, then gif */ + std::string strLogoExt[2] = { ".jpg", ".gif" }; + + for (i = 0; i < 2; i++) + { + for (j = 0; j < 2; j++) + { + std::string tmp(LOGO_DIR2 "/" + strLogoName[i] + strLogoExt[j]); + if (access(tmp.c_str(), R_OK) != -1) + { + if(width && height) + getSize(tmp.c_str(), width, height); + name = tmp; + return true; + } + } + } + for (i = 0; i < 2; i++) + { + for (j = 0; j < 2; j++) + { + std::string tmp(LOGO_DIR1 "/" + strLogoName[i] + strLogoExt[j]); + if (access(tmp.c_str(), R_OK) != -1) + { + if(width && height) + getSize(tmp.c_str(), width, height); + name = tmp; + return true; + } + } + } + return false; +} + bool CPictureViewer::DisplayLogo (uint64_t channel_id, int posx, int posy, int width, int height) { - char fname[255]; + char fname[255]; bool ret = false; - sprintf(fname, "%s/%llx.jpg", LOGO_DIR2, channel_id & 0xFFFFFFFFFFFFULL); -printf("logo file: %s\n", fname); - if(access(fname, F_OK)) - sprintf(fname, "%s/%llx.gif", LOGO_DIR2, channel_id & 0xFFFFFFFFFFFFULL); + sprintf(fname, "%s/%llx.jpg", LOGO_DIR2, channel_id & 0xFFFFFFFFFFFFULL); + printf("logo file: %s\n", fname); + if(access(fname, F_OK)) + sprintf(fname, "%s/%llx.gif", LOGO_DIR2, channel_id & 0xFFFFFFFFFFFFULL); if(!access(fname, F_OK)) { + ret = DisplayImage(fname, posx, posy, width, height); +#if 0 //ret = DisplayImage(fname, posx, posy, width, height); - //fb_pixel_t * data = getImage(fname, width, height); - fb_pixel_t * data = getIcon(fname, &width, &height); + fb_pixel_t * data = getImage(fname, width, height); + //fb_pixel_t * data = getIcon(fname, &width, &height); if(data) { - CFrameBuffer::getInstance()->blitToPrimary(data, posx, posy, width, height); + CFrameBuffer::getInstance()->blit2FB(data, width, height, posx, posy); cs_free_uncached(data); } +#endif } return ret; } -int CPictureViewer::getWidth(const char* name) -{ - int x, y; - CFormathandler *fh; - fh = fh_getsize(name, &x, &y, INT_MAX, INT_MAX); - if (fh == NULL) - return -1; - return x; -} - -int CPictureViewer::getHeight(const char* name) -{ - int x, y; - CFormathandler *fh; - fh = fh_getsize(name, &x, &y, INT_MAX, INT_MAX); - if (fh == NULL) - return -1; - return y; -} - bool CPictureViewer::DisplayImage (const std::string & name, int posx, int posy, int width, int height) { - int x, y; - CFormathandler *fh; - bool ret = false; + /* TODO: cache or check for same */ + fb_pixel_t * data = getImage(name, width, height); - if (m_NextPic_Name != name || m_NextPic_X != width || m_NextPic_Y != height) { - - fh = fh_getsize (name.c_str (), &x, &y, INT_MAX, INT_MAX); - if (fh) { - if (m_NextPic_Buffer != NULL) - free (m_NextPic_Buffer); - - m_NextPic_Buffer = (unsigned char *) malloc (x * y * 3); - if (m_NextPic_Buffer == NULL) { - printf ("DisplayImage: Error: malloc\n"); - return false; - } - if (fh->get_pic (name.c_str (), &m_NextPic_Buffer, &x, &y) == FH_ERROR_OK) { -//printf("DisplayImage: decoded %s, %d x %d to x=%d y=%d\n", name.c_str (), x, y, posx, posy); - //FIXME m_aspect_ratio_correction ? - if(width && height) { - if(x != width || y != height) { -printf("DisplayImage: resize %s, %d x %d to x=%d y=%d\n", name.c_str (), x, y, posx, posy); - //m_NextPic_Buffer = simple_resize (m_NextPic_Buffer, x, y, imx, imy); - m_NextPic_Buffer = color_average_resize (m_NextPic_Buffer, x, y, width, height); - x = width; - y = height; - } - posx += (width-x)/2; - posy += (height-y)/2; - } -//printf("DisplayImage: display %s, %d x %d to x=%d y=%d\n", name.c_str (), x, y, posx, posy); - fb_display (m_NextPic_Buffer, x, y, 0, 0, posx, posy, false, convertSetupAlpha2Alpha(g_settings.infobar_alpha)); - m_NextPic_X = x; - m_NextPic_Y = y; - m_NextPic_Name = name; - ret = true; - } else { - printf ("Error decoding file %s\n", name.c_str ()); - free (m_NextPic_Buffer); - m_NextPic_Buffer = NULL; - m_NextPic_Name = ""; - } - } else { - printf("Error open file %s\n", name.c_str ()); - } - } else if(m_NextPic_Buffer) { - m_NextPic_XPos = posx; - m_NextPic_YPos = posy; - fb_display (m_NextPic_Buffer, m_NextPic_X, m_NextPic_Y, 0, 0, m_NextPic_XPos, m_NextPic_YPos, false, convertSetupAlpha2Alpha(g_settings.infobar_alpha)); - ret = true; - } - return ret; + if(data) { + CFrameBuffer::getInstance()->blit2FB(data, width, height, posx, posy); + cs_free_uncached(data); + return true; + } + return false; } fb_pixel_t * CPictureViewer::getImage (const std::string & name, int width, int height) @@ -557,19 +540,19 @@ fb_pixel_t * CPictureViewer::getImage (const std::string & name, int width, int printf("getImage: decoded %s, %d x %d \n", name.c_str (), x, y); if(x != width || y != height) { - buffer = color_average_resize (buffer, x, y, width, height); +printf("getImage: resize %s to %d x %d \n", name.c_str (), width, height); + buffer = Resize(buffer, x, y, width, height, COLOR); x = width; y = height; } - struct fb_var_screeninfo *var = CFrameBuffer::getInstance()->getScreenInfo(); - ret = (fb_pixel_t *) convertRGB2FB(buffer, x, y, 0); + ret = (fb_pixel_t *) CFrameBuffer::getInstance()->convertRGB2FB(buffer, x, y, convertSetupAlpha2Alpha(g_settings.infobar_alpha)); free(buffer); } else { printf ("Error decoding file %s\n", name.c_str ()); free (buffer); buffer = NULL; } - } + } else printf("Error open file %s\n", name.c_str ()); return ret; @@ -616,3 +599,70 @@ fb_pixel_t * CPictureViewer::getIcon (const std::string & name, int *width, int return fbbuff; } + +unsigned char * CPictureViewer::Resize(unsigned char *orgin, int ox, int oy, int dx, int dy, ScalingMode type, unsigned char * dst) +{ + unsigned char * cr; + if(dst == NULL) { + cr = (unsigned char*) malloc(dx*dy*3); + + if(cr==NULL) + { + printf("Error: malloc\n"); + return(orgin); + } + } else + cr = dst; + + if(type == SIMPLE) { + unsigned char *p,*l; + int i,j,k,ip; + l=cr; + + for(j=0;j=ox) + xb_v[i]=ox-1; + } + for(j=0;j=oy) yb=oy-1; + for(i=0;ipaintBoxRel(x + width - 100 - PIC_W, y+(theight-PIC_H)/2, PIC_W, PIC_H, COL_MENUHEAD_PLUS_0); - g_PicViewer->DisplayLogo(chanlist[selected]->channel_id, x + width - 100 - PIC_W, y+(theight-PIC_H)/2, PIC_W, PIC_H); + //g_PicViewer->DisplayLogo(chanlist[selected]->channel_id, x + width - 100 - PIC_W, y+(theight-PIC_H)/2, PIC_W, PIC_H); + + std::string lname; + if(g_PicViewer->GetLogoName(chanlist[selected]->channel_id, chanlist[selected]->name, lname)) + g_PicViewer->DisplayImage(lname, x + width - 100 - PIC_W, y+(theight-PIC_H)/2, PIC_W, PIC_H); + frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, bgcolor, ROUND_RADIUS); } else { color = iscurrent ? COL_MENUCONTENT : COL_MENUCONTENTINACTIVE; diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index e9a074045..361878e1a 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -52,6 +52,8 @@ #include #include +#include + extern CPictureViewer * g_PicViewer; #define PIC_W 52 #define PIC_H 39 @@ -433,7 +435,7 @@ static bool sortByDateTime (const CChannelEvent& a, const CChannelEvent& b) extern char recDir[255]; void sectionsd_getEventsServiceKey(t_channel_id serviceUniqueKey, CChannelEventList &eList, char search = 0, std::string search_text = ""); bool sectionsd_getComponentTagsUniqueKey(const event_id_t uniqueKey, CSectionsdClient::ComponentTagList& tags); - +extern tallchans allchans; int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_t* a_startzeit, bool doLoop ) { int res = menu_return::RETURN_REPAINT; @@ -571,8 +573,21 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_ frameBuffer->paintBoxRel(sx, sy, ox, toph, COL_MENUHEAD_PLUS_0, ROUND_RADIUS, CORNER_TOP); int pic_offx = 0; - if (g_PicViewer->DisplayLogo(channel_id, sx+10, sy + (toph-PIC_H)/2/*5*/, PIC_W, PIC_H)) - pic_offx = PIC_W + 10; + + //hack.. + tallchans_iterator cit = allchans.find(channel_id); + if(cit != allchans.end()) { + std::string lname; + if(g_PicViewer->GetLogoName(channel_id, cit->second.getName(), lname)) { + g_PicViewer->DisplayImage(lname, sx+10, sy + (toph-PIC_H)/2/*5*/, PIC_W, PIC_H); + pic_offx = PIC_W + 10; + } + + } + + //if (g_PicViewer->DisplayLogo(channel_id, sx+10, sy + (toph-PIC_H)/2/*5*/, PIC_W, PIC_H)) + // pic_offx = PIC_W + 10; + g_Font[SNeutrinoSettings::FONT_TYPE_EPG_TITLE]->RenderString(sx+15 + pic_offx, sy + topheight+ 3, ox-15- pic_offx, text1, COL_MENUHEAD, 0, true); if (!(text2.empty())) g_Font[SNeutrinoSettings::FONT_TYPE_EPG_TITLE]->RenderString(sx+15+ pic_offx, sy+ 2* topheight+ 3, ox-15 - pic_offx, text2, COL_MENUHEAD, 0, true); diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 0112def1f..f67686ae7 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -261,7 +261,7 @@ int EventList::exec(const t_channel_id channel_id, const std::string& channelnam name = channelname; sort_mode=0; - paintHead(channel_id); + paintHead(channel_id, name); readEvents(channel_id); paint(channel_id); showFunctionBar(true); @@ -370,7 +370,7 @@ int EventList::exec(const t_channel_id channel_id, const std::string& channelnam else liststart=(selected/listmaxshow)*listmaxshow; hide(); - paintHead(channel_id); + paintHead(channel_id, name); paint(channel_id); showFunctionBar(true); @@ -481,7 +481,7 @@ int EventList::exec(const t_channel_id channel_id, const std::string& channelnam if(in_search) { in_search = false; name = channelname; - paintHead(channel_id); + paintHead(channel_id, name); readEvents(channel_id); paint(channel_id); showFunctionBar(true); @@ -525,7 +525,7 @@ int EventList::exec(const t_channel_id channel_id, const std::string& channelnam timerlist.clear(); g_Timerd->getTimerList (timerlist); - paintHead(channel_id); + paintHead(channel_id, name); paint(channel_id); showFunctionBar(true); } @@ -672,14 +672,18 @@ void EventList::paintItem(unsigned int pos, t_channel_id channel_id) } } -void EventList::paintHead(t_channel_id channel_id) +void EventList::paintHead(t_channel_id channel_id, std::string channelname) { bool logo_ok = false; frameBuffer->paintBoxRel(x,y, width,theight+0, COL_MENUHEAD_PLUS_0, ROUND_RADIUS, CORNER_TOP); -#ifndef FB_USE_PALETTE - logo_ok = g_PicViewer->DisplayLogo(channel_id, x+10, y+(theight-PIC_H)/2, PIC_W, PIC_H); -#endif + + std::string lname; + if(g_PicViewer->GetLogoName(channel_id, channelname, lname)) + logo_ok = g_PicViewer->DisplayImage(lname, x+10, y+(theight-PIC_H)/2, PIC_W, PIC_H); + + //logo_ok = g_PicViewer->DisplayLogo(channel_id, x+10, y+(theight-PIC_H)/2, PIC_W, PIC_H); + g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE]->RenderString(x+15+(logo_ok? 5+PIC_W:0),y+theight+1, width, name.c_str(), COL_MENUHEAD, 0, true); // UTF-8 } @@ -884,7 +888,7 @@ int EventList::findEvents(void) name += m_search_keyword; name += "'"; } - paintHead(0); + paintHead(0, ""); paint(); showFunctionBar(true); return(res); diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index 0e3fd528d..690a3c45e 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -108,7 +108,7 @@ class EventList void paintItem(unsigned pos, t_channel_id channel_id = 0); void paint(t_channel_id channel_id = 0); - void paintHead(t_channel_id channel_id); + void paintHead(t_channel_id channel_id, std::string name); void hide(); void showFunctionBar(bool show); CTimerd::CTimerEventTypes isScheduled(t_channel_id channel_id, CChannelEvent * event, int * tID = NULL); diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 4b939757b..504b368e4 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -518,16 +518,7 @@ fprintf(stderr, "after showchannellogo, mode = %d ret = %d logo_ok = %d\n",g_set sprintf (strChanNum, "%d", ChanNum); int ChanNumWidth = 0; -#if 0 - if (showButtonBar) { -#define PIC_W 52 -#define PIC_H 39 -#define PIC_X (ChanNameX + 10) -#define PIC_Y (ChanNameY + time_height - PIC_H) - logo_ok = g_PicViewer->DisplayLogo(channel_id, PIC_X, PIC_Y, PIC_W, PIC_H); - ChanNumWidth = PIC_W + 10; - } -#endif + if (ChanNum) /* !fileplay */ { /* TODO: the logic will get much easier once we decouple channellogo and signal bars */ @@ -1605,12 +1596,6 @@ int CInfoViewer::showChannelLogo(const t_channel_id logo_channel_id) if (!g_settings.infobar_show_channellogo) // show logo only if configured return 0; - char strChanId[16]; - sprintf(strChanId, "%llx", logo_channel_id & 0xFFFFFFFFFFFFULL); - /* first the channel-id, then the channelname */ - std::string strLogoName[2] = { (std::string)strChanId, ChannelName }; - /* first jpg, then gif */ - std::string strLogoExt[2] = { ".jpg", ".gif" }; std::string strAbsIconPath; int x_mid, y_mid, logo_w, logo_h; @@ -1619,37 +1604,13 @@ int CInfoViewer::showChannelLogo(const t_channel_id logo_channel_id) int start_x = ChanNameX; int chan_w = BoxEndX- (start_x+ 20)- time_width- 15; - bool logo_available = false; - int i, j; + bool logo_available = g_PicViewer->GetLogoName(logo_channel_id, ChannelName, strAbsIconPath, &logo_w, &logo_h); - // check if logo is available - for (i = 0; i < 2; i++) - { - for (j = 0; j < 2; j++) - { - std::string tmp(LOGO_DIR2 "/" + strLogoName[i] + strLogoExt[j]); - //fprintf(stderr, "%s: checking for '%s'...", __FUNCTION__, tmp.c_str()); - if (access(tmp.c_str(), R_OK) != -1) - { - //fprintf(stderr, "ok!\n"); - strAbsIconPath = tmp; - logo_available = true; - break; - } - //fprintf(stderr, "failed\n"); - } - if (logo_available) - break; - } + fprintf(stderr, "%s: logo_available: %d file: %s\n", __FUNCTION__, logo_available, strAbsIconPath.c_str()); - //fprintf(stderr, "%s: logo_available: %d file: %s\n", __FUNCTION__, logo_available, strAbsIconPath.c_str()); if (! logo_available) return 0; - // get logo sizes - logo_w = g_PicViewer->getWidth(strAbsIconPath.c_str()); - logo_h = g_PicViewer->getHeight(strAbsIconPath.c_str()); - if ((logo_w == 0) || (logo_h == 0)) // corrupt logo size? { printf("[infoviewer] channel logo: \n" diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index 47a6ccd76..9e5df487a 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -592,9 +592,8 @@ void CMovieBrowser::initFrames(void) m_cBoxFrameTitleRel.iY = 0; m_cBoxFrameTitleRel.iWidth = m_cBoxFrame.iWidth; m_cBoxFrameTitleRel.iHeight = m_pcFontTitle->getHeight(); -#ifndef FB_USE_PALETTE + if(m_cBoxFrameTitleRel.iHeight < PIC_H) m_cBoxFrameTitleRel.iHeight = PIC_H; -#endif m_cBoxFrameBrowserList.iX = m_cBoxFrame.iX; m_cBoxFrameBrowserList.iY = m_cBoxFrame.iY + m_cBoxFrameTitleRel.iHeight; @@ -1181,20 +1180,22 @@ void CMovieBrowser::refreshMovieInfo(void) int divx = 720/m_cBoxFrameInfo.iHeight; int picw = 720/divx; int pich = 576/divx; -#ifndef FB_USE_PALETTE std::string fname = m_movieSelectionHandler->file.Name; strReplace(fname, ".ts", ".bmp"); //printf("screenshot name: %s\n", fname.c_str()); logo_ok = !access(fname.c_str(), F_OK); -#endif + m_pcInfo->setText(&m_movieSelectionHandler->epgInfo2, logo_ok ? m_cBoxFrameInfo.iWidth-picw-20: 0); -#ifndef FB_USE_PALETTE //printf("refreshMovieInfo: EpgId %llx id %llx y %d\n", m_movieSelectionHandler->epgEpgId, m_movieSelectionHandler->epgId, m_cBoxFrameTitleRel.iY); int lx = m_cBoxFrame.iX+m_cBoxFrameTitleRel.iX+m_cBoxFrameTitleRel.iWidth-PIC_W-10; int ly = m_cBoxFrameTitleRel.iY+m_cBoxFrame.iY+ (m_cBoxFrameTitleRel.iHeight-PIC_H)/2; m_pcWindow->paintBoxRel(lx, ly, PIC_W, PIC_H, TITLE_BACKGROUND_COLOR); - g_PicViewer->DisplayLogo(m_movieSelectionHandler->epgEpgId >>16, lx, ly, PIC_W, PIC_H); + //g_PicViewer->DisplayLogo(m_movieSelectionHandler->epgEpgId >>16, lx, ly, PIC_W, PIC_H); + std::string lname; + if(g_PicViewer->GetLogoName(m_movieSelectionHandler->epgEpgId >>16, m_movieSelectionHandler->epgChannel, lname)) + g_PicViewer->DisplayImage(lname, lx, ly, PIC_W, PIC_H); + if(logo_ok) { #if 0 lx = m_cBoxFrameInfo.iX+m_cBoxFrameInfo.iWidth - picw -10; @@ -1209,7 +1210,6 @@ void CMovieBrowser::refreshMovieInfo(void) m_pcWindow->paintHLineRel(lx, picw, ly+pich, COL_WHITE); g_PicViewer->DisplayImage(fname, lx+3, ly+3, picw-3, pich-3); } -#endif } } diff --git a/src/gui/widget/progressbar.cpp b/src/gui/widget/progressbar.cpp index d744ecb90..483695954 100644 --- a/src/gui/widget/progressbar.cpp +++ b/src/gui/widget/progressbar.cpp @@ -122,8 +122,8 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y, frame_widht = 0; // get icon size int icon_w = 0, icon_h = 0; - icon_w = iconfile != NULL ? frameBuffer->getIconWidth(iconfile) : 0; - icon_h = iconfile != NULL ? frameBuffer->getIconHeight(iconfile) : 0; + if(iconfile != NULL) + frameBuffer->getIconSize(iconfile, &icon_w, &icon_h); // start positions x/y active bar int start_x = icon_w != 0 ? pos_x + icon_w + 2*frame_widht : pos_x + frame_widht; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 96f318aff..770fb00bd 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3599,6 +3599,7 @@ void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode) funNotifier->changeNotify(NONEXISTANT_LOCALE, (void *) &fspeed); CVFD::getInstance()->ShowText((char *) "Rebooting..."); + delete frameBuffer; stop_daemons(); #if 0 /* FIXME this next hack to test, until we find real crash on exit reason */ @@ -4173,7 +4174,9 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) CHintBox * hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_SERVICEMENU_RESTART_HINT)); hintBox->paint(); - stop_daemons(); + networkConfig.automatic_start = (network_automatic_start == 1); + networkConfig.commitConfig(); + saveSetup(NEUTRINO_SETTINGS_FILE); delete g_RCInput; delete g_Sectionsd; @@ -4183,11 +4186,11 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) delete g_Zapit; delete CVFD::getInstance(); - networkConfig.automatic_start = (network_automatic_start == 1); - networkConfig.commitConfig(); - saveSetup(NEUTRINO_SETTINGS_FILE); delete hintBox; delete frameBuffer; + + stop_daemons(); + execvp(global_argv[0], global_argv); // no return if successful exit(1); } @@ -4471,7 +4474,7 @@ printf("New timeshift dir: %s\n", timeshiftDir); /************************************************************************************** * changeNotify - features menu recording start / stop * **************************************************************************************/ -bool CNeutrinoApp::changeNotify(const neutrino_locale_t OptionName, void */*data*/) +bool CNeutrinoApp::changeNotify(const neutrino_locale_t OptionName, void * /*data*/) { if ((ARE_LOCALES_EQUAL(OptionName, LOCALE_MAINMENU_RECORDING_START)) || (ARE_LOCALES_EQUAL(OptionName, LOCALE_MAINMENU_RECORDING))) {