From: jcs@crash.cts.com (John Schultz)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Complete Source Code for Processor Polygon Filler
Summary: quick mods
Date: 9 Jun 90 18:26:44 GMT
Organization: Crash TimeSharing, El Cajon, CA




  Here are a few subtle changes to improve performance of the processor
polygon fill code I posted earlier. Both changes are for the file
scanconvert.a. Also, my polygon fill code only works on convex polygons.
If the screen width is changed from 320 pixels, the line drawer's pixel
offset calculations will have to be rewritten to handle a non-40 bytes
per row case (The 80 bytes per row (640 pixels) case is trivial, just
change the lsl.w #3,d3 to lsl.w #4,d3). The polygon routines simply
require a changed define, and could be generalized so it could
handle screen width changes dynamically.

  In _drawline68k, change the code between sk8_vecd and the second
add.l to the below:

; start _drawline changes

sk8_vecd
	subq.w	#1,d2	; setup dbra

	move.l	#$8000,a0	; .5 to add to round up
	move.w	#7,a1

	jsr	(a6)	; draw line

divtrapd
	movem.l	(sp)+,d2-d7/a2-a6
	rts


LINEPLOT	macro
lp0_vecd\@
	move.l	d4,d0	; fixed point arithmetic
	move.l	d5,d1
	add.l	a0,d0
	add.l	a0,d1

; end of _drawline68k changes

  In _fillline68k, change everything from sk7_vec to sk8_vec to:

; start _fillline68k changes

sk7_vec
	move.l	#$8000,d3	; .5 to add to round up
	move.w	d1,a1		; old y = current y
lp0_vec
	move.l	d4,d0		; fixed point arithmetic
	add.l	d3,d0
	swap	d0
	move.l	d5,d1
	add.l	d3,d1
	swap	d1

	cmp.w	a1,d1		; newy # oldy?
	beq.b	ynochange	; no
	move.w	d0,(a0)+	; fastest possible write to memory.
ynochange			
	move.w	d1,a1

	add.l	d6,d4
	add.l	d7,d5

sk8_vec

; end of _filline68k changes
