mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-04 14:21:55 +03:00
bab525b2cf
1) Fixed window flicker when redrawing 2) Fixed memory leak for stack git-svn-id: svn://kolibrios.org@1643 a494cfbc-eb01-0410-851d-a64ba20cac60
54 lines
1.1 KiB
PHP
54 lines
1.1 KiB
PHP
;-----------------------------------------------------------
|
|
;-------analizing picture to palette------------------------
|
|
;-----------------------------------------------------------
|
|
analizing_picture_to_palette:
|
|
mov eax,[Picture_SizeX]
|
|
mov ebx,[Picture_SizeY]
|
|
imul eax,ebx
|
|
mov ecx,eax
|
|
mov edx,[PointerToPicture]
|
|
mov esi,1 ;counter colors in palette
|
|
|
|
;put firs color of picture how one color in palette
|
|
mov ebp,[PointerToPalette]
|
|
mov eax,[edx]
|
|
and eax,0xffffff
|
|
mov [ebp],eax
|
|
|
|
analizing_to_palette:
|
|
mov eax,[edx]
|
|
and eax,0xffffff
|
|
mov edi,esi
|
|
mov ebp,[PointerToPalette]
|
|
|
|
next_color_in_palette:
|
|
mov ebx,[ebp]
|
|
and ebx,0xffffff
|
|
cmp ebx,eax ;this is color have in palette
|
|
je exit_loop_palette
|
|
|
|
add ebp,4
|
|
dec edi
|
|
jnz next_color_in_palette
|
|
|
|
inc esi
|
|
cmp esi,256 ;256 colors
|
|
ja more_than_256_colors
|
|
|
|
mov ebp,[PointerToPalette]
|
|
mov ebx,esi
|
|
dec ebx
|
|
shl ebx,2
|
|
add ebp,ebx
|
|
mov [ebp],ax
|
|
shr eax,16
|
|
mov [ebp+2],al
|
|
|
|
exit_loop_palette:
|
|
add edx,3
|
|
dec ecx
|
|
jnz analizing_to_palette
|
|
|
|
more_than_256_colors:
|
|
mov eax,esi
|
|
ret |