Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2619 mario79 1
;------------------------------------------------------------------------------
2
align 4
3
draw_appl_button:
4
; in:
5
; ebx = [x]*65536 + [size x]
6
; ecx = [y]*65536 + [size y]
7
; edx = internal color 0xRRGGBB
8
; esi = external color 0xRRGGBB
9
; edi = 0 up or 1 down
10
COLOR_CHANGE_MAGNITUDE_0 = 0x080808
11
COLOR_CHANGE_MAGNITUDE = 0x101010
12
COLOR_CHANGE_MAGNITUDE_1 = 0x202020
13
COLOR_CHANGE_MAGNITUDE_2 = 0x404040
14
	pusha
15
	add	ebx,2 shl 16
16
	sub	bx,4
17
	add	ecx,2 shl 16
18
	sub	cx,4
19
	mcall	13
20
;------------------------------------------------------------------------------
21
;	mov	edx,esi
22
	test	edi,edi
23
	jnz	@f
24
 
25
	mov	eax,COLOR_CHANGE_MAGNITUDE
26
	call	add_color_change_magnitude
27
	jmp	.1
28
;--------------------------------------
29
align 4
30
@@:
31
	mov	eax,COLOR_CHANGE_MAGNITUDE
32
	call	subtract_color_change_magnitude
33
;--------------------------------------
34
align 4
35
.1:
36
	call	draw_four_extreme_lines
37
;------------------------------------------------------------------------------
38
	mov	edx,esi
39
	mov	eax,COLOR_CHANGE_MAGNITUDE_2
40
	call	subtract_color_change_magnitude
41
	sub	ecx,1 shl 16
42
	add	ecx,2
43
	sub	ebx,1 shl 16
44
	add	ebx,2
45
	call	draw_four_extreme_lines
46
;------------------------------------------------------------------------------
47
	popa
48
	ret
49
;------------------------------------------------------------------------------
50
align 4
51
draw_four_extreme_lines:
52
; top left point
53
	push	ebx ecx
54
	shr	ebx,16
55
	shr	ecx,16
56
	mcall	1
57
	pop	ecx ebx
58
; bottom right point
59
	push	ebx ecx
60
	movzx	eax,bx
61
	shr	ebx,16
62
	add	ebx,eax
63
	dec	ebx
64
	movzx	eax,cx
65
	shr	ecx,16
66
	add	ecx,eax
67
	dec	ecx
68
	mcall	1
69
	pop	ecx ebx
70
;--------------------------------------
71
; bottom left point
72
	push	ebx ecx
73
	shr	ebx,16
74
	movzx	eax,cx
75
	shr	ecx,16
76
	add	ecx,eax
77
	dec	ecx
78
	mcall	1
79
	pop	ecx ebx
80
;--------------------------------------
81
; top right point
82
	push	ebx ecx
83
	movzx	eax,bx
84
	shr	ebx,16
85
	add	ebx,eax
86
	dec	ebx
87
	shr	ecx,16
88
	mcall	1
89
	pop	ecx ebx
90
;--------------------------------------
91
; top line
92
	push	ecx
93
	sub	ecx,1 shl 16
94
	mov	cx,1
95
	mcall	13
96
	pop	ecx
97
; bottom line
98
	push	ecx
99
	mov	ax,cx
100
	shl	eax,16
101
	add	ecx,eax
102
	mov	cx,1
103
	mcall	13
104
	pop	ecx
105
; left line
106
	push	ebx
107
	sub	ebx,1 shl 16
108
	mov	bx,1
109
	mcall	13
110
	pop	ebx
111
; right line
112
	push	ebx
113
	mov	ax,bx
114
	shl	eax,16
115
	add	ebx,eax
116
	mov	bx,1
117
	mcall	13
118
	pop	ebx
119
 
120
	ret
121
;------------------------------------------------------------------------------
122
align 4
123
subtract_color_change_magnitude:
124
; in:
125
; edx = original color
126
; eax = magnitude
127
; out:
128
; edx = processed color
129
	sub	dl,al
130
	jae	@f
131
	xor	dl,dl
132
@@:
133
	ror	edx,8
134
	ror	eax,8
135
	sub	dl,al
136
	jae	@f
137
	xor	dl,dl
138
@@:
139
	ror	edx,8
140
	ror	eax,8
141
	sub	dl,al
142
	jae	@f
143
	xor	dl,dl
144
@@:
145
	rol	edx,16
146
	ret
147
;------------------------------------------------------------------------------
148
align 4
149
add_color_change_magnitude:
150
; in:
151
; edx = original color
152
; eax = magnitude
153
; out:
154
; edx = processed color
155
	add	dl,al
156
	jae	@f
157
	mov	dl,0xff
158
@@:
159
	ror	edx,8
160
	ror	eax,8
161
	add	dl,al
162
	jae	@f
163
	mov	dl,0xff
164
@@:
165
	ror	edx,8
166
	ror	eax,8
167
	add	dl,al
168
	jae	@f
169
	mov	dl,0xff
170
@@:
171
	rol	edx,16
172
	ret
173
;------------------------------------------------------------------------------
174
calculate_button_y_coordinate_and_size:
175
	mov	ecx,[button_top_offset]
176
	shl	ecx,16
177
	add	ecx,[height]
178
	sub	ecx,[button_top_offset]
179
	sub	ecx,[button_bottom_offset]
180
	ret