[comp.sys.mac] QuickDraw Request

carlile@trwrb.UUCP (Donald E. Carlile) (11/14/86)

(Does the Line eater exist?)

Does anyone know if there is a difference in speed/efficiency between
SetRect and OffsetRect?  If so, which way does it go?

Thanks,

Don Carlile
...trwrb!carlile

Disclaimer:  My company doesn't really care about the answer to this.

rs4u#@ANDREW.CMU.EDU (Richard Siegel) (11/17/86)

[Line-Eater? What line-eater? *chomp* 8-)]

SetRect and OffsetRect are two entirely different operations.

SetRect fills the fields of a rectangle with values, to initialize it. If you
try to use OffsetRect on an uninitialized rectangle, you get garbage. 

OffsetRect is useful for moving a rectangle by a certain distance
horizontally and/or vertically; the same thing could be achieved by adding
the offsets into all fields of your rectangle:

	{
		r.top += voffset;
		r.bottom += voffset;
		r.left += hoffset;
		 r.right += hoffset;
	}


 I would suspect that OffsetRect does much the same thing, so the efficiency
gain by using OffsetRect versus the above 4 lines of code is minimal, if
there is anything. 

To rehash: use SetRect to initialize a rectangle (or you could fill the
fields by hand, it's only a difference in readability. To move a rectangle,
use either OffsetRect (for readability), or else use those 4 lines of code
above...

Hope this helps out.

		--Rich

DMB@PSUVMA.BITNET (11/20/86)

If your really worried about the speed differences of such a meager routine
as setrect or offsetrect, then fill in the fields yourself. I would assume
for either routine the most time costly aspect would be the trapping
mechanism, and not the actual routines.

                                        dave

P.S. My hunch is that setrect is faster