From ad164d4fbe14b622c411831f37a88515850c0330 Mon Sep 17 00:00:00 2001 From: GetAway Date: Wed, 4 Oct 2017 12:34:33 +0200 Subject: [PATCH] init backbuffer depending on FSCREENINFO line_length this prevents horizontal cut of OSD with new fb driver bump version 2.11 --- fb_display.c | 4 ++-- gfx.c | 22 +++++++++++----------- msgbox.c | 14 ++++++++------ msgbox.h | 2 +- text.c | 8 ++++---- 5 files changed, 26 insertions(+), 24 deletions(-) diff --git a/fb_display.c b/fb_display.c index ce645a4..6db3adc 100644 --- a/fb_display.c +++ b/fb_display.c @@ -76,7 +76,7 @@ void blit2FB(void *fbbuff, { uint32_t * data = (uint32_t *) fbbuff; - uint32_t * d = (uint32_t *)lbb + xo + stride * ssy/*yoffs*/; + uint32_t * d = (uint32_t *)lbb + xo + swidth * ssy/*yoffs*/; uint32_t * d2; for (count = 0; count < yc; count++ ) { @@ -99,7 +99,7 @@ void blit2FB(void *fbbuff, d2++; pixpos++; } - d += stride; + d += swidth; } } break; diff --git a/gfx.c b/gfx.c index c1612f3..c495774 100644 --- a/gfx.c +++ b/gfx.c @@ -10,7 +10,7 @@ void RenderBox(int _sx, int _sy, int _ex, int _ey, int rad, int col) { int F,R=rad,ssx=startx+_sx,ssy=starty+_sy,dxx=_ex-_sx,dyy=_ey-_sy,rx,ry,wx,wy,count; - uint32_t *pos = lbb + ssx + stride * ssy; + uint32_t *pos = lbb + ssx + swidth * ssy; uint32_t *pos0, *pos1, *pos2, *pos3, *i; uint32_t pix = bgra[col]; @@ -61,10 +61,10 @@ void RenderBox(int _sx, int _sy, int _ex, int _ey, int rad, int col) rx=R-ssx; ry=R-ssy; - pos0=pos+(dyy-ry)*stride; - pos1=pos+ry*stride; - pos2=pos+rx*stride; - pos3=pos+(dyy-rx)*stride; + pos0=pos+(dyy-ry)*swidth; + pos1=pos+ry*swidth; + pos2=pos+rx*swidth; + pos3=pos+(dyy-rx)*swidth; while (ssx <= ssy) { @@ -84,8 +84,8 @@ void RenderBox(int _sx, int _sy, int _ex, int _ey, int rad, int col) ssx++; - pos2-=stride; - pos3+=stride; + pos2-=swidth; + pos3+=swidth; if (F<0) { @@ -96,18 +96,18 @@ void RenderBox(int _sx, int _sy, int _ex, int _ey, int rad, int col) F+=((ssx-ssy)<<1); ssy--; - pos0-=stride; - pos1+=stride; + pos0-=swidth; + pos1+=swidth; } } - pos+=R*stride; + pos+=R*swidth; } for (count=R; count<(dyy-R); count++) { for(i=pos; i __b ? __a : __b; }) -#define M_VERSION 2.10 +#define M_VERSION 2.11 #define NCF_FILE "/var/tuxbox/config/neutrino.conf" #define HDF_FILE "/tmp/.msgbox_hidden" @@ -74,7 +74,7 @@ char *trstr=NULL; const char INST_FILE[]="/tmp/rc.locked"; int instance=0; int rclocked=0; -int stride; +int swidth; int get_instance(void) { @@ -913,8 +913,12 @@ FILE *fh; desc.flags = FT_LOAD_RENDER | FT_LOAD_FORCE_AUTOHINT; - //init backbuffer - + //init backbuffer + int stride = fix_screeninfo.line_length; + swidth = stride/sizeof(uint32_t); + if(stride == 7680 && var_screeninfo.xres == 1280) { + var_screeninfo.yres = 1080; + } if(!(lbb = malloc(var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t)))) { perror(__plugin__ " \n"); @@ -923,8 +927,6 @@ FILE *fh; munmap(lfb, fix_screeninfo.smem_len); return -1; } - stride = fix_screeninfo.line_length/sizeof(uint32_t); - if(!(obb = malloc(var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t)))) { perror(__plugin__ " \n"); diff --git a/msgbox.h b/msgbox.h index 51812d7..13ed576 100644 --- a/msgbox.h +++ b/msgbox.h @@ -150,7 +150,7 @@ extern uint32_t *lfb, *lbb, *obb, *hbb; struct fb_fix_screeninfo fix_screeninfo; struct fb_var_screeninfo var_screeninfo; extern uint32_t bgra[]; -extern int stride; +extern int swidth; int startx, starty, sx, ex, sy, ey; //int debounce, rblock; diff --git a/text.c b/text.c index b43db7f..c57c07f 100644 --- a/text.c +++ b/text.c @@ -281,13 +281,13 @@ int RenderChar(FT_ULong currentchar, int _sx, int _sy, int _ex, int color) if (_sx + sbit->xadvance >= _ex) return -1; /* limit to maxwidth */ uint32_t fgcolor; - uint32_t bgcolor = *(lbb + (sy + _sy - _d - 1) * stride + (sx + _sx + sbit->left)); + uint32_t bgcolor = *(lbb + (sy + _sy - _d - 1) * swidth + (sx + _sx + sbit->left)); if ( color == -2) /* flash */ fgcolor = bgcolor; else fgcolor = bgra[color]; uint32_t *colors = lookup_colors(fgcolor, bgcolor); - uint32_t *p = lbb + (sx + _sx + sbit->left + kerning.x) + stride * (sy + _sy - sbit->top - _d); + uint32_t *p = lbb + (sx + _sx + sbit->left + kerning.x) + swidth * (sy + _sy - sbit->top - _d); uint32_t *r = p + (_ex - _sx); /* end of usable box */ for(row = 0; row < sbit->height; row++) { @@ -301,8 +301,8 @@ int RenderChar(FT_ULong currentchar, int _sx, int _sy, int _ex, int color) if (q > r) /* we are past _ex */ break; } - p += stride; - r += stride; + p += swidth; + r += swidth; } } -- 2.39.5