[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: make-bitmap



>Is there a patch for the apparently buggy make-bitmap
>function of MACL 2.0b1?  Or any way of getting around
>the problem when it is necessary to have some internally
>stored screen image?
>Thanks, Matt
>
> 

The problem is that the default record type for the BITMAP record
was :HANDLE instead of :POINTER. There are two ways to fix this.

1) Change the BITMAP record definition in "interfaces;quickdraw.lisp"
   and evaluate (reindex-interfaces).

2) Change the MAKE-BITMAP function in "library;quickdraw.lisp" to
   be explicit about the storage in its RSET forms:

(defun make-bitmap (left &optional top right bottom &aux rowbytes bm)
  (with-rectangle-arg (r left top right bottom)
    (setq rowbytes 
          (logand
           #xfffe 
           (+ 2  (ash (- (rref r rect.right) (rref r rect.left) 1) -3))))
    (setq bm 
          (#_NewPtr :check-error
                    (+ 14 (* rowbytes
                             (- (rref r rect.bottom) (rref r rect.top))))))
    (rset bm bitmap.bounds r :storage :pointer)
    (rset bm bitmap.rowbytes rowbytes :storage :pointer)
    (rset bm bitmap.baseaddr (%inc-ptr bm 14) :storage :pointer))
  bm)


Both of these have been done for 2.0 final. I recommend that in new
code, you do not rely on the default record storage. 2.0 final will
contain two macros that make explicit record storage specification
easier to type:

(defmacro pref (pointer accessor)
  `(rref ,pointer ,accessor :storage :pointer))

(defmacro href (pointer accessor)
  `(rref ,pointer ,accessor :storage :handle))