]> git.webhop.me Git - tuxwetter.git/commitdiff
init backbuffer depending on FSCREENINFO line_length
authorGetAway <get-away@t-online.de>
Wed, 4 Oct 2017 10:41:38 +0000 (12:41 +0200)
committerJacek Jendrzej <satbaby@kawaii.com>
Wed, 4 Oct 2017 12:53:52 +0000 (14:53 +0200)
this prevents horizontal cut of OSD with new fb driver
bump version 4.06

fb_display.c
gfx.c
text.c
tuxwetter.c
tuxwetter.h

index 1d0128ce8ab843defe07e2dabf3e74147d142e9b..1af14c6959e3457156ff449f636e24d10bf922eb 100644 (file)
@@ -113,7 +113,7 @@ int fb_set_gmode(int gmode)
                return -1;
        }
 
-//     memset(lfb, 0, stride * yRes);
+//     memset(lfb, 0, swidth * yRes);
         if (ioctl(fb, FBIOBLANK, FB_BLANK_UNBLANK) < 0) {
                 printf("screen unblanking failed\n");
         }
@@ -244,19 +244,19 @@ void blit2FB(void *fbbuff,
                                set332map();
                        }
                for(i = 0; i < yc; i++){
-                               memcpy(lbb+(i+yoffs)*stride+xo,cp + (i+yp)*pic_xs+xp,xc*cpp);
+                               memcpy(lbb+(i+yoffs)*swidth+xo,cp + (i+yp)*pic_xs+xp,xc*cpp);
                        }
                        break;
                case 2:
                        for(i = 0; i < yc; i++){
-                               memcpy(lbb+(i+yoffs)*stride+xo,sp + (i+yp)*pic_xs+xp, xc*cpp);
+                               memcpy(lbb+(i+yoffs)*swidth+xo,sp + (i+yp)*pic_xs+xp, xc*cpp);
                        }
                        break;
                case 4:
                {
                        uint32_t * data = (uint32_t *) fbbuff;
 
-                       uint32_t * d = (uint32_t *)lbb + xo + stride * yoffs;
+                       uint32_t * d = (uint32_t *)lbb + xo + swidth * yoffs;
                        uint32_t * d2;
 
                        for (count = 0; count < yc; count++ ) {
@@ -279,7 +279,7 @@ void blit2FB(void *fbbuff,
                                        d2++;
                                        pixpos++;
                                }
-                               d += stride;
+                               d += swidth;
                        }
                }
                break;
@@ -318,7 +318,7 @@ int x,y;
                y=cfy;
        }
        
-    unsigned int stride = fix.line_length;
+    unsigned int swidth = fix.line_length;
        
        switch(cpp){
                case 2:
@@ -336,16 +336,16 @@ int x,y;
                                tl = tvar.transp.length;
                                to = tvar.transp.offset;
                                short black=make16color(0,0,0, rl, ro, gl, go, bl, bo, tl, to);
-                               unsigned short *s_fbbuff = (unsigned short *) malloc(y*stride/2 * sizeof(unsigned short));
+                               unsigned short *s_fbbuff = (unsigned short *) malloc(y*swidth/2 * sizeof(unsigned short));
                                if(s_fbbuff==NULL)
                                {
                                        printf("Error: malloc\n");
                                        return;
                                }
 
-                               for(i = 0; i < y*stride/2; i++)
+                               for(i = 0; i < y*swidth/2; i++)
                                   s_fbbuff[i] = black;
-                               memcpy(lfb, s_fbbuff, y*stride);
+                               memcpy(lfb, s_fbbuff, y*swidth);
                                free(s_fbbuff);
                        }
                        break;
@@ -354,13 +354,13 @@ int x,y;
                        unsigned int  col = 0xFF000000;
                        unsigned int  * dest = (unsigned int  *) lfb;
                        unsigned int i;
-                       for(i = 0; i < stride*y/4; i ++)
+                       for(i = 0; i < swidth*y/4; i ++)
                                dest[i] = col;
                        }
                        break;
 
                default:
-                       memset(lfb, 0, stride*y);
+                       memset(lfb, 0, swidth*y);
        }
 
 }
@@ -549,9 +549,9 @@ int showBusy(int _sx, int _sy, int width, char r, char g, char b)
        {
                for(x=_sx ; x< _sx+width; x++)
                {
-                       memcpy(busy_buffer_wrk, lbb + y * stride + (x * cpp)/sizeof(uint32_t), cpp);
+                       memcpy(busy_buffer_wrk, lbb + y * swidth + (x * cpp)/sizeof(uint32_t), cpp);
                        busy_buffer_wrk+=cpp;
-                       memcpy(lbb + y * stride + (x * cpp)/sizeof(uint32_t), fb_buffer, cpp);
+                       memcpy(lbb + y * swidth + (x * cpp)/sizeof(uint32_t), fb_buffer, cpp);
                }
        }
        blit();
diff --git a/gfx.c b/gfx.c
index 6cfdac73cc7962d83057634b2c141fe012624635..fcb23da167a6ff198426752b660def2143c10011 100644 (file)
--- a/gfx.c
+++ b/gfx.c
@@ -22,7 +22,7 @@ void RenderBox(int rsx, int rsy, int rex, int rey, int rad, int col)
 {
        int F,R=rad,ssx=sx+rsx,ssy=sy+rsy,dxx=rex,dyy=rey,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];
 
@@ -73,10 +73,10 @@ void RenderBox(int rsx, int rsy, int rex, int rey, 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)
                {
                        rx=R-ssx;
@@ -94,8 +94,8 @@ void RenderBox(int rsx, int rsy, int rex, int rey, int rad, int col)
                                *i = pix;
 
                        ssx++;
-                       pos2-=stride;
-                       pos3+=stride;
+                       pos2-=swidth;
+                       pos3+=swidth;
                        if (F<0)
                        {
                                F+=(ssx<<1)-1;
@@ -104,18 +104,18 @@ void RenderBox(int rsx, int rsy, int rex, int rey, 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<pos+dxx;i++)
                        *i = pix;
-               pos+=stride;
+               pos+=swidth;
        }
 }
 
@@ -253,7 +253,7 @@ void RenderLine( int xa, int ya, int xb, int yb, unsigned char col )
                        End = xb;
                        step = yb < ya ? -1 : 1;
                }
-               *(lbb + startx+x + stride*(y+starty)) = pix;
+               *(lbb + startx+x + swidth*(y+starty)) = pix;
 
                while( x < End )
                {
@@ -265,7 +265,7 @@ void RenderLine( int xa, int ya, int xb, int yb, unsigned char col )
                                y += step;
                                p += twoDyDx;
                        }
-                       *(lbb + startx+x + stride*(y+starty)) = pix;
+                       *(lbb + startx+x + swidth*(y+starty)) = pix;
                }
        }
        else
@@ -288,7 +288,7 @@ void RenderLine( int xa, int ya, int xb, int yb, unsigned char col )
                        End = yb;
                        step = xb < xa ? -1 : 1;
                }
-               *(lbb + startx+x + stride*(y+starty)) = pix;
+               *(lbb + startx+x + swidth*(y+starty)) = pix;
 
                while( y < End )
                {
@@ -301,7 +301,7 @@ void RenderLine( int xa, int ya, int xb, int yb, unsigned char col )
                                p += twoDxDy;
                        }
 
-                       *(lbb + startx+x + stride*(y+starty)) = pix;
+                       *(lbb + startx+x + swidth*(y+starty)) = pix;
                }
        }
 }
diff --git a/text.c b/text.c
index e4bc8f336a51de954cf5a6a3d975e036a894c15c..abc3b90b58cd442405fd18224ca8b3c93361811b 100644 (file)
--- a/text.c
+++ b/text.c
@@ -276,10 +276,10 @@ 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 bgcolor = *(lbb + (sy + _sy - _d - 1) * stride + (sx + _sx + sbit->left));
+               uint32_t bgcolor = *(lbb + (sy + _sy - _d - 1) * swidth + (sx + _sx + sbit->left));
                uint32_t 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++)
                {
@@ -293,8 +293,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;
                }
        }
 
index 64b4677d591cd24f0a67e61c9a0c7f3f68f80189..1501f43ee58713e28998a6557bfafb257812281b 100644 (file)
@@ -44,7 +44,7 @@
 #include "gifdecomp.h"
 #include "icons.h"
 
-#define P_VERSION "4.05"
+#define P_VERSION "4.06"
 #define S_VERSION ""
 
 
@@ -148,7 +148,7 @@ const char INST_FILE[]="/tmp/rc.locked";
 //char LCDL_FILE[]="/tmp/lcd.locked";
 int instance=0;
 int rclocked=0;
-int stride;
+int swidth;
 
 int get_instance(void)
 {
@@ -3170,7 +3170,11 @@ PLISTENTRY pl=&epl;
        desc.flags = FT_LOAD_RENDER | FT_LOAD_FORCE_AUTOHINT;
 
        //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("tuxwetter <allocating of Backbuffer>\n");
@@ -3179,9 +3183,6 @@ PLISTENTRY pl=&epl;
                munmap(lfb, fix_screeninfo.smem_len);
                return -1;
        }
-
-       stride = fix_screeninfo.line_length/sizeof(uint32_t);
-
        memset(lbb, TRANSP, var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t));
 
        startx = sx;
index 562aaa9abd7c10c5adacd68376a3819270895917..5151ab4aa6cc213010a62f6a7cca919d69bc88d3 100644 (file)
@@ -150,7 +150,7 @@ extern int FSIZE_VSMALL;
 extern int TABULATOR;
 
 extern uint32_t bgra[];
-extern int stride;
+extern int swidth;
 extern uint32_t *lfb, *lbb;
 
 extern char *proxyadress, *proxyuserpwd;