Normal quotes
This commit is contained in:
parent
5e10794a24
commit
18011c595a
352 changed files with 6040 additions and 6040 deletions
24
39-05.md
24
39-05.md
|
|
@ -5,7 +5,7 @@
|
|||
**LISTING 39.4 L39-4.ASM**
|
||||
|
||||
; Scan converts an edge from (X1,Y1) to (X2,Y2), not including the
|
||||
; point at (X2,Y2). If SkipFirst == 1, the point at (X1,Y1) isn’t
|
||||
; point at (X2,Y2). If SkipFirst == 1, the point at (X1,Y1) isn't
|
||||
; drawn; if SkipFirst == 0, it is. For each scan line, the pixel
|
||||
; closest to the scanned edge without being to the left of the scanned
|
||||
; edge is chosen. Uses an all-integer approach for speed & precision.
|
||||
|
|
@ -46,10 +46,10 @@
|
|||
public _ScanEdge
|
||||
align 2
|
||||
_ScanEdge proc
|
||||
push bp ;preserve caller’s stack frame
|
||||
push bp ;preserve caller's stack frame
|
||||
mov bp,sp ;point to our stack frame
|
||||
sub sp,LOCAL_SIZE ;allocate space for local variables
|
||||
push si ;preserve caller’s register variables
|
||||
push si ;preserve caller's register variables
|
||||
push di
|
||||
mov di,[bp+EdgePointPtr]
|
||||
mov di,[di] ;point to the HLine array
|
||||
|
|
@ -64,11 +64,11 @@
|
|||
jle ToScanEdgeExit ;guard against 0-length & horz edges
|
||||
mov [bp+Height],bx ;Height = Y2 - Y1
|
||||
sub cx,cx ;assume ErrorTerm starts at 0 (true if
|
||||
; we’re moving right as we draw)
|
||||
; we're moving right as we draw)
|
||||
mov dx,1 ;assume AdvanceAmt = 1 (move right)
|
||||
mov ax,[bp+X2]
|
||||
sub ax,[bp+X1] ;DeltaX = X2 - X1
|
||||
jz IsVertical ;it’s a vertical edge--special case it
|
||||
jz IsVertical ;it's a vertical edge--special case it
|
||||
jns SetAdvanceAmt ;DeltaX >= 0
|
||||
mov cx,1 ;DeltaX < 0 (move left as we draw)
|
||||
sub cx,bx ;ErrorTerm = -Height + 1
|
||||
|
|
@ -78,10 +78,10 @@
|
|||
mov [bp+AdvanceAmt],dx
|
||||
; Figure out whether the edge is diagonal, X-major (more horizontal),
|
||||
; or Y-major (more vertical) and handle appropriately.
|
||||
cmp ax,bx ;if Width==Height, it’s a diagonal edge
|
||||
jz IsDiagonal ;it’s a diagonal edge--special case
|
||||
jb YMajor ;it’s a Y-major (more vertical) edge
|
||||
;it’s an X-major (more horz) edge
|
||||
cmp ax,bx ;if Width==Height, it's a diagonal edge
|
||||
jz IsDiagonal ;it's a diagonal edge--special case
|
||||
jb YMajor ;it's a Y-major (more vertical) edge
|
||||
;it's an X-major (more horz) edge
|
||||
sub dx,dx ;prepare DX:AX (Width) for division
|
||||
div bx ;Width/Height
|
||||
;DX = error term advance per scan line
|
||||
|
|
@ -161,12 +161,12 @@
|
|||
sub di,XEnd ;no, point back to the XStart field
|
||||
UpdateHLinePtr:
|
||||
mov bx,[bp+EdgePointPtr] ;point to pointer to HLine array
|
||||
mov [bx],di ;update caller’s HLine array pointer
|
||||
mov [bx],di ;update caller's HLine array pointer
|
||||
ScanEdgeExit:
|
||||
pop di ;restore caller’s register variables
|
||||
pop di ;restore caller's register variables
|
||||
pop si
|
||||
mov sp,bp ;deallocate local variables
|
||||
pop bp ;restore caller’s stack frame
|
||||
pop bp ;restore caller's stack frame
|
||||
ret
|
||||
_ScanEdge endp
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue