[PATCH 02/16] wmtv: Fix calculation of bytes per line.

Doug Torrance <[email protected]>
Newsgroups gmane.compw.window-managers.windowmaker.devel
Message-ID <[email protected]>
Patch by Yann Vernier <[email protected]>.  From [1]:

   From: Malcolm Parsons <[email protected]>
   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 <[email protected]>
   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
---
 wmtv/src/wmtv.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

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


-- 
To unsubscribe, send mail to [email protected].
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.