syscons: Get rid of xpad variable by adjusting loop in sckmsrndr.c
authorImre Vadász <imre@vdsz.com>
Thu, 26 Nov 2015 21:56:38 +0000 (22:56 +0100)
committerImre Vadász <imre@vdsz.com>
Fri, 27 Nov 2015 18:54:42 +0000 (19:54 +0100)
sys/dev/misc/syscons/sckmsrndr.c
sys/dev/misc/syscons/scvidctl.c
sys/dev/misc/syscons/syscons.c
sys/dev/misc/syscons/syscons.h

index 2492af6..c699db1 100644 (file)
@@ -226,8 +226,8 @@ kms_draw(scr_stat *scp, int from, int count, int flip)
        if (from + count > scp->xsize * scp->ysize)
                count = scp->xsize * scp->ysize - from;
 
+       p = draw_pos;
        for (i = from; count-- > 0; i++) {
-               p = draw_pos;
                char_data = &(scp->font[sc_vtb_getc(&scp->vtb, i) *
                                        scp->font_height]);
 
@@ -242,11 +242,10 @@ kms_draw(scr_stat *scp, int from, int count, int flip)
                blit_blk(scp, char_data, scp->font_width, scp->font_height,
                         p, pixel_size, scp->blk_width, scp->blk_height,
                         line_width, fg, bg, BLIT_SET);
-               draw_pos += scp->blk_width * pixel_size;
+               p += scp->blk_width * pixel_size;
                if ((i % scp->xsize) == scp->xsize - 1) {
-                       draw_pos +=
-                           (scp->blk_height - 1) * line_width +
-                           scp->xpad * pixel_size;
+                       draw_pos += scp->blk_height * line_width;
+                       p = draw_pos;
                }
        }
 }
index 68f0796..9654bd0 100644 (file)
@@ -844,7 +844,6 @@ sc_update_render(scr_stat *scp)
                /* scp->xsize = scp->xpixel / scp->blk_width; total possible */
                scp->xsize = desired_cols;
                scp->ysize = scp->ypixel / scp->blk_height;
-               scp->xpad = scp->fbi->stride / 4 - scp->xsize * scp->blk_width;
 
                kprintf("kms console: scale-to %dx%d cols=%d rows=%d\n",
                        scp->blk_width, scp->blk_height,
index 25eed6b..7dba68c 100644 (file)
@@ -3322,7 +3322,6 @@ init_scp(sc_softc_t *sc, int vty, scr_stat *scp)
 
        scp->xsize = scp->xpixel / scp->blk_width;
        scp->ysize = scp->ypixel / scp->blk_height;
-       scp->xpad = scp->fbi->stride / 4 - scp->xsize * scp->blk_width;
     }
     sc_vtb_init(&scp->vtb, VTB_MEMORY, 0, 0, NULL, FALSE);
     sc_vtb_init(&scp->scr, VTB_FRAMEBUFFER, 0, 0, NULL, FALSE);
index 2137e39..59922f5 100644 (file)
@@ -262,7 +262,6 @@ typedef struct scr_stat {
        int             ysize;                  /* Y text size */
        int             xpixel;                 /* X graphics size */
        int             ypixel;                 /* Y graphics size */
-       int             xpad;   /* for xsize * font_width != fbi->stride */
        int             xoff;                   /* X offset in pixel mode */
        int             yoff;                   /* Y offset in pixel mode */