Subversion Repositories Kolibri OS

Rev

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

Rev 4507 Rev 5154
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2014. 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: 4507 $
8
$Revision: 5154 $
9
 
9
 
10
 
10
 
Line 578... Line 578...
578
        pop     ebx
578
        pop     ebx
579
        ret
579
        ret
580
endp
580
endp
581
;------------------------------------------------------------------------------
581
;------------------------------------------------------------------------------
582
align 4
582
align 4
-
 
583
proc restore_16 stdcall, x:dword, y:dword
-
 
584
 
-
 
585
        push    ebx
-
 
586
 
-
 
587
        mov     ebx, [cur_saved_base]
-
 
588
        mov     edx, [cur.h]
-
 
589
        test    edx, edx
-
 
590
        jz      .ret
-
 
591
 
-
 
592
        push    esi
-
 
593
        push    edi
-
 
594
 
-
 
595
        mov     esi, cur_saved_data
-
 
596
;--------------------------------------
-
 
597
align 4
-
 
598
@@:
-
 
599
        mov     edi, ebx
-
 
600
        add     ebx, [_display.pitch]
-
 
601
 
-
 
602
        mov     ecx, [cur.w]
-
 
603
        rep movsw
-
 
604
        dec     edx
-
 
605
        jnz     @B
-
 
606
 
-
 
607
        pop     edi
-
 
608
;--------------------------------------
-
 
609
align 4
-
 
610
.ret:
-
 
611
        pop     esi
-
 
612
        pop     ebx
-
 
613
        ret
-
 
614
endp
-
 
615
;------------------------------------------------------------------------------
-
 
616
align 4
583
proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
617
proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
584
           locals
618
           locals
585
             h      dd ?
619
             h      dd ?
586
             _dx     dd ?
620
             _dx     dd ?
587
             _dy     dd ?
621
             _dy     dd ?
Line 813... Line 847...
813
        jnz     .row
847
        jnz     .row
814
        ret
848
        ret
815
endp
849
endp
816
;------------------------------------------------------------------------------
850
;------------------------------------------------------------------------------
817
align 4
851
align 4
-
 
852
proc move_cursor_16 stdcall, hcursor:dword, x:dword, y:dword
-
 
853
           locals
-
 
854
             h      dd ?
-
 
855
             _dx     dd ?
-
 
856
             _dy     dd ?
-
 
857
           endl
-
 
858
 
-
 
859
        mov     esi, [hcursor]
-
 
860
        mov     ecx, [x]
-
 
861
        mov     eax, [y]
-
 
862
 
-
 
863
        xor     edx, edx
-
 
864
        sub     ecx, [esi+CURSOR.hot_x]
-
 
865
        lea     ebx, [ecx+32-1]
-
 
866
        mov     [x], ecx
-
 
867
        sets    dl
-
 
868
        dec     edx
-
 
869
        and     ecx, edx      ;clip x to 0<=x
-
 
870
        mov     [cur.left], ecx
-
 
871
        mov     edi, ecx
-
 
872
        sub     edi, [x]
-
 
873
        mov     [_dx], edi
-
 
874
 
-
 
875
        xor     edx, edx
-
 
876
        sub     eax, [esi+CURSOR.hot_y]
-
 
877
        lea     edi, [eax+32-1]
-
 
878
        mov     [y], eax
-
 
879
        sets    dl
-
 
880
        dec     edx
-
 
881
        and     eax, edx      ;clip y to 0<=y
-
 
882
        mov     [cur.top], eax
-
 
883
        mov     edx, eax
-
 
884
        sub     edx, [y]
-
 
885
        mov     [_dy], edx
-
 
886
 
-
 
887
;        mul     dword [BytesPerScanLine]
-
 
888
        mov     eax, [BPSLine_calc_area+eax*4]
-
 
889
        lea     edx, [LFB_BASE+eax+ecx*2]
-
 
890
        mov     [cur_saved_base], edx
-
 
891
 
-
 
892
        cmp     ebx, [Screen_Max_X]
-
 
893
        jbe     @F
-
 
894
        mov     ebx, [Screen_Max_X]
-
 
895
;--------------------------------------
-
 
896
align 4
-
 
897
@@:
-
 
898
        cmp     edi, [Screen_Max_Y]
-
 
899
        jbe     @F
-
 
900
        mov     edi, [Screen_Max_Y]
-
 
901
;--------------------------------------
-
 
902
align 4
-
 
903
@@:
-
 
904
        mov     [cur.right], ebx
-
 
905
        mov     [cur.bottom], edi
-
 
906
 
-
 
907
        sub     ebx, [x]
-
 
908
        sub     edi, [y]
-
 
909
        inc     ebx
-
 
910
        inc     edi
-
 
911
        sub     ebx, [_dx]
-
 
912
        sub     edi, [_dy]
-
 
913
 
-
 
914
        mov     [cur.w], ebx
-
 
915
        mov     [cur.h], edi
-
 
916
        mov     [h], edi
-
 
917
 
-
 
918
        mov     eax, edi
-
 
919
        mov     edi, cur_saved_data
-
 
920
;--------------------------------------
-
 
921
align 4
-
 
922
@@:
-
 
923
        mov     esi, edx
-
 
924
        add     edx, [_display.pitch]
-
 
925
        mov     ecx, [cur.w]
-
 
926
 
-
 
927
        rep movsw
-
 
928
        dec     eax
-
 
929
        jnz     @B
-
 
930
 
-
 
931
;draw cursor
-
 
932
        mov     ebx, [cur_saved_base]
-
 
933
        mov     eax, [_dy]
-
 
934
        shl     eax, 5
-
 
935
        add     eax, [_dx]
-
 
936
 
-
 
937
        mov     esi, [hcursor]
-
 
938
        mov     esi, [esi+CURSOR.base]
-
 
939
        lea     edx, [esi+eax*4]
-
 
940
;--------------------------------------
-
 
941
align 4
-
 
942
.row:
-
 
943
        mov     ecx, [cur.w]
-
 
944
        mov     esi, edx
-
 
945
        mov     edi, ebx
-
 
946
        add     edx, 32*4
-
 
947
        add     ebx, [_display.pitch]
-
 
948
;--------------------------------------
-
 
949
align 4
-
 
950
.pix:
-
 
951
        lodsd
-
 
952
        test    eax, 0xFF000000
-
 
953
        jz      @F
-
 
954
; convert to 16 bpp and store to real LFB
-
 
955
        and     eax, 00000000111110001111110011111000b
-
 
956
        shr     ah, 2
-
 
957
        shr     ax, 3
-
 
958
        ror     eax, 8
-
 
959
        add     al, ah
-
 
960
        rol     eax, 8
-
 
961
        mov     [edi], ax
-
 
962
;--------------------------------------
-
 
963
align 4
-
 
964
@@:
-
 
965
        add     edi, 2
-
 
966
        dec     ecx
-
 
967
        jnz     .pix
-
 
968
 
-
 
969
        dec     [h]
-
 
970
        jnz     .row
-
 
971
        ret
-
 
972
endp
-
 
973
;------------------------------------------------------------------------------
-
 
974
align 4
818
check_mouse_area_for_getpixel_new:
975
check_mouse_area_for_getpixel_new:
819
; in:
976
; in:
820
; eax = x
977
; eax = x
821
; ebx = y
978
; ebx = y
822
; out:
979
; out:
Line 848... Line 1005...
848
; eax = offset x
1005
; eax = offset x
849
        imul    ebx, [cur.w]     ;y
1006
        imul    ebx, [cur.w]     ;y
850
        add     eax, ebx
1007
        add     eax, ebx
851
        mov     ebx, eax
1008
        mov     ebx, eax
852
        shl     eax, 2
1009
        shl     eax, 2
853
        cmp     byte [_display.bpp], 32
1010
        cmp     byte [_display.bits_per_pixel], 32
-
 
1011
        je      @f
-
 
1012
        sub     eax, ebx
-
 
1013
        cmp     byte [_display.bits_per_pixel], 24
854
        je      @f
1014
        je      @f
855
        sub     eax, ebx
1015
        sub     eax, ebx
856
;--------------------------------------
1016
;--------------------------------------
857
align 4
1017
align 4
858
@@:
1018
@@:
Line 923... Line 1083...
923
        push    ebx ecx
1083
        push    ebx ecx
924
        imul    ecx, [cur.w]    ;y
1084
        imul    ecx, [cur.w]    ;y
925
        add     ecx, ebx
1085
        add     ecx, ebx
926
        mov     ebx, ecx
1086
        mov     ebx, ecx
927
        shl     ecx, 2
1087
        shl     ecx, 2
-
 
1088
        cmp     byte [_display.bits_per_pixel], 16
-
 
1089
        je      .16
928
        cmp     byte [_display.bpp], 24
1090
        cmp     byte [_display.bits_per_pixel], 24
929
        je      .24
1091
        je      .24
930
        and     eax, 0xFFFFFF
1092
        and     eax, 0xFFFFFF
931
        mov     [ecx + cur_saved_data], eax   ;store new color  to
1093
        mov     [ecx + cur_saved_data], eax   ;store new color  to
932
        jmp     @f
1094
        jmp     @f
933
;--------------------------------------
1095
;--------------------------------------
934
align 4
1096
align 4
-
 
1097
.16:
-
 
1098
        sub     ecx, ebx
-
 
1099
        sub     ecx, ebx
-
 
1100
; convert to 16 bpp and store to real LFB
-
 
1101
        and     eax, 00000000111110001111110011111000b
-
 
1102
        shr     ah, 2
-
 
1103
        shr     ax, 3
-
 
1104
        ror     eax, 8
-
 
1105
        add     al, ah
-
 
1106
        rol     eax, 8
-
 
1107
        mov     [ecx + cur_saved_data], ax      ;store new color  to
-
 
1108
        jmp     @f
-
 
1109
;--------------------------------------
-
 
1110
align 4
935
.24:
1111
.24:
936
        sub     ecx, ebx
1112
        sub     ecx, ebx
937
        mov     [ecx + cur_saved_data], ax      ;store new color  to
1113
        mov     [ecx + cur_saved_data], ax      ;store new color  to
938
        shr     eax, 16
1114
        shr     eax, 16
939
        mov     [ecx + cur_saved_data + 2], al  ;store new color  to
1115
        mov     [ecx + cur_saved_data + 2], al  ;store new color  to
Line 997... Line 1173...
997
        jz      .fail
1173
        jz      .fail
Line 998... Line 1174...
998
 
1174
 
999
        mov     ebx, restore_32
1175
        mov     ebx, restore_32
1000
        mov     ecx, move_cursor_32
1176
        mov     ecx, move_cursor_32
1001
        mov     edx, Vesa20_putpixel32_new
1177
        mov     edx, Vesa20_putpixel32_new
1002
        mov     eax, [_display.bpp]
1178
        mov     eax, [_display.bits_per_pixel]
1003
        cmp     al, 32
1179
        cmp     al, 32
Line 1004... Line 1180...
1004
        jne     .24
1180
        jne     .not_32bpp
1005
 
1181
 
1006
.set:
1182
.set:
1007
        mov     [_display.select_cursor], select_cursor
1183
        mov     [_display.select_cursor], select_cursor
Line 1018... Line 1194...
1018
        mov     [def_cursor_clock], eax
1194
        mov     [def_cursor_clock], eax
1019
        stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
1195
        stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
1020
        mov     [def_cursor], eax
1196
        mov     [def_cursor], eax
1021
        ret
1197
        ret
Line 1022... Line 1198...
1022
 
1198
 
-
 
1199
.not_32bpp:
-
 
1200
        cmp     al, 24
-
 
1201
        jne     .not_24bpp
1023
.24:
1202
 
1024
        mov     ebx, restore_24
1203
        mov     ebx, restore_24
1025
        mov     ecx, move_cursor_24
1204
        mov     ecx, move_cursor_24
-
 
1205
        mov     edx, Vesa20_putpixel24_new
-
 
1206
        jmp     .set
-
 
1207
 
1026
        mov     edx, Vesa20_putpixel24_new
1208
.not_24bpp:
-
 
1209
        cmp     al, 16
-
 
1210
        jne     .not_16bpp
-
 
1211
        mov     ebx, restore_16
-
 
1212
        mov     ecx, move_cursor_16
1027
        cmp     al, 24
1213
        mov     edx, Vesa20_putpixel16_new
-
 
1214
        jmp     .set
-
 
1215
 
-
 
1216
.not_16bpp:
-
 
1217
;        cmp     al, 15
-
 
1218
;        jne     .fail
-
 
1219
;        mov     ebx, restore_15
-
 
1220
;        mov     ecx, move_cursor_15
-
 
1221
;        mov     edx, Vesa20_putpixel15_new
Line 1028... Line 1222...
1028
        je      .set
1222
;        jmp     .set
1029
 
1223
 
1030
.fail:
1224
.fail:
1031
        xor     eax, eax
1225
        xor     eax, eax