forked from KolibriOS/kolibrios
fix progressbar_draw, optimizations, formatting fixes
git-svn-id: svn://kolibrios.org@4116 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
44d21dbf19
commit
8e9dbc453a
@ -1,46 +1,36 @@
|
||||
macro use_progressbar
|
||||
{
|
||||
pb equ [ebp + 4 + 8*4]
|
||||
pb equ [esp + 4 + 8*4]
|
||||
align 16
|
||||
progressbar_draw:
|
||||
pushad
|
||||
mov ebp, esp
|
||||
; draw frame
|
||||
push ebp
|
||||
mov [.last_esp], esp
|
||||
mov eax, pb
|
||||
mov esi, [eax + PB_LEFT]
|
||||
mov edx, [eax + PB_FRAME_COLOR]
|
||||
mov ebx, [eax + PB_LEFT]
|
||||
mov edi, [eax + PB_TOP]
|
||||
mov ebp, [eax + PB_WIDTH]
|
||||
add ebp, esi
|
||||
mov esi, [eax + PB_HEIGHT]
|
||||
add ebp, ebx
|
||||
add esi, edi
|
||||
dec ebp
|
||||
mov esp, [eax + PB_HEIGHT]
|
||||
add esp, edi
|
||||
dec esp
|
||||
mov edx, [eax + PB_FRAME_COLOR]
|
||||
dec esi
|
||||
mov eax, 38
|
||||
mov ebx, esi
|
||||
shl ebx, 16
|
||||
add ebx, ebp
|
||||
mov ecx, edi
|
||||
shl ecx, 16
|
||||
add ecx, edi
|
||||
mov bx, bp
|
||||
shrd ecx, edi, 16
|
||||
mov cx, di
|
||||
int 64
|
||||
mov ecx, esp
|
||||
shl ecx, 16
|
||||
add ecx, esp
|
||||
shrd ecx, esi, 16
|
||||
mov cx, si
|
||||
int 64
|
||||
shld esi, ebx, 16
|
||||
mov bx, si
|
||||
mov ecx, edi
|
||||
shl ecx, 16
|
||||
add ecx, esp
|
||||
shrd ecx, edi, 16
|
||||
int 64
|
||||
mov ebx, ebp
|
||||
shl ebx, 16
|
||||
add ebx, ebp
|
||||
shrd ebx, ebp, 16
|
||||
mov bx, bp
|
||||
int 64
|
||||
mov esp, [.last_esp]
|
||||
pop ebp
|
||||
; if min > max then .skip
|
||||
mov eax, pb
|
||||
mov edx, [eax + PB_MAX]
|
||||
@ -55,17 +45,17 @@ progressbar_draw:
|
||||
mov edi, eax
|
||||
mov eax, pb
|
||||
mov ebx, [eax + PB_LEFT]
|
||||
inc ebx
|
||||
shl ebx, 16
|
||||
add ebx, edi
|
||||
mov ecx, [eax + PB_TOP]
|
||||
mov edx, [eax + PB_PROGRESS_COLOR]
|
||||
inc ebx
|
||||
inc ecx
|
||||
shl ebx, 16
|
||||
shl ecx, 16
|
||||
add ebx, edi
|
||||
add ecx, [eax + PB_HEIGHT]
|
||||
dec ecx
|
||||
dec ecx
|
||||
mov edx, [eax + PB_PROGRESS_COLOR]
|
||||
mov eax, 13
|
||||
dec ecx
|
||||
int 64
|
||||
; draw last part of non-progress rectangle
|
||||
; edi = pW, esi = W - 2
|
||||
@ -80,17 +70,15 @@ progressbar_draw:
|
||||
; .skip:
|
||||
popad
|
||||
ret 4
|
||||
.last_esp dd 0
|
||||
|
||||
|
||||
align 16
|
||||
get_progress_width:
|
||||
; pW = (W-2)(value - min) / (max - min)
|
||||
mov esi, [eax + PB_WIDTH]
|
||||
dec esi
|
||||
dec esi
|
||||
mov eax, [eax + PB_VALUE]
|
||||
dec esi
|
||||
sub eax, ecx
|
||||
dec esi
|
||||
imul eax, esi
|
||||
neg ecx
|
||||
add ecx, edx
|
||||
@ -98,11 +86,9 @@ get_progress_width:
|
||||
div ecx
|
||||
ret
|
||||
|
||||
|
||||
align 16
|
||||
progressbar_progress:
|
||||
pushad
|
||||
mov ebp, esp
|
||||
; if min > max then .skip
|
||||
mov eax, pb
|
||||
mov edx, [eax + PB_MAX]
|
||||
@ -116,8 +102,8 @@ progressbar_progress:
|
||||
mov edi, eax
|
||||
; increase value
|
||||
mov eax, pb
|
||||
mov edx, [eax + PB_MAX]
|
||||
mov ecx, [eax + PB_VALUE]
|
||||
mov edx, [eax + PB_MAX]
|
||||
inc ecx
|
||||
; if value > max then value = max
|
||||
cmp ecx, edx
|
||||
@ -137,19 +123,19 @@ progressbar_progress:
|
||||
; edi = last pW, esi = new pW
|
||||
mov eax, pb
|
||||
mov ebx, [eax + PB_LEFT]
|
||||
inc ebx
|
||||
add ebx, edi
|
||||
shl ebx, 16
|
||||
add ebx, esi
|
||||
sub ebx, edi
|
||||
mov ecx, [eax + PB_TOP]
|
||||
inc ecx
|
||||
shl ecx, 16
|
||||
add ecx, [eax + PB_HEIGHT]
|
||||
dec ecx
|
||||
dec ecx
|
||||
mov edx, [eax + PB_PROGRESS_COLOR]
|
||||
inc ebx
|
||||
inc ecx
|
||||
add ebx, edi
|
||||
shl ecx, 16
|
||||
shl ebx, 16
|
||||
add ecx, [eax + PB_HEIGHT]
|
||||
add ebx, esi
|
||||
dec ecx
|
||||
sub ebx, edi
|
||||
mov eax, 13
|
||||
dec ecx
|
||||
int 64
|
||||
; .skip:
|
||||
popad
|
||||
|
Loading…
Reference in New Issue
Block a user