Fixes to skin drawing code, in case default.skn wasn't loaded on OS startup

Prevent creation of buttons with negative or zero width/height

git-svn-id: svn://kolibrios.org@54 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Mihail Semenyako (mike.dld) 2006-03-04 17:44:44 +00:00
parent 2a183233b4
commit 47d7819f9a
4 changed files with 44 additions and 4 deletions

View File

@ -173,6 +173,11 @@ sys_button:
push ecx push ecx
push edx push edx
or ax,ax
jle noaddbutt
or bx,bx
jle noaddbutt
test ecx,0x40000000 test ecx,0x40000000
jnz button_no_draw jnz button_no_draw

View File

@ -56,9 +56,14 @@ load_skin:
mov [_skinh],22 mov [_skinh],22
mov eax,_skin_file mov eax,_skin_file
mov edx,skin_data mov edx,skin_data
mov [ebp+SKIN_HEADER.ident],'????' mov [edx+SKIN_HEADER.ident],'????'
call load_skin_file call load_skin_file
call parse_skin_data cmp eax,ERROR_SUCCESS
je @f
cmp eax,ERROR_END_OF_FILE
jne .exit
@@: call parse_skin_data
.exit:
popad popad
ret ret
@ -67,6 +72,12 @@ parse_skin_data:
cmp [ebp+SKIN_HEADER.ident],'SKIN' cmp [ebp+SKIN_HEADER.ident],'SKIN'
jne .exit jne .exit
mov edi,skin_udata
mov ecx,(skin_udata.end-skin_udata)/4
xor eax,eax
cld
rep stosd
mov ebx,[ebp+SKIN_HEADER.params] mov ebx,[ebp+SKIN_HEADER.params]
add ebx,skin_data add ebx,skin_data
mov eax,[ebx+SKIN_PARAMS.skin_height] mov eax,[ebx+SKIN_PARAMS.skin_height]
@ -87,7 +98,6 @@ parse_skin_data:
mov edi,common_colours mov edi,common_colours
mov ecx,[ebx+SKIN_PARAMS.dtp.size] mov ecx,[ebx+SKIN_PARAMS.dtp.size]
and ecx,127 and ecx,127
cld
rep movsb rep movsb
mov eax,dword[ebx+SKIN_PARAMS.margin.right] mov eax,dword[ebx+SKIN_PARAMS.margin.right]
mov dword[_skinmargins+0],eax mov dword[_skinmargins+0],eax
@ -233,6 +243,19 @@ drawwindow_IV:
js no_skin_add_button js no_skin_add_button
call draw_rectangle call draw_rectangle
cmp dword[skin_data],'SKIN'
je @f
xor eax,eax
xor ebx,ebx
mov esi,[esp]
mov ecx,[esi+8]
inc ecx
mov edx,[_skinh]
mov edi,[common_colours+4] ; standard grab color
call [drawbar]
jmp draw_clientbar
@@:
mov esi,[esp] mov esi,[esp]
mov eax,[esi+8] ; window width mov eax,[esi+8] ; window width
mov edx,[ebp+SKIN_DATA.left.left] mov edx,[ebp+SKIN_DATA.left.left]
@ -289,6 +312,8 @@ drawwindow_IV:
add ecx,[_skinh] add ecx,[_skinh]
call sys_putimage_with_check call sys_putimage_with_check
draw_clientbar:
mov esi,[esp] mov esi,[esp]
mov edx,[esi+04] ; WORK AREA mov edx,[esi+04] ; WORK AREA
@ -307,6 +332,9 @@ drawwindow_IV:
call [drawbar] call [drawbar]
_noinside2: _noinside2:
cmp dword[skin_data],'SKIN'
jne no_skin_add_button
;* close button ;* close button
mov edi,[0xfe88] mov edi,[0xfe88]
movzx eax,word [edi] movzx eax,word [edi]

View File

@ -32,6 +32,7 @@ uglobal
align 4 align 4
skin_udata:
_skinh dd ? _skinh dd ?
_skinmargins rw 4 _skinmargins rw 4
@ -44,4 +45,8 @@ align 4
_skin_file rb 256 _skin_file rb 256
align 4
skin_udata.end:
endg endg

View File

@ -316,7 +316,9 @@ display_settings:
jne no_com_colours jne no_com_colours
mov [windowtypechanged],dword 1 mov [windowtypechanged],dword 1
mov esi,[0x3010] mov esi,[0x3010]
add esi,[esi+0x10] add esi,0x10
add ebx,[esi]
mov esi,ebx
mov edi,common_colours mov edi,common_colours
and ecx,127 and ecx,127
cld cld