ADC Home > Reference Library > Technical Q&As > Carbon > Graphics & Imaging >

Problems recording CopyBits into a PICT on Mac OS X 10.2


Q: Why doesn't CopyBits(portBitsPtr, portBitsPtr, &srcRect, &dstRect, srcCopy, NULL) get recorded in a PICT on Mac OS X 10.2 when I'm copying from a window port onto itself?

A: This is a known bug (r. 3017823) in 10.2 that prevents CopyBits calls from being recorded into PICTs under the following conditions:

  • Source and destination ports are the same window port
  • Source and destination rectangles are the same size
  • srcCopy blit mode
  • NULL mask region

This bug is fixed in Mac OS X 10.2.2 and later, but for 10.2 and 10.2.1 the simplest workaround is to construct a rectangular region out of dstRect using RectRgn and pass that in as the last parameter, i.e.




    RgnHandle dstRectRgn;
    dstRectRgn = NewRgn();
    if (dstRectRgn != NULL) {
        RectRgn(dstRectRgn, &dstRect);
        CopyBits(portBitsPtr, portBitsPtr, &srcRect, &dstRect, srcCopy, dstRectRgn);
        DisposeRgn(dstRectRgn);
    }



Both RectRgn and CopyBits are defined in QuickDraw.h and described in Inside Macintosh: Imaging with QuickDraw.


[Aug 14 2002]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.