But AddLines draws a single connected path? Or has that been
changed in 10.4? Or are you suggesting that instead of drawing a
bunch of separate lines with moveto/lineto, I could connect them
all together and each tick would essentially get drawn twice, like:
line to the right - line down - line back up - repeat
No... you're right, you probably wouldn't want to do that (you
wouldn't want to retrace the lines).
For drawing the tick marks, you could probably create a single path
(a CGPathRef) with all of the individual line segments in it and
stroke them all at once.
You could also record the drawings into a PDF in memory and replay
that PDF every time you wanted to draw the ruler.
Ewww. :)
Well... think of it in terms of optimizing the graphics path to the
screen.
In QuickDraw you use the pixel buffer technique because transferring
memory from main memory to main memory is a really fast operation.
In Mac OS X, however, you are going to be transferring your large
pixel buffer from main memory to VRAM at some point. The VRAM bus is
fast, but not nearly as fast as transfers in main memory. Shipping a
large pixel buffer across the bus is likely to be a "slower" operation.
If you record the drawing commands in a PDF, however, you are sending
drawing commands to the video card, not large bundles of bytes.
Those drawing commands have the potential to execute much faster than
waiting for the pixels to transfer over the bus.
Moreover, the PDF data is likely to be compressed in memory (unlike
your pixel buffer) so your application will do a lot less paging and
paging is slow.
I'd still recommend profiling the result though ;-)
That's a shame really because what you are describing is exactly
what CGLayer is designed for.
Lots and lots of our customers are still running our 10-year-old
product (as opposed to our current product) on OS9. Imagine telling
them they need to buy new machines just so I can draw the rulers in
a different way, and they'll pretty much look and behave *exactly*
as they did before. :)
I have 9+ years of experience with FreeHand that allows me to
empathize perfectly with your position. :-)
Still... CGLayer WOULD be perfect :-P
Scott
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartz-dev/email@hidden