Subversion Repositories Kolibri OS

Rev

Rev 5577 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5577 Rev 5596
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2011-2015. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2011-2015. 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: 5164 $
8
$Revision: 5363 $
9
 
9
 
10
 
10
 
Line 35... Line 35...
35
align 4
35
align 4
36
block_clip:
36
block_clip:
37
;esi= clip RECT ptr
37
;esi= clip RECT ptr
38
;edi= RECT ptr
38
;edi= RECT ptr
39
;return code:
39
;return code:
40
;eax= 0 - draw, 1 - don't draw
40
;CF= 0 - draw, 1 - don't draw
Line 41... Line 41...
41
 
41
 
Line 42... Line 42...
42
        push    ebx
42
        push    ebx
43
 
43
 
Line 51... Line 51...
51
 
51
 
52
        cmp     ebx, ecx                ;right < clip.left
52
        cmp     ebx, ecx                ;right < clip.left
Line 53... Line 53...
53
        jl      .fail
53
        jl      .fail
54
 
54
 
Line 55... Line 55...
55
        cmp     eax, ecx                ;left >= clip.left
55
        cmp     eax, ecx                ;left >= clip.left
56
        jae     @F
56
        jge     @F
57
 
-
 
58
        mov     eax, ecx
-
 
59
@@:
57
 
60
        mov     [edi+RECT.left], eax
58
        mov     [edi+RECT.left], ecx
61
 
-
 
62
        cmp     ebx, edx                ;right <= clip.right
-
 
63
        jle     @f
-
 
Line -... Line 59...
-
 
59
@@:
-
 
60
        cmp     ebx, edx                ;right <= clip.right
64
        mov     ebx, edx
61
        jle     @f
65
@@:
62
 
66
        mov     [edi+RECT.right], ebx
63
        mov     [edi+RECT.right], edx
67
 
64
@@:
Line 75... Line 72...
75
 
72
 
76
        cmp     ebx, ecx                ;bottom < clip.top
73
        cmp     ebx, ecx                ;bottom < clip.top
Line 77... Line 74...
77
        jl      .fail
74
        jl      .fail
78
 
75
 
Line 79... Line 76...
79
        cmp     eax, ecx                ;top >= clip.top
76
        cmp     eax, ecx                ;top >= clip.top
80
        jae     @F
77
        jge     @F
81
 
-
 
82
        mov     eax, ecx
-
 
83
@@:
78
 
84
        mov     [edi+RECT.top], eax
79
        mov     [edi+RECT.top], ecx
-
 
80
@@:
85
 
81
        cmp     ebx, edx                ;bottom <= clip.bottom
86
        cmp     ebx, edx                ;bottom <= clip.bottom
82
        jle     @f
87
        jle     @f
-
 
88
        mov     ebx, edx
83
 
89
@@:
84
        mov     [edi+RECT.bottom], edx
90
        mov     [edi+RECT.bottom], ebx
85
@@:
91
        pop     ebx
86
        pop     ebx
92
        xor     eax, eax
87
        clc
93
        ret
88
        ret
94
.fail:
89
.fail:
Line 95... Line 90...
95
        pop     ebx
90
        pop     ebx
96
        mov     eax, 1
91
        stc
Line -... Line 92...
-
 
92
        ret
-
 
93
 
-
 
94
 
97
        ret
95
align 4
98
 
96
blit_clip:
99
 
97
 
100
align 4
98
;return code:
Line 128... Line 126...
128
 
126
 
129
        lea     edi, [esp+.sx0]
127
        lea     edi, [esp+.sx0]
Line 130... Line 128...
130
        lea     esi, [ebx+BLITTER.sc]
128
        lea     esi, [ebx+BLITTER.sc]
131
 
-
 
132
        call    block_clip
-
 
133
        test    eax, eax
129
 
Line 134... Line 130...
134
        mov     esi, 1
130
        call    block_clip
135
        jnz     .done
131
        jc      .done
136
 
132
 
137
        mov     edi, [esp+.sx0]
133
        mov     edi, [esp+.sx0]
Line 155... Line 151...
155
        mov     [esp+.dy1], eax
151
        mov     [esp+.dy1], eax
Line 156... Line 152...
156
 
152
 
157
        lea     edi, [esp+.dx0]
153
        lea     edi, [esp+.dx0]
158
        lea     esi, [ebx+BLITTER.dc]
154
        lea     esi, [ebx+BLITTER.dc]
159
        call    block_clip
-
 
160
        test    eax, eax
-
 
161
        mov     esi, 1
155
        call    block_clip
Line 162... Line 156...
162
        jnz     .done
156
        jc      .done
163
 
157
 
164
        mov     edx, [esp+.dx0]
158
        mov     edx, [esp+.dx0]
165
        mov     eax, [esp+.dx1]
159
        mov     eax, [esp+.dx1]
Line 180... Line 174...
180
        add     ecx, eax
174
        add     ecx, eax
181
        sub     ecx, [ebx+BLITTER.dst_y]
175
        sub     ecx, [ebx+BLITTER.dst_y]
182
        mov     [ebx+BLITTER.src_y], ecx
176
        mov     [ebx+BLITTER.src_y], ecx
183
        mov     [ebx+BLITTER.dst_x], edx
177
        mov     [ebx+BLITTER.dst_x], edx
184
        mov     [ebx+BLITTER.dst_y], eax
178
        mov     [ebx+BLITTER.dst_y], eax
185
        xor     esi, esi
179
        clc
186
.done:
180
.done:
187
        mov     eax, esi
-
 
188
        add     esp, 40
181
        add     esp, 40
189
        pop     ebx
182
        pop     ebx
190
        pop     esi
183
        pop     esi
191
        pop     edi
184
        pop     edi
Line 203... Line 196...
203
 
196
 
Line 204... Line 197...
204
        ret
197
        ret
205
 
198
 
206
align 4
-
 
207
blit_32:
-
 
208
 
-
 
209
.x_y        equ  72
-
 
210
.tmp_x_y    equ  76
-
 
211
 
199
align 4
212
 
200
blit_32:
213
        push    ebp
201
        push    ebp
214
        push    edi
202
        push    edi
-
 
203
        push    esi
-
 
204
        push    ebx
-
 
205
virtual at sizeof.BLITTER
-
 
206
.position       dd      ? ; (x shl 16) + y
-
 
207
; ???
-
 
208
.extra_var1     dd      ?
215
        push    esi
209
.local_vars_size = $
Line 216... Line 210...
216
        push    ebx
210
end virtual
217
        sub     esp, 80
211
        sub     esp, .local_vars_size
218
 
212
 
219
        mov     eax, [TASK_BASE]
213
        mov     eax, [TASK_BASE]
Line 252... Line 246...
252
        mov     eax, [ecx+12]
246
        mov     eax, [ecx+12]
253
        mov     [esp+BLITTER.h], eax
247
        mov     [esp+BLITTER.h], eax
Line 254... Line 248...
254
 
248
 
255
 
249
 
256
        mov     eax, [ecx+32]
250
        mov     eax, [ecx+32]
257
        mov     [esp+56], eax
251
        mov     [esp+BLITTER.bitmap], eax
Line 258... Line 252...
258
        mov     eax, [ecx+36]
252
        mov     eax, [ecx+36]
259
        mov     [esp+60], eax
253
        mov     [esp+BLITTER.stride], eax
260
 
-
 
261
        mov     ecx, esp
254
 
Line 262... Line 255...
262
        call    blit_clip
255
        mov     ecx, esp
Line 263... Line 256...
263
        test    eax, eax
256
        call    blit_clip
264
        jne     .done
257
        jc      .L57
265
 
258
 
266
        mov     eax, [TASK_BASE]
259
        mov     eax, [TASK_BASE]
Line 267... Line 260...
267
 
260
 
-
 
261
        mov     ebx, [esp+BLITTER.dst_x]
268
        mov     ebx, [esp+BLITTER.dst_x]
262
        mov     ebp, [esp+BLITTER.dst_y]
269
        mov     ebp, [esp+BLITTER.dst_y]
263
        add     ebx, [eax-twdw + WDATA.box.left]
-
 
264
        add     ebp, [eax-twdw + WDATA.box.top]
-
 
265
 
-
 
266
        mov     ecx, ebx
-
 
267
        add     ecx, [esp+BLITTER.w]
-
 
268
        shl     ecx, 16
270
        add     ebx, [eax-twdw + WDATA.box.left]
269
        mov     cx, bp
Line 271... Line 270...
271
        add     ebp, [eax-twdw + WDATA.box.top]
270
        add     ecx, [esp+BLITTER.h]
Line -... Line 271...
-
 
271
 
272
 
272
        mov     eax, ebx
-
 
273
        shl     eax, 16
273
        mov     ecx, ebx
274
        mov     ax, bp
Line 274... Line 275...
274
        shl     ecx, 16
275
        mov     [esp+.position], eax
275
        mov     cx, bp
276
 
Line 287... Line 288...
287
        imul    eax, [esp+BLITTER.stride]
288
        imul    eax, [esp+BLITTER.stride]
288
        mov     esi, [esp+BLITTER.src_x]
289
        mov     esi, [esp+BLITTER.src_x]
289
        lea     esi, [eax+esi*4]
290
        lea     esi, [eax+esi*4]
290
        add     esi, [esp+BLITTER.bitmap]
291
        add     esi, [esp+BLITTER.bitmap]
Line -... Line 292...
-
 
292
 
291
 
293
        mov     eax, ecx
292
        mov     ecx, [esp+BLITTER.h]
294
        mov     ecx, [esp+BLITTER.h]
Line 293... Line 295...
293
        mov     edx, [esp+BLITTER.w]
295
        mov     edx, [esp+BLITTER.w]
294
 
296
 
Line 295... Line 297...
295
        test    ecx, ecx    ;FIXME check clipping
297
        test    ecx, ecx    ;FIXME check clipping
296
        jz      .done
298
        jz      .L57
Line -... Line 299...
-
 
299
 
297
 
300
        test    edx, edx
Line 298... Line 301...
298
        test    edx, edx
301
        jz      .L57
Line 299... Line 302...
299
        jz      .done
302
 
-
 
303
        cmp     [_display.bits_per_pixel], 32
-
 
304
        jne     .core_24
-
 
305
 
-
 
306
        lea     edi, [edi+ebx*4]
-
 
307
 
-
 
308
        mov     ebx, [CURRENT_TASK]
-
 
309
; check for hardware cursor
-
 
310
        cmp     [_display.select_cursor], select_cursor
-
 
311
        je      .core_32.software_cursor
-
 
312
        cmp     [_display.select_cursor], 0
-
 
313
        jne     .core_32.hardware_cursor
-
 
314
;--------------------------------------
300
 
315
.core_32.software_cursor:
301
        lea     edi, [edi+ebx*4]
316
align 4
-
 
317
.outer32:
302
 
318
 
Line 303... Line 319...
303
;        xchg bx, bx
319
align 4
Line -... Line 320...
-
 
320
.inner32:
-
 
321
        cmp     [ebp], bl
-
 
322
        jne     .skip
-
 
323
;--------------------------------------
-
 
324
        mov     eax, [esi]
-
 
325
 
304
 
326
        mov     ecx, [esp+.position]
-
 
327
 
-
 
328
; check mouse area for putpixel
-
 
329
        call    [_display.check_mouse]
-
 
330
;--------------------------------------
-
 
331
; store to real LFB
-
 
332
        mov     [LFB_BASE+edi], eax
-
 
333
;--------------------------------------
-
 
334
align 4
-
 
335
.skip:
-
 
336
        add     esi, 4
-
 
337
        add     edi, 4
-
 
338
        inc     ebp
-
 
339
        add     [esp+.position], 1 shl 16
-
 
340
        dec     edx
-
 
341
        jnz     .inner32
-
 
342
 
-
 
343
        add     esi, [esp+BLITTER.stride]
-
 
344
        add     edi, [_display.lfb_pitch]
-
 
345
        add     ebp, [_display.width]
-
 
346
 
-
 
347
        mov     edx, [esp+BLITTER.w]
-
 
348
        mov     eax, edx
-
 
349
        inc     [esp+.position]
-
 
350
        sub     ebp, edx
305
        mov     ebx, [CURRENT_TASK]
351
        shl     eax, 2
-
 
352
        sub     esi, eax
-
 
353
        sub     edi, eax
-
 
354
        shl     eax, 16-2
-
 
355
        sub     [esp+.position], eax
-
 
356
        dec     [esp+BLITTER.h]
-
 
357
        jnz     .outer32
306
        mov     ecx, [esp+80]
358
        jmp     .done
-
 
359
.core_32.hardware_cursor:
-
 
360
align 4
-
 
361
.hw.outer32:
-
 
362
        xor     ecx, ecx
-
 
363
 
-
 
364
align 4
-
 
365
.hw.inner32:
-
 
366
        cmp     [ebp+ecx], bl
307
        shr     ecx, 4
367
        jne     .hw.skip
-
 
368
        mov     eax, [esi+ecx*4]
-
 
369
        mov     [LFB_BASE+edi+ecx*4], eax
-
 
370
 
-
 
371
align 4
-
 
372
.hw.skip:
-
 
373
        inc     ecx
308
        and     ecx, 3
374
        dec     edx
-
 
375
        jnz     .hw.inner32
Line 309... Line 376...
309
 
376
 
-
 
377
        add     esi, [esp+BLITTER.stride]
-
 
378
        add     edi, [_display.lfb_pitch]
-
 
379
        add     ebp, [_display.width]
310
        jmp     dword [.tbl_32+ecx*4]
380
 
311
 
381
        mov     edx, [esp+BLITTER.w]
312
align 4
382
        dec     [esp+BLITTER.h]
313
.tbl_32 dd blit_copy_32
383
        jnz     .hw.outer32
314
        dd blit_copy_32_bgr
384
 
315
        dd blit_trans_32
385
.done:
Line 316... Line 386...
316
        dd blit_trans_32_bgr
386
;        call    [draw_pointer]
317
 
387
;        call    __sys_draw_pointer
318
.done:
388
.L57:
Line 319... Line 389...
319
        add     esp, 80
389
        add     esp, .local_vars_size
-
 
390
        pop     ebx
320
        pop     ebx
391
        pop     esi
Line -... Line 392...
-
 
392
        pop     edi
321
        pop     esi
393
        pop     ebp
322
        pop     edi
-
 
323
        pop     ebp
394
        ret
324
        ret
395
 
-
 
396
.core_24:
325
 
397
        cmp     [_display.bits_per_pixel], 24
326
align 4
398
        jne     .core_16
327
blit_copy_32_bgr:
399
 
328
       mov      ebx, 1
400
        lea     ebx, [ebx+ebx*2]
329
 
401
        lea     edi, [LFB_BASE+edi+ebx]
-
 
402
        mov     ebx, [CURRENT_TASK]
330
align 4
403
 
Line -... Line 404...
-
 
404
align 4
-
 
405
.outer24:
331
blit_copy_32:
406
        mov     [esp+.extra_var1], edi
332
 
407
        xor     ecx, ecx
333
.outer32:
408
 
334
        mov     eax, [esp+.x_y]
409
align 4
335
        mov     [esp+.tmp_x_y], eax
410
.inner24:
336
        xor     ecx, ecx
411
        cmp     [ebp+ecx], bl           ; Does the process own this pixel?
337
align 4
412
        jne     .skip_1
338
.inner32:
413
;--------------------------------------
339
        cmp     [ebp+ecx], bl
414
        push    eax
-
 
415
        mov     eax, [esi+ecx*4]
340
        jne     .skip
416
 
-
 
417
        lea     edi, [edi+ecx*2]
-
 
418
 
-
 
419
; check for hardware cursor
-
 
420
        cmp     [_display.select_cursor], select_cursor
Line 341... Line 421...
341
;--------------------------------------
421
        je      @f
342
        mov     eax, [esi+ecx*4]
422
        cmp     [_display.select_cursor], 0
343
 
423
        jne     .no_mouseunder_1
344
; check for hardware cursor
-
 
345
        cmp     [_display.select_cursor], select_cursor
424
;--------------------------------------
346
        je      @f
425
align 4
347
        cmp     [_display.select_cursor], 0
426
@@:
-
 
427
        push    ecx
348
        jne     .no_mouseunder
428
 
349
;--------------------------------------
429
        mov     ecx, [esp+4]
-
 
430
        ror     ecx, 16
-
 
431
        sub     ecx, edx
350
align 4
432
        rol     ecx, 16
351
@@:
433
        sub     ecx, [esp+BLITTER.h + 8]
352
        push    ecx
434
 
353
        mov     ecx, [esp+4+.tmp_x_y]
-
 
354
 
435
; check mouse area for putpixel
355
; check mouse area for putpixel
436
        call    [_display.check_mouse]
356
        call    [_display.check_mouse]
437
        pop     ecx
Line 357... Line 438...
357
        pop     ecx
438
;--------------------------------------
-
 
439
align 4
358
 
440
.no_mouseunder_1:
359
;--------------------------------------
441
        mov     [edi+ecx], ax
360
align 4
-
 
Line 361... Line 442...
361
.no_mouseunder:
442
        shr     eax, 16
362
; store to real LFB
443
        mov     [edi+ecx+2], al
363
        mov     [LFB_BASE+edi+ecx*4], eax
444
 
364
;--------------------------------------
-
 
365
align 4
-
 
Line -... Line 445...
-
 
445
        pop     eax
Line 366... Line -...
366
.skip:
-
 
367
        add     [esp+.tmp_x_y], dword 0x10000
-
 
368
        inc     ecx
-
 
Line 369... Line 446...
369
        dec     edx
446
;--------------------------------------
-
 
447
align 4
370
        jnz     .inner32
448
.skip_1:
Line 371... Line 449...
371
 
449
        inc     ecx
372
        add     esi, [esp+BLITTER.stride]
-
 
373
        add     edi, [_display.lfb_pitch]
450
        dec     edx
374
        add     ebp, [_display.width]
451
        jnz     .inner24
Line 375... Line -...
375
        inc     dword [esp+.x_y]
-
 
376
 
452
 
377
        mov     edx, [esp+BLITTER.w]
-
 
378
        dec     [esp+BLITTER.h]
453
        add     esi, [esp+BLITTER.stride]
379
        jnz     .outer32
454
        mov     edi, [esp+.extra_var1]
380
 
455
        add     edi, [_display.lfb_pitch]
-
 
456
        add     ebp, [_display.width]
381
        jmp     blit_32.done
457
 
382
 
-
 
383
 
-
 
Line 384... Line 458...
384
align 4
458
        mov     edx, [esp+BLITTER.w]
385
blit_trans_32_bgr:
459
        dec     [esp+BLITTER.h]
386
       mov  ebx, 1
460
        jnz     .outer24
387
 
461
 
388
align 4
462
        jmp     .done
389
blit_trans_32:
463
 
390
 
-
 
391
.outer32:
464
 
392
        mov     eax, [esp+.x_y]
465
.core_16:
Line 393... Line 466...
393
        mov     [esp+.tmp_x_y], eax
466
        lea     edi, [LFB_BASE+edi+ebx*2]
-
 
467
        mov     ebx, [CURRENT_TASK]
-
 
468
 
-
 
469
  .outer16:
-
 
470
        mov     [esp+.extra_var1], edi
Line 394... Line 471...
394
        xor     ecx, ecx
471
        xor     ecx, ecx
395
 
472
 
396
align 4
473
  .inner16:
397
.inner32:
474
        cmp     [ebp+ecx], bl                   ; Does the process own this pixel?
398
 
-
 
399
        cmp     [ebp+ecx], bl
475
        jne     .skip_2
-
 
476
;--------------------------------------
-
 
477
        push    eax
-
 
478
        mov     eax, [esi+ecx*4]
-
 
479
 
-
 
480
; check for hardware cursor
400
        jne     .skip
481
        cmp     [_display.select_cursor], select_cursor
-
 
482
        je      @f
401
;--------------------------------------
483
        cmp     [_display.select_cursor], 0
-
 
484
        jne     .no_mouseunder_2
402
        mov     eax, [esi+ecx*4]
485
;--------------------------------------
403
        test    eax, 0xFF000000
-
 
404
        jz      .skip
486
  @@:
405
 
-
 
406
; check for hardware cursor
487
        push    ecx
407
        cmp     [_display.select_cursor], select_cursor
488
 
408
        je      @f
489
        mov     ecx, [esp+4]
Line 409... Line 490...
409
        cmp     [_display.select_cursor], 0
490
        ror     ecx, 16
-
 
491
        sub     ecx, edx
410
        jne     .no_mouseunder
492
        rol     ecx, 16
411
;--------------------------------------
493
        sub     ecx, [esp+BLITTER.h + 8]
412
align 4
-
 
Line 413... Line 494...
413
@@:
494
 
414
        push    ecx
495
; check mouse area for putpixel
415
 
496
        call    [_display.check_mouse]
-
 
497
        pop     ecx
-
 
498
;--------------------------------------
Line 416... Line -...
416
        mov     ecx, [esp+4+.tmp_x_y]
-