diff --git a/kernel/trunk/video/vesa20.inc b/kernel/trunk/video/vesa20.inc index 368ce3fbd6..019f3345c0 100644 --- a/kernel/trunk/video/vesa20.inc +++ b/kernel/trunk/video/vesa20.inc @@ -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