4 ms·
To draw a rounded rect, you don’t want to draw four lines and four quarter circles. That will run into problems if you want to use transfer modes such as XOR, f
by Someone 5y ago
To draw a rounded rect, you don’t want to draw four lines and four quarter circles. That will run into problems if you want to use transfer modes such as XOR, fill with a pattern (phases of the patterns won’t match), etc.
On the Mac, you also needed to do clipping against arbitrary regions (https://www.folklore.org/StoryView.py?project=Macintosh&story=I_Still_Remember_Regions.txt https://www.folklore.org/StoryView.py?project=Macintosh&stor...). Doing that at reasonable speed wasn’t easy at the time.
I didn’t check the source (https://computerhistory.org/blog/macpaint-and-quickdraw-source-code/ https://computerhistory.org/blog/macpaint-and-quickdraw-sour...) but I guess the drawing routines created scanlines top-to-bottom (that’s how regions worked on the Mac), and Bill tweaked a copy of the oval drawing code to insert extra pixels in each line and extra identical lines for the straight vertical parts.
- bonzini 5y agoYes, you'd do it in a single routine to not mess up patterns etc., but the math to find the start and end for each scanline is the same as for Bresenham-style ovals.