Fix for f38 - correction for the remainder of the division

git-svn-id: svn://kolibrios.org@2353 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2012-02-18 17:56:20 +00:00
parent 5c0c16b554
commit a2109c90b2

View File

@ -445,6 +445,14 @@ dl_dy equ esp+0
cdq ; extend eax sing to edx
shl eax, 16 ; using 16bit fix-point maths
idiv ebp ; eax = ((x2-x1)*65536)/(y2-y1)
;--------------------------------------
; correction for the remainder of the division
shl edx, 1
cmp ebp, edx
jb @f
inc eax
@@:
;--------------------------------------
mov edx, ebp ; edx = counter (number of pixels to draw)
mov ebp, 1 *65536; <<16 ; ebp = dy = 1.0
mov esi, eax ; esi = dx
@ -466,6 +474,14 @@ dl_dy equ esp+0
cdq ; extend eax sing to edx
shl eax, 16 ; using 16bit fix-point maths
idiv esi ; eax = ((y2-y1)*65536)/(x2-x1)
;--------------------------------------
; correction for the remainder of the division
shl edx, 1
cmp esi, edx
jb @f
inc eax
@@:
;--------------------------------------
mov edx, esi ; edx = counter (number of pixels to draw)
mov esi, 1 *65536;<< 16 ; esi = dx = 1.0
mov ebp, eax ; ebp = dy
@ -474,10 +490,25 @@ dl_dy equ esp+0
mov ebx, [dl_y1]
shl eax, 16
shl ebx, 16
;-----------------------------------------------------------------------------
align 4
.draw:
push eax ebx
;--------------------------------------
; correction for the remainder of the division
test ah, 0x80
jz @f
add eax, 1 shl 16
@@:
;--------------------------------------
shr eax, 16
;--------------------------------------
; correction for the remainder of the division
test bh, 0x80
jz @f
add ebx, 1 shl 16
@@:
;--------------------------------------
shr ebx, 16
call [putpixel]
pop ebx eax