mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-01 18:01:06 +02:00
Merge branch 'cst-next.pre' into cst-next
Origin commit data
------------------
Branch: ni/coolstream
Commit: a58f1621b4
Author: Thilo Graf <dbt@novatux.de>
Date: 2015-04-30 (Thu, 30 Apr 2015)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -1075,7 +1075,7 @@ bool CFrameBuffer::paintIcon(const std::string & filename, const int x, const in
|
||||
|
||||
data = g_PicViewer->getIcon(newname, &width, &height);
|
||||
|
||||
if(data) {
|
||||
if(data) { //TODO: intercepting of possible full icon cache, that could cause strange behavior while painting of uncached icons
|
||||
int dsize = width*height*sizeof(fb_pixel_t);
|
||||
//printf("CFrameBuffer::paintIcon: %s found, data %x size %d x %d\n", newname.c_str(), data, width, height);fflush(stdout);
|
||||
if(cache_size+dsize < ICON_CACHE_SIZE) {
|
||||
|
@@ -117,7 +117,7 @@ void CNeutrinoFonts::SetupDynamicFonts(bool initRenderClass/*=true*/)
|
||||
dynFontStyle[0] = g_dynFontRenderer->AddFont(fontDescr.filename.c_str());
|
||||
|
||||
fontDescr.name = g_dynFontRenderer->getFamily(fontDescr.filename.c_str());
|
||||
dprintf(DEBUG_NORMAL, " dynamic font family: %s\n", fontDescr.name.c_str());
|
||||
dprintf(DEBUG_NORMAL, "[CNeutrinoFonts] [%s - %d] dynamic font family: %s\n", __func__, __LINE__, fontDescr.name.c_str());
|
||||
dynFontStyle[1] = "Bold Regular";
|
||||
|
||||
g_dynFontRenderer->AddFont(fontDescr.filename.c_str(), true); // make italics
|
||||
@@ -135,14 +135,14 @@ void CNeutrinoFonts::SetupNeutrinoFonts(bool initRenderClass/*=true*/)
|
||||
old_fontDescr.size_offset = fontDescr.size_offset;
|
||||
old_fontDescr.filename = fontDescr.filename;
|
||||
fontDescr.filename = "";
|
||||
dprintf(DEBUG_NORMAL, "font file: %s\n", g_settings.font_file.c_str());
|
||||
dprintf(DEBUG_NORMAL, "[CNeutrinoFonts] [%s - %d] font file: %s\n", __func__, __LINE__, g_settings.font_file.c_str());
|
||||
if (access(g_settings.font_file.c_str(), F_OK)) {
|
||||
if (!access(FONTDIR"/neutrino.ttf", F_OK)) {
|
||||
fontDescr.filename = FONTDIR"/neutrino.ttf";
|
||||
g_settings.font_file = fontDescr.filename;
|
||||
}
|
||||
else {
|
||||
fprintf( stderr,"[neutrino] font file [%s] not found\n neutrino exit\n",FONTDIR"/neutrino.ttf");
|
||||
fprintf( stderr,"[CNeutrinoFonts] [%s - %d] font file [%s] not found\n neutrino exit\n", __func__, __LINE__, FONTDIR"/neutrino.ttf");
|
||||
_exit(0);
|
||||
}
|
||||
}
|
||||
@@ -154,7 +154,7 @@ void CNeutrinoFonts::SetupNeutrinoFonts(bool initRenderClass/*=true*/)
|
||||
old_fontDescr.name = fontDescr.name;
|
||||
fontDescr.name = "";
|
||||
fontDescr.name = g_fontRenderer->getFamily(fontDescr.filename.c_str());
|
||||
dprintf(DEBUG_NORMAL, "standard font family: %s\n", fontDescr.name.c_str());
|
||||
dprintf(DEBUG_NORMAL, "[CNeutrinoFonts] [%s - %d] standard font family: %s\n", __func__, __LINE__, fontDescr.name.c_str());
|
||||
fontStyle[1] = "Bold Regular";
|
||||
|
||||
g_fontRenderer->AddFont(fontDescr.filename.c_str(), true); // make italics
|
||||
@@ -209,10 +209,11 @@ void CNeutrinoFonts::refreshDynFont(int dx, int dy, std::string text, int style,
|
||||
Font *dynFont = g_dynFontRenderer->getFont(fontDescr.name.c_str(), dynFontStyle[style].c_str(), dynSize);
|
||||
dyn_font->font = dynFont;
|
||||
dyn_font->size = dynSize;
|
||||
if (dyn_font->size != dynSize)
|
||||
printf("##### [%s] change %s_font size old %d to new %d, index: %u\n", __FUNCTION__, (isShare)?"share":"dyn", oldSize, dyn_font->size, index);
|
||||
else
|
||||
printf("##### [%s] refresh %s_font size %d, index: %u\n", __FUNCTION__, (isShare)?"share":"dyn", dyn_font->size, index);
|
||||
if (dyn_font->size != dynSize){
|
||||
dprintf(DEBUG_NORMAL, "[CNeutrinoFonts] [%s - %d] change %s_font size old %d to new %d, index: %u\n", __func__, __LINE__, (isShare)?"share":"dyn", oldSize, dyn_font->size, index);
|
||||
}else{
|
||||
dprintf(DEBUG_NORMAL, "[CNeutrinoFonts] [%s - %d] refresh %s_font size %d, index: %u\n",__func__, __LINE__, (isShare)?"share":"dyn", dyn_font->size, index);
|
||||
}
|
||||
}
|
||||
|
||||
int CNeutrinoFonts::getFontHeight(Font* fnt)
|
||||
|
@@ -3,14 +3,14 @@
|
||||
#include <neutrino.h>
|
||||
#include "pictureviewer.h"
|
||||
#include "pv_config.h"
|
||||
|
||||
#include <system/debug.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <cs_api.h>
|
||||
|
||||
#ifdef FBV_SUPPORT_GIF
|
||||
@@ -170,7 +170,7 @@ bool CPictureViewer::DecodeImage (const std::string & _name, bool showBusySign,
|
||||
}
|
||||
m_NextPic_Buffer = (unsigned char *) malloc (x * y * 3);
|
||||
if (m_NextPic_Buffer == NULL) {
|
||||
printf ("DecodeImage: Error: malloc\n");
|
||||
dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] Error: malloc, %s\n", __func__, __LINE__, strerror(errno));
|
||||
return false;
|
||||
}
|
||||
// dbout("---Decoding Start(%d/%d)\n",x,y);
|
||||
@@ -207,11 +207,11 @@ bool CPictureViewer::DecodeImage (const std::string & _name, bool showBusySign,
|
||||
else
|
||||
m_NextPic_YPan = 0;
|
||||
} else {
|
||||
printf ("Unable to read file !\n");
|
||||
dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] Error: Unable to read file !, %s\n", __func__, __LINE__, strerror(errno));
|
||||
free (m_NextPic_Buffer);
|
||||
m_NextPic_Buffer = (unsigned char *) malloc (3);
|
||||
if (m_NextPic_Buffer == NULL) {
|
||||
printf ("DecodeImage: Error: malloc\n");
|
||||
dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] Error: malloc, %s\n", __func__, __LINE__, strerror(errno));
|
||||
return false;
|
||||
}
|
||||
memset (m_NextPic_Buffer, 0, 3);
|
||||
@@ -223,14 +223,14 @@ bool CPictureViewer::DecodeImage (const std::string & _name, bool showBusySign,
|
||||
m_NextPic_YPan = 0;
|
||||
}
|
||||
} else {
|
||||
printf ("Unable to read file or format not recognized!\n");
|
||||
dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] Unable to read file or format not recognized!\n", __func__, __LINE__);
|
||||
if (m_NextPic_Buffer != NULL) {
|
||||
free (m_NextPic_Buffer);
|
||||
m_NextPic_Buffer = NULL;
|
||||
}
|
||||
m_NextPic_Buffer = (unsigned char *) malloc (3);
|
||||
if (m_NextPic_Buffer == NULL) {
|
||||
printf ("DecodeImage: Error: malloc\n");
|
||||
dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] Error: malloc, %s\n", __func__, __LINE__, strerror(errno));
|
||||
return false;
|
||||
}
|
||||
memset (m_NextPic_Buffer, 0, 3);
|
||||
@@ -304,8 +304,8 @@ void CPictureViewer::Zoom (float factor)
|
||||
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);
|
||||
m_CurrentPic_X = int(factor * (float)m_CurrentPic_X);
|
||||
m_CurrentPic_Y = int(factor * (float)m_CurrentPic_Y);
|
||||
|
||||
m_CurrentPic_Buffer = Resize(m_CurrentPic_Buffer, oldx, oldy, m_CurrentPic_X, m_CurrentPic_Y, m_scaling);
|
||||
|
||||
@@ -379,7 +379,7 @@ CPictureViewer::CPictureViewer ()
|
||||
fh_root = NULL;
|
||||
m_scaling = COLOR;
|
||||
//m_aspect = 4.0 / 3;
|
||||
m_aspect = 16.0 / 9;
|
||||
m_aspect = float(16.0 / 9.0);
|
||||
m_CurrentPic_Name = "";
|
||||
m_CurrentPic_Buffer = NULL;
|
||||
m_CurrentPic_X = 0;
|
||||
@@ -436,7 +436,7 @@ void CPictureViewer::showBusy (int sx, int sy, int width, char r, char g, char b
|
||||
|
||||
fb_buffer = (unsigned char *) CFrameBuffer::getInstance()->convertRGB2FB (rgb_buffer, 1, 1);
|
||||
if (fb_buffer == NULL) {
|
||||
printf ("showBusy: Error: malloc 1\n");
|
||||
dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] Error: malloc\n", __func__, __LINE__);
|
||||
return;
|
||||
}
|
||||
if (m_busy_buffer != NULL) {
|
||||
@@ -445,7 +445,7 @@ void CPictureViewer::showBusy (int sx, int sy, int width, char r, char g, char b
|
||||
}
|
||||
m_busy_buffer = (unsigned char *) malloc (width * width * cpp);
|
||||
if (m_busy_buffer == NULL) {
|
||||
printf ("showBusy: Error: malloc 2: \n");
|
||||
dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] Error: malloc\n", __func__, __LINE__);
|
||||
return;
|
||||
}
|
||||
busy_buffer_wrk = m_busy_buffer;
|
||||
@@ -609,10 +609,10 @@ void CPictureViewer::rescaleImageDimensions(int *width, int *height, const int m
|
||||
aspect = (float)(*width) / (float)(*height);
|
||||
if (((float)(*width) / (float)max_width) > ((float)(*height) / (float)max_height)) {
|
||||
*width = max_width;
|
||||
*height = (int)(max_width / aspect);
|
||||
*height = int((float)max_width / aspect);
|
||||
}else{
|
||||
*height = max_height;
|
||||
*width = (int)(max_height * aspect);
|
||||
*width = int((float)max_height * aspect);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -625,22 +625,27 @@ bool CPictureViewer::DisplayImage(const std::string & name, int posx, int posy,
|
||||
/* TODO: cache or check for same */
|
||||
fb_pixel_t * data = getImage(name, width, height);
|
||||
|
||||
if (transp > CFrameBuffer::TM_EMPTY)
|
||||
frameBuffer->SetTransparentDefault();
|
||||
if (data){
|
||||
if (transp > CFrameBuffer::TM_EMPTY)
|
||||
frameBuffer->SetTransparentDefault();
|
||||
|
||||
if(data) {
|
||||
frameBuffer->blit2FB(data, width, height, posx, posy);
|
||||
cs_free_uncached(data);
|
||||
return true;
|
||||
if(data) {
|
||||
frameBuffer->blit2FB(data, width, height, posx, posy);
|
||||
cs_free_uncached(data);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
fb_pixel_t * CPictureViewer::int_getImage(const std::string & name, int *width, int *height, bool GetImage)
|
||||
{
|
||||
if (access(name.c_str(), R_OK) == -1)
|
||||
return NULL;
|
||||
|
||||
int x, y, load_ret, bpp = 0;
|
||||
CFormathandler *fh;
|
||||
unsigned char * buffer;
|
||||
CFormathandler *fh = NULL;
|
||||
unsigned char * buffer = NULL;
|
||||
fb_pixel_t * ret = NULL;
|
||||
std::string mode_str;
|
||||
|
||||
@@ -655,8 +660,8 @@ fb_pixel_t * CPictureViewer::int_getImage(const std::string & name, int *width,
|
||||
buffer = (unsigned char *) malloc(x * y * 4);
|
||||
if (buffer == NULL)
|
||||
{
|
||||
printf("%s: Error: malloc\n", mode_str.c_str());
|
||||
return 0;
|
||||
dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] mode %s: Error: malloc\n", __func__, __LINE__, mode_str.c_str());
|
||||
return NULL;
|
||||
}
|
||||
#ifdef FBV_SUPPORT_PNG
|
||||
if ((name.find(".png") == (name.length() - 4)) && (fh_png_id(name.c_str())))
|
||||
@@ -664,13 +669,15 @@ fb_pixel_t * CPictureViewer::int_getImage(const std::string & name, int *width,
|
||||
else
|
||||
#endif
|
||||
load_ret = fh->get_pic(name.c_str (), &buffer, &x, &y);
|
||||
dprintf(DEBUG_INFO, "[CPictureViewer] [%s - %d] load_result: %d \n", __func__, __LINE__, load_ret);
|
||||
|
||||
if (load_ret == FH_ERROR_OK)
|
||||
{
|
||||
// printf("%s: decoded %s, %d x %d \n", mode_str.c_str(), name.c_str(), x, y);
|
||||
dprintf(DEBUG_INFO, "[CPictureViewer] [%s - %d] mode %s, decoded %s, (Pos: %d %d) ,bpp = %d \n", __func__, __LINE__, mode_str.c_str(), name.c_str(), x, y, bpp);
|
||||
// resize only getImage
|
||||
if ((GetImage) && (x != *width || y != *height))
|
||||
{
|
||||
printf("%s: resize %s to %d x %d \n", mode_str.c_str(), name.c_str(), *width, *height);
|
||||
dprintf(DEBUG_INFO, "[CPictureViewer] [%s - %d] resize %s to %d x %d \n", __func__, __LINE__, name.c_str(), *width, *height);
|
||||
if (bpp == 4)
|
||||
buffer = ResizeA(buffer, x, y, *width, *height);
|
||||
else
|
||||
@@ -684,11 +691,13 @@ fb_pixel_t * CPictureViewer::int_getImage(const std::string & name, int *width,
|
||||
ret = (fb_pixel_t *) CFrameBuffer::getInstance()->convertRGB2FB(buffer, x, y, convertSetupAlpha2Alpha(g_settings.theme.infobar_alpha));
|
||||
*width = x;
|
||||
*height = y;
|
||||
}else
|
||||
printf("%s: Error decoding file %s\n", mode_str.c_str(), name.c_str());
|
||||
}else{
|
||||
dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] mode %s: Error decoding file %s\n", __func__, __LINE__, mode_str.c_str(), name.c_str());
|
||||
return NULL;
|
||||
}
|
||||
free(buffer);
|
||||
}else
|
||||
printf("%s: Error open file %s\n", mode_str.c_str(), name.c_str());
|
||||
dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] mode: %s, file: %s Error: %s, buffer = %p (Pos: %d %d, Dim: %d x %d)\n", __func__, __LINE__, mode_str.c_str(), name.c_str(), strerror(errno), buffer, x, y, *width, *height);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -711,7 +720,7 @@ unsigned char * CPictureViewer::int_Resize(unsigned char *orgin, int ox, int oy,
|
||||
|
||||
if(cr == NULL)
|
||||
{
|
||||
printf("Resize Error: malloc\n");
|
||||
dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] Resize Error: malloc\n", __func__, __LINE__);
|
||||
return(orgin);
|
||||
}
|
||||
}else
|
||||
@@ -767,7 +776,10 @@ unsigned char * CPictureViewer::int_Resize(unsigned char *orgin, int ox, int oy,
|
||||
r+=q[0]; g+=q[1]; b+=q[2]; a+=q[3];
|
||||
}
|
||||
}
|
||||
p[0]=r/sq; p[1]=g/sq; p[2]=b/sq; p[3]=a/sq;
|
||||
p[0]= uint8_t(r/sq);
|
||||
p[1]= uint8_t(g/sq);
|
||||
p[2]= uint8_t(b/sq);
|
||||
p[3]= uint8_t(a/sq);
|
||||
}
|
||||
}
|
||||
}else
|
||||
@@ -786,7 +798,9 @@ unsigned char * CPictureViewer::int_Resize(unsigned char *orgin, int ox, int oy,
|
||||
r+=q[0]; g+=q[1]; b+=q[2];
|
||||
}
|
||||
}
|
||||
p[0]=r/sq; p[1]=g/sq; p[2]=b/sq;
|
||||
p[0]= uint8_t(r/sq);
|
||||
p[1]= uint8_t(g/sq);
|
||||
p[2]= uint8_t(b/sq);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user