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

Re: _DrawPicture



>On page 88 and 89 of Inside Macintosh V, an example is given
>to spool a picture from disk.  In that example, QuickDraw
>repeatedly calls GetPICTData, which in turn calls
>FSRead(globalRef,longCount,dataPtr).
>
>I assume that dataPtr is a pointer to the buffer and
>longCount is the number of bytes transferred from the disk
>to the buffer.  Therefore, if I increase longCount, I/O can
>be reduced and drawing a picture can be expedited.  This
>does not seem to work. Worse, when I set longCount to 1024,
>the system simply crashes.
>
>(There are two files, "mac-file-io.lisp" and
>"picture-files.lisp", at cambridge.apple.com.  These files
>implement the example on page 88 and 89 in MCL.  The
>longCount used there is 10.)
>
>How to speed up _DrawPicture by providing a larger buffer?

Nice idea, but I'm afrad it won't work. The QuickDraw code is
the one asking for the bytes. It asks for a certain number of
bytes to be read into a certain area of memory. Reading more
will be highly unexpected, and will very possibly overwrite
memory that is holding important information (hence the crash).
The relevant code (from "picture-files.lisp") is:

(defpascal *get-pict-data* (:ptr dataPtr :word byteCount)
  (FSRead *pict-input-pb* byteCount dataPtr 0 nil))

And inside of OPEN-PICT-INPUT-FILE:

              (rset newGrafProcs :QDProcs.getPicProc *get-pict-data*)

The getPicProc field of the QDProcs record is what QuickDraw calls to
get bytes from a picture. It takes two arguments, dataPtr & byteCount:
where to put the bytes and how many to read.

Clear as mud, right?

-----
Bill St. Clair
bill@cambridge.apple.com