'buf2d.obj' functions 'buf_rect_by_size' and 'buf_filled_rect_by_size' work faster (optimize function 'buf_line_h')

git-svn-id: svn://kolibrios.org@2177 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2011-09-12 22:34:41 +00:00
parent e7b0ce1747
commit edb11c7e8a

View File

@ -1068,19 +1068,44 @@ proc buf_line_h, buf_struc:dword, coord_x0:dword, coord_y0:dword, coord_x1:dword
cmp buf2d_bits,24
jne .end24
mov ebx,dword[coord_x0]
mov ecx,dword[coord_y0]
mov edx,dword[color]
bt ecx,31
jc .end24 ;¥á«¨ ª®®à¤¨­ â  y0 ®âà¨æ â¥«ì­ ï
cmp ecx,buf2d_h
jge .end24 ;¥á«¨ ª®®à¤¨­ â  y0 ¡®«ìè¥ ¢ëá®âë ¡ãä¥à 
mov ebx,dword[coord_x0]
mov esi,dword[coord_x1]
cmp ebx,esi
jle @f
xchg ebx,esi ;¥á«¨ x0 > x1 â® ¬¥­ï¥¬ ¬¥áâ ¬¨ x0 ¨ x1
@@:
cmp esi,buf2d_w
jl @f
mov esi,buf2d_w
;dec esi
@@:
;¢ eax ¢ëç¨á«ï¥¬ ­ ç «® 1-© â®çª¨ «¨­¨¨ ¢ ¡ãä¥à¥ ¨§®¡à ¦¥­¨ï
mov eax,buf2d_w ;size x
imul eax,ecx ;size_x*y
add eax,ebx ;size_x*y+x
lea eax,[eax+eax*2] ;(size_x*y+x)*3
add eax,buf2d_data ;ptr+(size_x*y+x)*3
mov edx,dword[color]
@@: ;横« ¯® ®á¨ x ®â x0 ¤® x1
cmp ebx,esi
jge @f
call draw_pixel
inc ebx
bt ebx,31
jc .otr_x
mov word[eax],dx ;copy pixel color
ror edx,16
mov byte[eax+2],dl
ror edx,16
.otr_x:
add eax,3
inc ebx
jmp @b
@@:
.end24: