home *** CD-ROM | disk | FTP | other *** search
- ========================================================
-
- Line draw algorithm, for 8 bpp modes, with clipping.
-
- This application directory contains the sources of a
- very fast line draw algorithm with clipping. It will
- work in any one byte per pixel mode (256 colours).
-
- Feel free to use this code in any program you like,
- but be polite and mention my name when you do so!
-
- Both line draw and clipping algorithm use arithmical
- shifts only, they don't need divides. Line draw code
- is based on Bresenham's simple DDA. Clipping code is
- partly based on Cohen & Sutherland's algorithm.
-
- Random line draw clipping has been optimised to
- detect lines which need no clipping at all and lines
- which are completely outside the screen first. Both
- horizontal and vertical line draw have their own
- clipping algorithm.
-
- If you want a graphical demonstration of how the
- clipping algorithm operates run the 'Clip' program.
- It operates almost exactly as the assembly version
- but you can see it working step by step.
-
- Horizontal line draw was optimised to perform well
- even for lines under 12 pixels (breakeven point).
- It has seperate code to plot short and long lines.
-
- --------------------------------------------------------
-
- Typical performance on a standard A310, with average
- line sizes of 128 pixels and all IRQ's enabled:
-
- When no clipping is needed:
-
- Random lines - 720 KPixels/sec
- Diagonal lines - 1100 KPixels/sec
-
- When line is clipped first:
-
- Random lines - 670 KPixels/sec
- Diagonal lines - 1040 KPixels/sec
- Vertical lines - 1200 KPixels/sec
- Horizontal lines - 4700 KPixels/sec
- Single points - 90 KPixels/sec
-
- When line can be rejected:
-
- Random lines - 12 MPixels/sec
- Diagonal lines - 12 MPixels/sec
- Vertical lines - 17 MPixels/sec
- Horizontal lines - 17 MPixels/sec
- Single points - 200 KPixels/sec
-
- Horizontal lines performance:
-
- 1 pixel - 90 KPixels/sec
- 2 pixels - 160 KPixels/sec
- 4 pixels - 300 KPixels/sec
- 8 pixels - 540 KPixels/sec
- 16 pixels - 870 KPixels/sec
- 32 pixels - 1600 KPixels/sec
- 64 pixels - 2.8 MPixels/sec
- 128 pixels - 4.7 MPixels/sec
- 256 pixels - 7.0 MPixels/sec
- 512 pixels - 9.2 MPixels/sec
- 1024 pixels - 10.7 MPixels/sec
-
- Maximum performance in pixels per processor cycle
- and pixels per second for the plotting algorithm,
- rating the ARM at 7 cycles/sec (average cycle time):
-
- Random lines - 1 pixel(s)/7 cycles
- 1 MPixels/sec
- Diagonal lines - 1 pixel(s)/4 cycles
- 1750 KPixels/sec
- Vertical lines - 1 pixel(s)/4 cycles
- 1750 KPixels/sec
- Horizontal lines - 16 pixel(s)/7 cycles
- 16 MPixels/sec
-
- Current efficiency (with clipping):
-
- Random lines - 71% (at 128 pixels)
- Diagonal lines - 63% (at 128 pixels)
- Vertical lines - 69% (at 128 pixels)
- Horizontal lines - 30% (at 128 pixels)
- - 44% (at 256 pixels)
- - 58% (at 512 pixels)
- - 67% (at 1024 pixels)
-
- ========================================================
-
- This application is freeware. You may copy it freely
- but only when you copy this application and all it's
- related data files completely without omissions and
- you do not gain any financial profit from doing so.
-
- If you have any comments or suggestions about this
- program, please contact the author as :
-
- Jan-Herman Buining Acorn BBS : (020)6631849
- Soendastraat 133 Huco BBS : (01804)30785
- 9715 NP Groningen La Luna BBS : (02593)41891
- (050)735228
- The Netherlands Eunet : jhb@neabbs.UUCP
-
- ========================================================
-