[comp.sources.x] v03i001: programs to display sun bitmaps under X11, Patch1

mikew@wyse.wyse.com (Mike Wexler) (01/18/89)

Submitted-by: adt!madd@bu-it.BU.EDU (jim frost)
Posting-number: Volume 3, Issue 1
Archive-name: xbgsun/patch1



Due to a bug in my calculation of bytesperline, some images would
either display incorrectly or would be reported to be corrupted.  This
would happen whenever the number of bits in the width was not a
multiple of 16.

I'm not sure what kind of hallucinogens I was on when I wrote the
original code, but they must have been powerful ones.  A shar of
patches follows.

jim
madd@bu-it.bu.edu

# This is a shell archive.  Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by tumbleweed!madd on Thu Jan 12 17:57:06 EST 1989
# Contents:  patch1 patch2
 
echo x - patch1
sed 's/^@//' > "patch1" <<'@//E*O*F patch1//'
*** patchlevel.h.orig	Fri Jan  6 16:53:34 1989
--- patchlevel.h	Thu Jan 12 17:26:36 1989
***************
*** 1 ****
! #define PATCHLEVEL 0
--- 1 ----
! #define PATCHLEVEL 1
@//E*O*F patch1//
chmod u=rw,g=r,o=r patch1
 
echo x - patch2
sed 's/^@//' > "patch2" <<'@//E*O*F patch2//'
*** common.c.orig	Fri Jan  6 16:53:33 1989
--- common.c	Thu Jan 12 17:49:57 1989
***************
*** 6,11 ****
--- 6,12 ----
   *
   * this is in the public domain
   *
+  * 01.12.88 fix bug in calculation of bytesperline.
   * 01.06.88 ability to handle run-length encoding added.
   * 12.30.88 original version derived from xbgsun.
   */
***************
*** 280,290 ****
      }
    }
  
!   bytesperline= ((width * depth) / 8);
!   if ((width) % 16 > 8)                /* images are rounded out to 16 bits */
!     bytesperline += 2;
!   else if (width % 16)
!     bytesperline += 1;
    if (depth) {
      mapsize= localint(header.maplen) / 3;
      red= colormap;
--- 281,291 ----
      }
    }
  
!   bytesperline= ((width * depth) / 16); /* images are rounded to 16 bits */
!   if ((width * depth) % 16)
!     bytesperline++;
!   bytesperline <<= 1;
! 
    if (depth) {
      mapsize= localint(header.maplen) / 3;
      red= colormap;
@//E*O*F patch2//
chmod u=rw,g=r,o=r patch2
 
exit 0
-- 
Mike Wexler(wyse!mikew)    Phone: (408)433-1000 x1330
Moderator of comp.sources.x