wmtv: Fix calculation of bytes per line.

Patch by Yann Vernier <yann@donkey.dyndns.org>.  From [1]:

   From: Malcolm Parsons <malcolm@ivywell.screaming.net>
   Subject: wmtv: incorrectly calculates bytes per line
   Date: Mon, 09 Apr 2001 21:15:52 +0100

   wmtv does not put the tv display in its window on my second head.
   According to bttv, wmtv is telling bttv that the display is:

   Display at ea800000 is 800 by 600, bytedepth 2, bpl 1600

   If I use xawtv, it correctly sets the bpl value:

   Display at ea800000 is 800 by 600, bytedepth 2, bpl 1664

   wmtv is probably incorrectly assuming width * bytedepth = bpl.

   From: Yann Vernier <yann@donkey.dyndns.org>
   Subject: wmtv: incorrectly calculates bytes per line
   Date: Sun, 15 Jul 2001 14:21:56 +0200

   Found the problem, at least this fixes it for me at 1600x1200.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=93439
This commit is contained in:
Doug Torrance 2016-02-01 00:45:09 -05:00 committed by Carlos R. Mafra
parent 61e2c5f228
commit 199e0065fe

View file

@ -1264,7 +1264,7 @@ GetFrameBuffer(void)
int evbr, erbr, flr = 0; int evbr, erbr, flr = 0;
int bankr, memr, depth; int bankr, memr, depth;
int i, n; int i, n;
int bytesperline, bitsperpixel; int bytesperline, bytesperpixel;
XPixmapFormatValues *pf; XPixmapFormatValues *pf;
if (!XGetWindowAttributes(display, DefaultRootWindow(display), &Winattr)) { if (!XGetWindowAttributes(display, DefaultRootWindow(display), &Winattr)) {
@ -1294,13 +1294,13 @@ GetFrameBuffer(void)
} }
} }
bitsperpixel = (depth+7) & 0xf8; /* Taken from */ bytesperpixel = (depth+7) & 0xf8;
bytesperline = Winattr.width * bitsperpixel / 8; /* Gerd Knorr's xawtv */ bytesperline *= bytesperpixel;
vfb.base = baseaddr; vfb.base = baseaddr;
vfb.height = Winattr.height; vfb.height = Winattr.height;
vfb.width = Winattr.width; vfb.width = Winattr.width;
vfb.depth = bitsperpixel; vfb.depth = bytesperpixel;
vfb.bytesperline = bytesperline; vfb.bytesperline = bytesperline;
if (Winattr.depth == 15) if (Winattr.depth == 15)