Rev 928 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 928 | Rev 996 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 7... | Line 7... | ||
7 | 7 | ||
Line 8... | Line 8... | ||
8 | $Revision: 928 $ |
8 | $Revision: 996 $ |
9 | 9 | ||
10 | 10 | ||
Line 32... | Line 32... | ||
32 | align 4 |
32 | align 4 |
33 | draw_mouse_under: |
33 | draw_mouse_under: |
34 | ; return old picture |
34 | ; return old picture |
Line 35... | Line 35... | ||
35 | 35 | ||
36 | cmp [set_hw_cursor], 0 |
36 | cmp [set_hw_cursor], 0 |
37 | jz @F |
37 | jz .exit |
38 | pushad |
38 | pushad |
39 | mov eax, [x_under] |
39 | mov eax, [x_under] |
40 | mov ebx, [y_under] |
40 | mov ebx, [y_under] |
41 | stdcall [hw_restore], eax, ebx |
41 | stdcall [hw_restore], eax, ebx |
42 | popad |
- | |
43 | ret |
- | |
44 | @@: |
- | |
45 | pushad |
- | |
46 | xor ecx,ecx |
- | |
47 | xor edx,edx |
- | |
48 | align 4 |
42 | popad |
49 | mres: |
- | |
50 | mov eax, [x_under] |
- | |
51 | mov ebx, [y_under] |
- | |
52 | add eax,ecx |
- | |
53 | add ebx,edx |
- | |
54 | push ecx |
- | |
55 | push edx |
- | |
56 | push eax |
- | |
57 | push ebx |
- | |
58 | mov eax,edx |
- | |
59 | shl eax,6 |
- | |
60 | shl ecx,2 |
- | |
61 | add eax,ecx |
- | |
62 | add eax,mouseunder |
- | |
63 | mov ecx,[eax] |
- | |
64 | pop ebx |
- | |
65 | pop eax |
- | |
66 | mov edi, 1 ;force |
- | |
67 | call [putpixel] |
- | |
68 | pop edx |
- | |
69 | pop ecx |
- | |
70 | inc ecx |
- | |
71 | cmp ecx, 16 |
- | |
72 | jnz mres |
- | |
73 | xor ecx, ecx |
- | |
74 | inc edx |
- | |
75 | cmp edx, 24 |
- | |
76 | jnz mres |
- | |
77 | popad |
43 | .exit: |
Line 78... | Line 44... | ||
78 | ret |
44 | ret |
Line 79... | Line 45... | ||
79 | 45 | ||
80 | save_draw_mouse: |
46 | save_draw_mouse: |
- | 47 | ||
81 | 48 | cmp [set_hw_cursor], 0 |
|
Line 82... | Line 49... | ||
82 | cmp [set_hw_cursor], 0 |
49 | je .exit |
83 | je .no_hw_cursor |
50 | |
84 | pushad |
51 | pushad |
Line 99... | Line 66... | ||
99 | mov esi, [edx+SLOT_BASE+APPDATA.cursor] |
66 | mov esi, [edx+SLOT_BASE+APPDATA.cursor] |
Line 100... | Line 67... | ||
100 | 67 | ||
101 | cmp esi, [current_cursor] |
68 | cmp esi, [current_cursor] |
Line 102... | Line -... | ||
102 | je .draw |
- | |
103 | - | ||
104 | ; cmp [esi+CURSOR.magic], 'CURS' |
- | |
105 | ; jne .fail |
69 | je .draw |
106 | 70 | ||
107 | push esi |
71 | push esi |
108 | call [select_hw_cursor] |
72 | call [select_hw_cursor] |
109 | mov [current_cursor], esi |
73 | mov [current_cursor], esi |
110 | .draw: |
74 | .draw: |
111 | stdcall [set_hw_cursor], esi |
- | |
112 | popad |
75 | stdcall [set_hw_cursor], esi |
113 | ret |
- | |
114 | .fail: |
- | |
115 | mov ecx, [def_cursor] |
- | |
116 | mov [edx+SLOT_BASE+APPDATA.cursor], ecx |
- | |
117 | stdcall [set_hw_cursor], ecx ; stdcall: [esp]=ebx,eax |
- | |
118 | popad |
- | |
119 | ret |
- | |
120 | - | ||
121 | .no_hw_cursor: |
- | |
122 | pushad |
- | |
123 | ; save & draw |
- | |
124 | mov [x_under], eax |
- | |
125 | mov [y_under], ebx |
- | |
126 | push eax |
- | |
127 | push ebx |
- | |
128 | mov ecx,0 |
- | |
129 | mov edx,0 |
- | |
130 | align 4 |
- | |
131 | drm: |
- | |
132 | push eax |
- | |
133 | push ebx |
- | |
134 | push ecx |
- | |
135 | push edx |
- | |
136 | ; helloworld |
- | |
137 | push ecx |
- | |
138 | add eax,ecx ; save picture under mouse |
- | |
139 | add ebx,edx |
- | |
140 | push ecx |
- | |
141 | call getpixel |
- | |
142 | mov [color_temp],ecx |
- | |
143 | pop ecx |
- | |
144 | mov eax,edx |
- | |
145 | shl eax,6 |
- | |
146 | shl ecx,2 |
- | |
147 | add eax,ecx |
- | |
148 | add eax,mouseunder |
- | |
149 | mov ebx,[color_temp] |
- | |
150 | mov [eax],ebx |
- | |
151 | pop ecx |
- | |
152 | mov edi,edx ; y cycle |
- | |
153 | shl edi,4 ; *16 bytes per row |
- | |
154 | add edi,ecx ; x cycle |
- | |
155 | lea edi, [mousepointer+edi+edi*2] ; we have our str address |
- | |
156 | mov esi, edi |
- | |
157 | add esi, 16*24*3 |
- | |
158 | push ecx |
- | |
159 | mov ecx, [color_temp] |
- | |
160 | call combine_colors |
- | |
161 | mov [mouse_color_mem], ecx |
- | |
162 | pop ecx |
- | |
163 | pop edx |
- | |
164 | pop ecx |
- | |
165 | pop ebx |
- | |
166 | pop eax |
- | |
167 | add eax,ecx ; we have x coord+cycle |
- | |
168 | add ebx,edx ; and y coord+cycle |
- | |
169 | push ecx |
- | |
170 | mov ecx, [mouse_color_mem] |
- | |
171 | mov edi, 1 |
- | |
172 | call [putpixel] |
- | |
173 | pop ecx |
- | |
174 | mov ebx,[esp+0] ; pure y coord again |
- | |
175 | mov eax,[esp+4] ; and x |
- | |
176 | inc ecx ; +1 cycle |
- | |
177 | cmp ecx,16 ; if more than 16 |
- | |
178 | jnz drm |
- | |
179 | xor ecx, ecx |
- | |
180 | inc edx |
- | |
181 | cmp edx,24 |
- | |
182 | jnz drm |
- | |
183 | add esp,8 |
- | |
184 | popad |
- | |
185 | ret |
- | |
186 | - | ||
187 | - | ||
188 | combine_colors: |
- | |
189 | ; in |
- | |
190 | ; ecx - color ( 00 RR GG BB ) |
- | |
191 | ; edi - ref to new color byte |
- | |
192 | ; esi - ref to alpha byte |
- | |
193 | ; |
- | |
194 | ; out |
- | |
195 | ; ecx - new color ( roughly (ecx*[esi]>>8)+([edi]*[esi]>>8) ) |
- | |
196 | push eax |
- | |
197 | push ebx |
- | |
198 | push edx |
- | |
199 | push ecx |
- | |
200 | xor ecx, ecx |
- | |
201 | ; byte 2 |
- | |
202 | mov eax, 0xff |
- | |
203 | sub al, [esi+0] |
- | |
204 | mov ebx, [esp] |
- | |
205 | shr ebx, 16 |
- | |
206 | and ebx, 0xff |
- | |
207 | mul ebx |
- | |
208 | shr eax, 8 |
- | |
209 | add ecx, eax |
- | |
210 | xor eax, eax |
- | |
211 | xor ebx, ebx |
- | |
212 | mov al, [edi+0] |
- | |
213 | mov bl, [esi+0] |
- | |
214 | mul ebx |
- | |
215 | shr eax, 8 |
- | |
216 | add ecx, eax |
- | |
217 | shl ecx, 8 |
- | |
218 | ; byte 1 |
- | |
219 | mov eax, 0xff |
- | |
220 | sub al, [esi+1] |
- | |
221 | mov ebx, [esp] |
- | |
222 | shr ebx, 8 |
- | |
223 | and ebx, 0xff |
- | |
224 | mul ebx |
- | |
225 | shr eax, 8 |
- | |
226 | add ecx, eax |
- | |
227 | xor eax, eax |
- | |
228 | xor ebx, ebx |
- | |
229 | mov al, [edi+1] |
- | |
230 | mov bl, [esi+1] |
- | |
231 | mul ebx |
- | |
232 | shr eax, 8 |
- | |
233 | add ecx, eax |
- | |
234 | shl ecx, 8 |
- | |
235 | ; byte 2 |
- | |
236 | mov eax, 0xff |
- | |
237 | sub al, [esi+2] |
- | |
238 | mov ebx, [esp] |
- | |
239 | and ebx, 0xff |
- | |
240 | mul ebx |
- | |
241 | shr eax, 8 |
- | |
242 | add ecx, eax |
- | |
243 | xor eax, eax |
- | |
244 | xor ebx, ebx |
- | |
245 | mov al, [edi+2] |
- | |
246 | mov bl, [esi+2] |
- | |
247 | mul ebx |
- | |
248 | shr eax, 8 |
- | |
249 | add ecx, eax |
- | |
250 | pop eax |
- | |
251 | pop edx |
- | |
252 | pop ebx |
76 | popad |
Line 253... | Line 77... | ||
253 | pop eax |
77 | .exit: |
254 | ret |
78 | ret |
Line 274... | Line 98... | ||
274 | add ecx, [_display_data] |
98 | add ecx, [_display_data] |
275 | mov eax, [CURRENT_TASK] |
99 | mov eax, [CURRENT_TASK] |
276 | movzx ebx, byte [ecx] |
100 | movzx ebx, byte [ecx] |
277 | cmp eax,ebx |
101 | cmp eax,ebx |
278 | je yes_mouse_disable |
102 | je yes_mouse_disable |
279 | movzx ebx, byte [ecx+16] |
103 | movzx ebx, byte [ecx+32] |
280 | cmp eax,ebx |
104 | cmp eax,ebx |
281 | je yes_mouse_disable |
105 | je yes_mouse_disable |
282 | mov ebx,[Screen_Max_X] |
106 | mov ebx,[Screen_Max_X] |
283 | inc ebx |
107 | inc ebx |
284 | imul ebx,10 |
108 | imul ebx,10 |
285 | add ecx,ebx |
109 | add ecx,ebx |
286 | movzx ebx, byte [ecx] |
110 | movzx ebx, byte [ecx] |
287 | cmp eax,ebx |
111 | cmp eax,ebx |
288 | je yes_mouse_disable |
112 | je yes_mouse_disable |
289 | movzx ebx, byte [ecx+16] |
113 | movzx ebx, byte [ecx+32] |
290 | cmp eax,ebx |
114 | cmp eax,ebx |
291 | je yes_mouse_disable |
115 | je yes_mouse_disable |
292 | jmp no_mouse_disable |
116 | jmp no_mouse_disable |
293 | yes_mouse_disable: |
117 | yes_mouse_disable: |
294 | mov edx,[CURRENT_TASK] |
118 | mov edx,[CURRENT_TASK] |
Line 433... | Line 257... | ||
433 | imul eax,[mouse_speed_factor] |
257 | imul eax,[mouse_speed_factor] |
434 | ;pop edx |
258 | ;pop edx |
435 | @@: |
259 | @@: |
436 | ret |
260 | ret |
Line -... | Line 261... | ||
- | 261 | ||
- | 262 | ||
- | 263 | ;[ecx] x |
|
- | 264 | ;[ecx+4] y |
|
- | 265 | ;[ecx+8] w |
|
- | 266 | ;[ecx+12] h |
|
- | 267 | ||
- | 268 | align 4 |
|
- | 269 | lock_cursor: |
|
- | 270 | ||
- | 271 | pushfd |
|
- | 272 | cli |
|
- | 273 | ||
- | 274 | xor eax, eax |
|
- | 275 | mov edx, [ecx] |
|
- | 276 | mov ebx, [ecx+4] |
|
- | 277 | cmp edx, [cur.right] |
|
- | 278 | jg .done |
|
- | 279 | ||
- | 280 | cmp ebx, [cur.bottom] |
|
- | 281 | jg .done |
|
- | 282 | ||
- | 283 | add edx, [ecx+8] |
|
- | 284 | add ebx, [ecx+12] |
|
- | 285 | cmp edx, [cur.left] |
|
- | 286 | jle .done |
|
- | 287 | ||
- | 288 | cmp ebx, [cur.top] |
|
- | 289 | jle .done |
|
- | 290 | ||
- | 291 | mov ecx, [CURRENT_TASK] |
|
- | 292 | ||
- | 293 | mov ebx, [cur.left] |
|
- | 294 | mov eax, [cur.top] |
|
- | 295 | add ebx, [_display_data] |
|
- | 296 | mul [_screen_width] |
|
- | 297 | add ebx, eax |
|
- | 298 | ||
- | 299 | cmp cl, [ebx] |
|
- | 300 | je .disable |
|
- | 301 | ||
- | 302 | cmp cl, [ebx+31] |
|
- | 303 | je .disable |
|
- | 304 | ||
- | 305 | mov eax, [_screen_width] |
|
- | 306 | shl eax, 5 |
|
- | 307 | sub eax, [_screen_width] |
|
- | 308 | ||
- | 309 | cmp cl, [ebx+eax] |
|
- | 310 | je .disable |
|
- | 311 | ||
- | 312 | cmp cl, [ebx+eax+31] |
|
- | 313 | jne .done |
|
- | 314 | ||
- | 315 | .disable: |
|
- | 316 | call draw_mouse_under |
|
- | 317 | ||
- | 318 | mov eax, 1 |
|
- | 319 | .done: |
|
- | 320 | inc eax |
|
- | 321 | mov [cur.lock], eax |
|
- | 322 | popfd |
|
- | 323 | ret |
|
- | 324 | ||
- | 325 | align 4 |
|
- | 326 | unlock_cursor: |
|
- | 327 | pushfd |
|
- | 328 | cli |
|
- | 329 | cmp [cur.lock], 2 |
|
- | 330 | jne .done |
|
- | 331 | ||
- | 332 | call save_draw_mouse |
|
- | 333 | .done: |
|
- | 334 | mov [cur.lock], 1 |
|
- | 335 | popfd |