Subversion Repositories Kolibri OS

Rev

Rev 1707 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1707 Rev 1708
Line 15... Line 15...
15
;;                                                              ;;
15
;;                                                              ;;
16
;;  See file COPYING for details                                ;;
16
;;  See file COPYING for details                                ;;
17
;;                                                              ;;
17
;;                                                              ;;
18
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
18
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 19... Line 19...
19
 
19
 
Line 20... Line 20...
20
$Revision: 1707 $
20
$Revision: 1708 $
21
 
21
 
22
 
22
 
Line 254... Line 254...
254
put_pixel:	; left for compatibility with Vesa20_putpixel32
254
put_pixel:	; left for compatibility with Vesa20_putpixel32
255
; eax = x
255
; eax = x
256
; ebx = y
256
; ebx = y
257
     imul    ebx, [BytesPerScanLine]	 ; ebx = y * y multiplier
257
     imul    ebx, [BytesPerScanLine]	 ; ebx = y * y multiplier
258
     lea     edi, [ebx+eax*4]  ; edi = x*4+(y*y multiplier)
258
     lea     edi, [ebx+eax*4]  ; edi = x*4+(y*y multiplier)
259
     mov     eax, [esp+32-8+4] ; eax = color
259
;     mov     eax, [esp+32-8+4] ; eax = color
260
     mov     [LFB_BASE+edi], eax
260
     mov     [LFB_BASE+edi], ecx
261
     ret
261
     ret
Line 262... Line 262...
262
 
262
 
Line 275... Line 275...
275
 
275
 
Line 276... Line 276...
276
; DRAWLINE
276
; DRAWLINE
277
 
277
 
278
align 4
-
 
279
__sys_draw_line:
278
align 4
Line 280... Line 279...
280
;     inc   [mouse_pause]
279
__sys_draw_line:
281
     call    [_display.disable_mouse]
280
     call    [_display.disable_mouse]
282
 
281
 
Line 304... Line 303...
304
     shr     eax, 16	   ; eax = x1
303
     shr     eax, 16	   ; eax = x1
305
     shr     ebx, 16	   ; ebx = y1
304
     shr     ebx, 16	   ; ebx = y1
306
     push    eax	   ; save x1
305
     push    eax	   ; save x1
307
     push    ebx	   ; save y1
306
     push    ebx	   ; save y1
308
     push    esi	   ; save x2
307
     push    esi	   ; save x2
-
 
308
 
309
     push    ebp	   ; save y2
309
     push    ebp	   ; save y2
310
; checking x-axis...
310
; checking x-axis...
311
     sub     esi, eax	   ; esi = x2-x1
311
     sub     esi, eax	   ; esi = x2-x1
312
     push    esi	   ; save y2-y1
312
     push    esi	   ; save y2-y1
313
     jl      .x2lx1	   ; is x2 less than x1 ?
313
     jl      .x2lx1	   ; is x2 less than x1 ?
Line 406... Line 406...
406
; ecx = color
406
; ecx = color
407
; edi = force ?
407
; edi = force ?
408
     cmp     ebx, [Screen_Max_Y]
408
     cmp     ebx, [Screen_Max_Y]
409
     jge     .out
409
     jge     .out
410
     push    eax ebp esi ebx edx
410
     push    eax ebp esi ebx edx
-
 
411
     bt      ecx, 24			; color inversion check
-
 
412
     rcl     edi,1			; forced graphics check
-
 
413
 
411
     mov     ebp, [_display.width]	; ebp = screen co-ords base
414
     mov     ebp, [_display.width]	; ebp = screen co-ords base
412
     imul    ebp, ebx
415
     imul    ebp, ebx
413
     add     ebp, [_WinMapAddress]
416
     add     ebp, [_WinMapAddress]
Line 414... Line 417...
414
 
417
 
Line 423... Line 426...
423
     cmp     edx, [Screen_Max_X]	; last check
426
     cmp     edx, [Screen_Max_X]	; last check
424
     jb      .draw
427
     jb      .draw
425
     mov     edx, [Screen_Max_X]
428
     mov     edx, [Screen_Max_X]
Line 426... Line 429...
426
 
429
 
-
 
430
.draw:	; -- the line ---
-
 
431
     jmp     dword [hline.drawtable + edi*4]	; a coolhack (C) Serge
-
 
432
 
-
 
433
align 4
427
.draw:	; -- the line ---
434
.invert_color:
428
     test    edi,1			; forced  ?
435
     mov     ecx, [ebx+eax*4]
429
     jnz    .checked
436
     xor     ecx, 0x00FFFFFF
-
 
437
     or      ecx, 0x01000000		; keep bit[24] high !
-
 
438
align 4
430
; check whether the line covered by other windows
439
.check_overlap:
431
     movzx   esi, byte [ebp+eax]
440
     movzx   esi, byte [ebp+eax]	; check whether the line covered by other windows
432
     cmp     esi, [CURRENT_TASK]
441
     cmp     esi, [CURRENT_TASK]
433
     jne     .nextpixel
-
 
434
.checked:
442
     je      .putpixel
-
 
443
     jmp     .nextpixel
435
     test    ecx,0x01000000
444
align 4
436
     jz     .noneg
445
.invert_force:
437
     mov     ecx, [ebx+eax*4]
446
     mov     ecx, [ebx+eax*4]
438
     not     ecx
447
     xor     ecx, 0x00FFFFFF
-
 
448
     or      ecx, 0x01000000		; keep bit[24] high !
439
     and     ecx, 0x01FFFFFF	; keep bit[24] high !
449
align 4
440
.noneg:
450
.putpixel:
-
 
451
     mov     [ebx+eax*4], ecx
441
     mov     [ebx+eax*4], ecx
452
align 4
442
.nextpixel:
453
.nextpixel:
443
     inc     eax
454
     inc     eax
444
     cmp     eax, edx
455
     cmp     eax, edx
-
 
456
     ja     .exit
-
 
457
     jmp     dword [hline.drawtable + edi*4]	; close the loop
445
     jle     .draw
458
 
-
 
459
.exit:
446
.exit:
460
     shr     edi, 1			; restore the 'force' bit
447
     pop     edx ebx esi ebp eax
461
     pop     edx ebx esi ebp eax
448
.out:
462
.out:
-
 
463
     ret
-
 
464
align 4
-
 
465
.drawtable:
-
 
466
dd	.check_overlap  ; general case
-
 
467
dd	.invert_color
-
 
468
dd	.putpixel	; force to draw it
-
 
469
dd	.invert_force
Line 449... Line 470...
449
     ret
470
 
450
 
471
 
451
align 4
472
align 4
452
vline:
473
vline:
Line 479... Line 500...
479
     pop     ebx        		; restore ebx = y1
500
     pop     ebx        		; restore ebx = y1
480
     cmp     edx, [Screen_Max_Y]	; the last check
501
     cmp     edx, [Screen_Max_Y]	; the last check
481
     jb     .draw
502
     jb     .draw
482
     mov     edx, [Screen_Max_Y]	; to prevent off-screen drawing
503
     mov     edx, [Screen_Max_Y]	; to prevent off-screen drawing
Line -... Line 504...
-
 
504
 
483
 
505
.draw:	  
-
 
506
     jmp     dword [vline.drawtable + edi*4]	
-
 
507
align 4
484
.draw:	  ; (vertical line itself)
508
.invert_color:
485
     test    edi,1			; forced  ?
509
     mov     ecx, [eax]
486
     jnz    .checked
510
     xor     ecx, 0x00FFFFFF
-
 
511
     or      ecx, 0x01000000		
-
 
512
align 4
487
; check whether the line covered by other windows
513
.check_overlap:
488
     movzx   esi, byte [ebp]
514
     movzx   esi, byte [ebp]
489
     cmp     esi, [CURRENT_TASK]
515
     cmp     esi, [CURRENT_TASK]
490
     jne     .nextpixel
-
 
491
.checked:
516
     je      .putpixel
-
 
517
     jmp     .nextpixel
-
 
518
 
492
     test    ecx,0x01000000
519
align 4
493
     jz     .noneg
520
.invert_force:
494
     mov     ecx, [eax]
521
     mov     ecx, [eax]
495
     not     ecx
522
     xor     ecx, 0x00FFFFFF
-
 
523
     or      ecx, 0x01000000		
496
     and     ecx, 0x01FFFFFF		; keep bit[24] high !
524
align 4
497
.noneg:
525
.putpixel:
-
 
526
     mov     [eax], ecx
498
     mov     [eax], ecx
527
align 4
499
.nextpixel:
528
.nextpixel:
500
     add     eax, [BytesPerScanLine]
529
     add     eax, [BytesPerScanLine]
501
     add     ebp, [_display.width]
530
     add     ebp, [_display.width]
502
     inc     ebx
531
     inc     ebx
503
     cmp     ebx, edx
532
     cmp     ebx, edx
-
 
533
     ja     .exit
504
     jle    .draw
534
     jmp     dword [vline.drawtable + edi*4]	
-
 
535
.exit:
505
.exit:
536
     shr     edi, 1
506
     pop     edx ebx esi ebp eax
537
     pop     edx ebx esi ebp eax
507
.out:
538
.out:
-
 
539
     ret
-
 
540
align 4
-
 
541
.drawtable:
-
 
542
dd	.check_overlap  ; general case
-
 
543
dd	.invert_color
-
 
544
dd	.putpixel	; force to draw it
Line 508... Line 545...
508
     ret
545
dd	.invert_force
Line 1020... Line 1057...
1020
	psrlw	mm1, 8
1057
        psrlw   mm1, 8
1021
	packuswb mm1, mm2
1058
        packuswb mm1, mm2
1022
	paddb	mm4, mm1
1059
        paddb   mm4, mm1
1023
	movd	eax, mm4
1060
        movd    eax, mm4
1024
	ret
1061
        ret
-
 
1062
diff16 "VESA2 code end ",0,$
-
 
1063
diff16 "VESA2 code size",get_pixel,$
-
 
1064