Rev 9930 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9930 | Rev 9941 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2023. 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: 9930 $ |
8 | $Revision: 9941 $ |
9 | 9 | ||
10 | 10 | ||
Line 52... | Line 52... | ||
52 | pushad |
52 | pushad |
53 | movzx eax, word [X_UNDER] |
53 | movzx eax, word [X_UNDER] |
54 | movzx ebx, word [Y_UNDER] |
54 | movzx ebx, word [Y_UNDER] |
55 | stdcall [_display.restore_cursor], eax, ebx |
55 | stdcall [_display.restore_cursor], eax, ebx |
56 | popad |
56 | popad |
57 | ret |
- | |
58 | - | ||
59 | @@: |
57 | @@: |
60 | pushad |
- | |
61 | xor ecx, ecx |
- | |
62 | xor edx, edx |
- | |
63 | - | ||
64 | .mres: |
- | |
65 | movzx eax, word [X_UNDER] |
- | |
66 | movzx ebx, word [Y_UNDER] |
- | |
67 | add eax, ecx |
- | |
68 | add ebx, edx |
- | |
69 | push ecx |
- | |
70 | push edx |
- | |
71 | push eax |
- | |
72 | push ebx |
- | |
73 | mov eax, edx |
- | |
74 | shl eax, 6 |
- | |
75 | shl ecx, 2 |
- | |
76 | add eax, ecx |
- | |
77 | add eax, mouseunder |
- | |
78 | mov ecx, [eax] |
- | |
79 | pop ebx |
- | |
80 | pop eax |
- | |
81 | mov edi, 1 ; force |
- | |
82 | or ecx, 0x04000000 ; don't save to mouseunder area |
- | |
83 | ; call [putpixel] |
- | |
84 | call __sys_putpixel |
- | |
85 | pop edx |
- | |
86 | pop ecx |
- | |
87 | inc ecx |
- | |
88 | cmp ecx, 16 |
- | |
89 | jnz .mres |
- | |
90 | - | ||
91 | xor ecx, ecx |
- | |
92 | inc edx |
- | |
93 | cmp edx, 24 |
- | |
94 | jnz .mres |
- | |
95 | - | ||
96 | popad |
- | |
97 | ret |
58 | ret |
Line 98... | Line 59... | ||
98 | 59 | ||
Line 99... | Line 60... | ||
99 | ;----------------------------------------------------------------------------- |
60 | ;----------------------------------------------------------------------------- |
100 | 61 | ||
101 | align 4 |
62 | align 4 |
102 | save_draw_mouse: |
63 | save_draw_mouse: |
103 | cmp [_display.move_cursor], 0 |
64 | cmp [_display.move_cursor], 0 |
Line 104... | Line 65... | ||
104 | je .no_hw_cursor |
65 | je .exit |
105 | pushad |
66 | pushad |
106 | 67 | ||
Line 156... | Line 117... | ||
156 | mov esi, [window_data + edx + WDATA.cursor] |
117 | mov esi, [window_data + edx + WDATA.cursor] |
157 | cmp esi, [current_cursor] |
118 | cmp esi, [current_cursor] |
158 | je .draw |
119 | je .draw |
Line 159... | Line 120... | ||
159 | 120 | ||
- | 121 | @@: |
|
160 | @@: |
122 | cmp [_display.select_cursor], 0 |
- | 123 | jz .error |
|
161 | push esi |
124 | |
162 | call [_display.select_cursor] |
125 | stdcall [_display.select_cursor], esi |
163 | mov [current_cursor], esi |
126 | mov [current_cursor], esi |
164 | ;-------------------------------------- |
127 | ;-------------------------------------- |
165 | align 4 |
128 | align 4 |
166 | .draw: |
129 | .draw: |
Line 175... | Line 138... | ||
175 | ; stdcall [_display.move_cursor], ecx ; stdcall: [esp]=ebx,eax |
138 | ; stdcall [_display.move_cursor], ecx ; stdcall: [esp]=ebx,eax |
176 | ; popad |
139 | ; popad |
177 | ; ret |
140 | ; ret |
178 | ;-------------------------------------- |
141 | ;-------------------------------------- |
179 | align 4 |
142 | align 4 |
180 | .no_hw_cursor: |
- | |
181 | pushad |
- | |
182 | ; save & draw |
- | |
183 | mov [X_UNDER], ax |
- | |
184 | mov [Y_UNDER], bx |
- | |
185 | push eax |
- | |
186 | push ebx |
- | |
187 | mov ecx, 0 |
- | |
188 | mov edx, 0 |
- | |
189 | ;-------------------------------------- |
- | |
190 | align 4 |
- | |
191 | .drm: |
143 | .error: |
192 | push eax |
- | |
193 | push ebx |
- | |
194 | push ecx |
- | |
195 | push edx |
- | |
196 | ; helloworld |
- | |
197 | push ecx |
- | |
198 | add eax, ecx ; save picture under mouse |
- | |
199 | add ebx, edx |
- | |
200 | push ecx |
- | |
201 | or ecx, 0x04000000 ; don't load to mouseunder area |
- | |
202 | push eax ebx edx edi |
- | |
203 | call [GETPIXEL] |
- | |
204 | pop edi edx ebx eax |
- | |
205 | mov [COLOR_TEMP], ecx |
- | |
206 | pop ecx |
- | |
207 | mov eax, edx |
- | |
208 | shl eax, 6 |
- | |
209 | shl ecx, 2 |
- | |
210 | add eax, ecx |
- | |
211 | add eax, mouseunder |
- | |
212 | mov ebx, [COLOR_TEMP] |
- | |
213 | and ebx, 0xffffff |
- | |
214 | mov [eax], ebx |
- | |
215 | pop ecx |
- | |
216 | mov edi, edx ; y cycle |
- | |
217 | shl edi, 4 ; *16 bytes per row |
- | |
218 | add edi, ecx ; x cycle |
- | |
219 | mov esi, edi |
- | |
220 | add edi, esi |
- | |
221 | add edi, esi ; *3 |
- | |
222 | add edi, [MOUSE_PICTURE] ; we have our str address |
- | |
223 | mov esi, edi |
- | |
224 | add esi, 16*24*3 |
- | |
225 | push ecx |
- | |
226 | mov ecx, [COLOR_TEMP] |
- | |
227 | call combine_colors |
- | |
228 | and ecx, 0xffffff |
- | |
229 | mov [MOUSE_COLOR_MEM], ecx |
- | |
230 | pop ecx |
- | |
231 | pop edx |
- | |
232 | pop ecx |
- | |
233 | pop ebx |
- | |
234 | pop eax |
- | |
235 | add eax, ecx ; we have x coord+cycle |
- | |
236 | add ebx, edx ; and y coord+cycle |
- | |
237 | push ecx |
- | |
238 | mov ecx, [MOUSE_COLOR_MEM] |
- | |
239 | mov edi, 1 ; force |
- | |
240 | or ecx, 0x04000000 ; don't save to mouseunder area |
- | |
241 | ; call [putpixel] |
- | |
242 | call __sys_putpixel |
- | |
243 | pop ecx |
- | |
244 | mov ebx, [esp+0] ; pure y coord again |
- | |
245 | mov eax, [esp+4] ; and x |
- | |
246 | inc ecx ; +1 cycle |
- | |
247 | cmp ecx, 16 ; if more than 16 |
- | |
248 | jnz .drm |
- | |
249 | - | ||
250 | xor ecx, ecx |
- | |
251 | inc edx |
- | |
252 | cmp edx, 24 |
- | |
253 | jnz .drm |
- | |
254 | - | ||
255 | add esp, 8 |
- | |
256 | popad |
144 | popad |
257 | ret |
- | |
258 | - | ||
259 | ;----------------------------------------------------------------------------- |
- | |
260 | - | ||
261 | align 4 |
- | |
262 | combine_colors: |
- | |
263 | ; in |
- | |
264 | ; ecx - color ( 00 RR GG BB ) |
- | |
265 | ; edi - ref to new color byte |
- | |
266 | ; esi - ref to alpha byte |
- | |
267 | ; |
- | |
268 | ; out |
- | |
269 | ; ecx - new color ( roughly (ecx*[esi]>>8)+([edi]*[esi]>>8) ) |
- | |
270 | push eax |
- | |
271 | push ebx |
- | |
272 | push edx |
- | |
273 | push ecx |
- | |
274 | xor ecx, ecx |
- | |
275 | ; byte 0 |
- | |
276 | mov eax, 0xff |
- | |
277 | sub al, [esi+0] |
- | |
278 | mov ebx, [esp] |
- | |
279 | shr ebx, 16 |
- | |
280 | and ebx, 0xff |
- | |
281 | mul ebx |
- | |
282 | shr eax, 8 |
- | |
283 | add ecx, eax |
- | |
284 | xor eax, eax |
- | |
285 | xor ebx, ebx |
- | |
286 | mov al, [edi+0] |
- | |
287 | mov bl, [esi+0] |
- | |
288 | mul ebx |
- | |
289 | shr eax, 8 |
- | |
290 | add ecx, eax |
- | |
291 | shl ecx, 8 |
- | |
292 | ; byte 1 |
- | |
293 | mov eax, 0xff |
- | |
294 | sub al, [esi+1] |
- | |
295 | mov ebx, [esp] |
- | |
296 | shr ebx, 8 |
- | |
297 | and ebx, 0xff |
- | |
298 | mul ebx |
- | |
299 | shr eax, 8 |
- | |
300 | add ecx, eax |
- | |
301 | xor eax, eax |
- | |
302 | xor ebx, ebx |
- | |
303 | mov al, [edi+1] |
- | |
304 | mov bl, [esi+1] |
- | |
305 | mul ebx |
- | |
306 | shr eax, 8 |
- | |
307 | add ecx, eax |
- | |
308 | shl ecx, 8 |
- | |
309 | ; byte 2 |
- | |
310 | mov eax, 0xff |
- | |
311 | sub al, [esi+2] |
- | |
312 | mov ebx, [esp] |
- | |
313 | and ebx, 0xff |
- | |
314 | mul ebx |
- | |
315 | shr eax, 8 |
- | |
316 | add ecx, eax |
- | |
317 | xor eax, eax |
- | |
318 | xor ebx, ebx |
- | |
319 | mov al, [edi+2] |
- | |
320 | mov bl, [esi+2] |
- | |
321 | mul ebx |
- | |
322 | shr eax, 8 |
- | |
323 | add ecx, eax |
- | |
324 | pop eax |
- | |
325 | pop edx |
- | |
326 | pop ebx |
- | |
327 | pop eax |
- | |
328 | ret |
- | |
329 | - | ||
330 | ;----------------------------------------------------------------------------- |
- | |
331 | - | ||
332 | align 4 |
- | |
333 | check_mouse_area_for_getpixel: |
- | |
334 | ; in: |
- | |
335 | ; eax = x |
- | |
336 | ; ebx = y |
- | |
337 | ; out: |
- | |
338 | ; ecx = new color |
- | |
339 | push eax ebx |
- | |
340 | ; check for Y |
- | |
341 | xor ecx, ecx |
- | |
342 | mov cx, [Y_UNDER] ; [MOUSE_Y] |
- | |
343 | - | ||
344 | cmp ebx, ecx |
- | |
345 | jb .no_mouse_area |
- | |
346 | add ecx, 23 ; mouse cursor Y size |
- | |
347 | cmp ebx, ecx |
- | |
348 | ja .no_mouse_area |
- | |
349 | ; offset Y |
- | |
350 | sub bx, [Y_UNDER] ; [MOUSE_Y] |
- | |
351 | ;-------------------------------------- |
- | |
352 | ; check for X |
- | |
353 | xor ecx, ecx |
- | |
354 | mov cx, [X_UNDER] ; [MOUSE_X] |
- | |
355 | cmp eax, ecx |
- | |
356 | jb .no_mouse_area |
- | |
357 | add ecx, 15 ; mouse cursor X size |
- | |
358 | cmp eax, ecx |
- | |
359 | ja .no_mouse_area |
- | |
360 | ; offset X |
- | |
361 | sub ax, [X_UNDER] ; [MOUSE_X] |
- | |
362 | ;-------------------------------------- |
- | |
363 | ; eax = offset x |
- | |
364 | ; ebx = offset y |
- | |
365 | shl ebx, 6 ;y |
- | |
366 | shl eax, 2 ;x |
- | |
367 | add eax, ebx |
- | |
368 | add eax, mouseunder |
- | |
369 | mov ecx, [eax] |
- | |
370 | and ecx, 0xffffff |
- | |
371 | or ecx, 0xff000000 |
- | |
372 | pop ebx eax |
- | |
373 | ret |
- | |
374 | - | ||
375 | .no_mouse_area: |
- | |
376 | xor ecx, ecx |
- | |
377 | pop ebx eax |
- | |
378 | ret |
- | |
379 | - | ||
380 | ;----------------------------------------------------------------------------- |
- | |
381 | - | ||
382 | align 4 |
- | |
383 | check_mouse_area_for_putpixel: |
- | |
384 | ; in: |
- | |
385 | ; ecx = x shl 16 + y |
- | |
386 | ; eax = color |
- | |
387 | ; out: |
145 | .exit: |
388 | ; eax = new color |
- | |
389 | push eax |
- | |
390 | ; check for Y |
- | |
391 | mov ax, [Y_UNDER] ; [MOUSE_Y] |
- | |
392 | cmp cx, ax |
- | |
393 | jb .no_mouse_area |
- | |
394 | add ax, 23 ; mouse cursor Y size |
- | |
395 | cmp cx, ax |
- | |
396 | ja .no_mouse_area |
- | |
397 | ; offset Y |
- | |
398 | sub cx, [Y_UNDER] ; [MOUSE_Y] |
- | |
399 | mov ax, cx |
- | |
400 | shl eax, 16 |
- | |
401 | - | ||
402 | ; check for X |
- | |
403 | mov ax, [X_UNDER] ; [MOUSE_X] |
- | |
404 | shr ecx, 16 |
- | |
405 | cmp cx, ax |
- | |
406 | jb .no_mouse_area |
- | |
407 | add ax, 15 ; mouse cursor X size |
- | |
408 | cmp cx, ax |
- | |
409 | ja .no_mouse_area |
- | |
410 | ; offset X |
- | |
411 | sub cx, [X_UNDER] ; [MOUSE_X] |
- | |
412 | mov ax, cx |
- | |
413 | - | ||
414 | ; eax = (offset y) shl 16 + (offset x) |
- | |
415 | - | ||
416 | pop ecx |
- | |
417 | - | ||
418 | push eax ebx |
- | |
419 | - | ||
420 | mov ebx, eax |
- | |
421 | shr ebx, 16 ; y |
- | |
422 | and eax, 0xffff ; x |
- | |
423 | - | ||
424 | shl ebx, 6 |
- | |
425 | shl eax, 2 |
- | |
426 | add eax, ebx |
- | |
427 | add eax, mouseunder |
- | |
428 | and ecx, 0xFFFFFF |
- | |
429 | mov [eax], ecx |
- | |
430 | - | ||
431 | pop ebx eax |
- | |
432 | - | ||
433 | push esi edi |
- | |
434 | rol eax, 16 |
- | |
435 | movzx edi, ax ; y cycle |
- | |
436 | shl edi, 4 ; *16 bytes per row |
- | |
437 | shr eax, 16 |
- | |
438 | add edi, eax ; x cycle |
- | |
439 | lea edi, [edi*3] |
- | |
440 | add edi, [MOUSE_PICTURE] ; we have our str address |
- | |
441 | mov esi, edi |
- | |
442 | add esi, 16*24*3 |
- | |
443 | call combine_colors |
- | |
444 | pop edi esi |
- | |
445 | mov eax, ecx |
- | |
446 | ret |
- | |
447 | - | ||
448 | .no_mouse_area: |
- | |
449 | pop eax |
- | |
450 | ret |
146 | ret |
Line 451... | Line 147... | ||
451 | 147 | ||
Line 452... | Line 148... | ||
452 | ;----------------------------------------------------------------------------- |
148 | ;----------------------------------------------------------------------------- |
Line 459... | Line 155... | ||
459 | movzx ebx, word [MOUSE_Y] |
155 | movzx ebx, word [MOUSE_Y] |
460 | movzx eax, word [MOUSE_X] |
156 | movzx eax, word [MOUSE_X] |
461 | cmp [redrawmouse_unconditional], 0 |
157 | cmp [redrawmouse_unconditional], 0 |
462 | je @f |
158 | je @f |
463 | mov [redrawmouse_unconditional], 0 |
159 | mov [redrawmouse_unconditional], 0 |
464 | jmp redrawmouse |
160 | jmp .redrawmouse |
465 | @@: |
161 | @@: |
466 | cmp eax, ecx |
162 | cmp eax, ecx |
467 | jne redrawmouse |
163 | jne .redrawmouse |
468 | cmp ebx, edx |
164 | cmp ebx, edx |
469 | je nodmp |
165 | je .nodmp |
Line 470... | Line 166... | ||
470 | 166 | ||
Line 471... | Line 167... | ||
471 | ;-------------------------------------- |
167 | ;-------------------------------------- |
472 | 168 | ||
473 | align 4 |
169 | align 4 |
474 | redrawmouse: |
170 | .redrawmouse: |
475 | pushfd |
171 | pushfd |
476 | cli |
172 | cli |
Line 477... | Line -... | ||
477 | call draw_mouse_under |
- | |
478 | call save_draw_mouse |
- | |
479 | - | ||
480 | ; mov eax, [_display.select_cursor] |
173 | call draw_mouse_under |
481 | ; test eax, eax |
174 | call save_draw_mouse |
Line 482... | Line 175... | ||
482 | ; jz @f |
175 | |
483 | cmp [_display.select_cursor], select_cursor |
176 | cmp [_display.select_cursor], select_cursor |
Line 497... | Line 190... | ||
497 | mov [X_UNDER_subtraction_CUR_hot_x], ax |
190 | mov [X_UNDER_subtraction_CUR_hot_x], ax |
498 | add eax, [cur.w] |
191 | add eax, [cur.w] |
499 | mov [X_UNDER_sub_CUR_hot_x_add_curh], ax |
192 | mov [X_UNDER_sub_CUR_hot_x_add_curh], ax |
500 | @@: |
193 | @@: |
501 | popfd |
194 | popfd |
502 | nodmp: |
195 | .nodmp: |
503 | popad |
196 | popad |
504 | ret |
197 | ret |
Line 505... | Line 198... | ||
505 | 198 |