Re: Re: [Sbcl-help] Re: Type error with sbcl-0.8.2 and clx_0.5.1

Christophe Rhodes <[email protected]> Fri, 08 Aug 2003 18:21:21 +0100
Newsgroups gmane.lisp.clx.devel
Message-ID <[email protected]>
Christophe Rhodes <[email protected]> writes:

> OK.  There might be later issues in terms of the pixarray functions in
> image.lisp, but that's a good first step... many thanks.

"might".  Haha.

The GET-IMAGE/COPY-IMAGE functions won't work until READ-PIXARRAY-12
and friends are written, including some mind-bending
image-swap-functions to cope with all ${BIGNUM} possible permuations.
In the meantime I've found some more questionable stuff, dealing with
READ-PIXARRAY-4.

clx/dependent.lisp:

;;; READ-IMAGE-LOAD-BYTE is used to extract 1 and 4 bit pixels from CARD8s.

(defmacro read-image-load-byte (size position integer)
  (unless +image-bit-lsb-first-p+ (setq position (- 7 position)))
  `(the (unsigned-byte ,size)
        (#-Genera ldb #+Genera sys:%logldb
         (byte ,size ,position)
         (the card8 ,integer))))

This is used in READ-PIXARRAY-1, and I believe it's right there; calls
of the form (READ-IMAGE-LOAD-BYTE 1 y z) become
  (LDB (BYTE 1 y) z)
or
  (LDB (BYTE 1 (- 7 y)) z)
as appropriate to the endianness... however, it's also used in
READ-PIXARRAY-4, and I simply do not believe that it's appropriate to
convert (READ-IMAGE-LOAD-BYTE 4 y z) with (- 7 y); consider y = 4,
which on little-endian platforms is
  (LDB (BYTE 4 4) z)
and on big-endian ones is
  (LDB (BYTE 4 3) z)
... surely what we actually want here is (LDB (BYTE 4 0) z)?

Now, of course, none of my X servers here actually support
bits-per-pixel values of 4, so I have no way of testing whether or not
this is indeed broken.  Anyone?

Cheers,

Christophe
-- 
http://www-jcsu.jesus.cam.ac.uk/~csr21/       +44 1223 510 299/+44 7729 383 757
(set-pprint-dispatch 'number (lambda (s o) (declare (special b)) (format s b)))
(defvar b "~&Just another Lisp hacker~%")    (pprint #36rJesusCollegeCambridge)