Merge branch 'master' into pu/msgbox

This commit is contained in:
2016-11-02 21:05:36 +01:00
9 changed files with 32 additions and 5 deletions

View File

@@ -62,6 +62,9 @@ uint8_t CColorGradient::limitChar(int c)
fb_pixel_t* CColorGradient::gradientColorToTransparent(fb_pixel_t col, fb_pixel_t *gradientBuf, int bSize, int /*mode*/, int /*intensity*/)
{
if (bSize < 1)
return gradientBuf;
if (gradientBuf == NULL) {
gradientBuf = (fb_pixel_t*) malloc(bSize * sizeof(fb_pixel_t));
if (gradientBuf == NULL) {
@@ -94,6 +97,8 @@ fb_pixel_t* CColorGradient::gradientColorToTransparent(fb_pixel_t col, fb_pixel_
fb_pixel_t* CColorGradient::gradientOneColor(fb_pixel_t col, fb_pixel_t *gradientBuf, int bSize, int mode, int intensity, uint8_t v_min, uint8_t v_max, uint8_t s)
{
if (bSize < 1)
return gradientBuf;
if (gradientBuf == NULL) {
gradientBuf = (fb_pixel_t*) malloc(bSize * sizeof(fb_pixel_t));

View File

@@ -676,7 +676,7 @@ fb_pixel_t* CFrameBuffer::paintBoxRel2Buf(const int dx, const int dy, const int
{
if (!getActive())
return buf;
if (dx == 0 || dy == 0) {
if (dx < 1 || dy < 1) {
dprintf(DEBUG_INFO, "[CFrameBuffer] [%s - %d]: radius %d, dx %d dy %d\n", __func__, __LINE__, radius, dx, dy);
return buf;
}
@@ -2026,6 +2026,9 @@ void CFrameBuffer::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32
void CFrameBuffer::blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff)
{
if(width <1 || height <1 || !boxBuf )
return;
uint32_t xc = (width > xRes) ? (uint32_t)xRes : width;
uint32_t yc = (height > yRes) ? (uint32_t)yRes : height;

View File

@@ -616,6 +616,11 @@ 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, int transp)
{
if(width < 1 || height < 1){
dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] Error: width %i height %i \n", __func__, __LINE__, width, height);
return false;
}
CFrameBuffer* frameBuffer = CFrameBuffer::getInstance();
if (transp > CFrameBuffer::TM_EMPTY)
frameBuffer->SetTransparent(transp);
@@ -672,6 +677,12 @@ fb_pixel_t * CPictureViewer::int_getImage(const std::string & name, int *width,
if (load_ret == FH_ERROR_OK)
{
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);
// image size error
if((GetImage) && (*width < 1 || *height < 1)){
dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] mode: %s, file: %s (Pos: %d %d, Dim: %d x %d)\n", __func__, __LINE__, mode_str.c_str(), name.c_str(), x, y, *width, *height);
free(buffer);
return NULL;
}
// resize only getImage
if ((GetImage) && (x != *width || y != *height))
{
@@ -691,6 +702,7 @@ fb_pixel_t * CPictureViewer::int_getImage(const std::string & name, int *width,
*height = y;
}else{
dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] mode %s: Error decoding file %s\n", __func__, __LINE__, mode_str.c_str(), name.c_str());
free(buffer);
return NULL;
}
free(buffer);