DMB@PSUVMA.BITNET (11/25/86)
Is there a high penalty for using a mask region when performing copybits? Are you better off always copybits-zing the entire bitmap, or is the masking operation fairly fast? Where's the tradeoff point? dave
lsr@apple.UUCP (Larry Rosenstein) (12/05/86)
In articles <8718DMB@PSUVMA>, <8719DMB@PSUVMA> DMB@PSUVMA.BITNET writes: > > [Stuff about bit alignment and using a second copybits to handle > bit shifting.....] > > What exactly does this mean? > > Is there a high penalty for using a mask region when performing copybits? >Are you better off always copybits-zing the entire bitmap, or is the masking >operation fairly fast? Where's the tradeoff point? > Consider a very simple case of Copybits in which you are simply copying a few bits of a 68000 word. source [FEDCBA9876543210] |---------| <=== bits being copied destination [FEDCBA9876543210] |---------| In this case it is pretty clear that the same number of bits are being copied, but that since the source and destination are on a different bit boundary, that you have to do a shift (in addition to the masking). The situation is exactly the same in the larger case. If the bit number (relative to a 68000 word) of the first bit in the source bitmap is not the same as the bit number of the first destination bit, then shifting must be done. Copybits runs much faster if no shifting is necessary. My original comment was that when copying onto the screen, the difference in speed is visually noticeable. Therefore it is worthwhile to do a second copybits (entirely offscreen) whose only purpose is to align the bits. I think that the maskRgn will slow down Copybits noticeably in all cases. Quickdraw usually optimizes the case of a rectangular region, so that situation may be faster. (A rectangular maskRgn doesn't make much sense, however, since you can simply intersect it with the source/destination rectangles.) If you can't avoid using a maskRgn, then you might get a better visual effect if you construct a rectangular bitmap offscreen (i.e., using the maskRgn and doing the alignment), and using a fast Copybits to put it on the screen. -- Larry Rosenstein Object Specialist Apple Computer AppleLink: Rosenstein1 UUCP: {sun, voder, nsc, mtxinu, dual}!apple!lsr CSNET: lsr@Apple.CSNET