Subversion Repositories Kolibri OS

Rev

Rev 5565 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5565 Rev 5596
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: 5565 $
20
$Revision: 5596 $
21
 
21
 
22
uglobal
22
uglobal
23
align 4
23
align 4
Line 82... Line 82...
82
        cmp     [_display.select_cursor], 0
82
        cmp     [_display.select_cursor], 0
83
        jne     .no_mouseunder
83
        jne     .no_mouseunder
84
  @@:
84
  @@:
Line 85... Line 85...
85
 
85
 
86
        ; check mouse area for putpixel
86
        ; check mouse area for putpixel
87
        test    ecx, 0x04000000  ; don't load to mouseunder area
87
        test    ecx, 0x04000000         ; don't load to mouseunder area
88
        jnz     .no_mouseunder
88
        jnz     .no_mouseunder
89
        call    [_display.check_m_pixel]
89
        call    [_display.check_m_pixel]
90
        test    ecx, ecx                ; 0xff000000
90
        test    ecx, ecx                ; 0xff000000
Line 91... Line 91...
91
        jnz     @f
91
        jnz     @f
92
 
92
 
93
  .no_mouseunder:
93
  .no_mouseunder:
94
;        imul    ebx, [BytesPerScanLine] ; ebx = y * y multiplier
94
;        imul    ebx, [BytesPerScanLine] ; ebx = y * y multiplier
95
        mov     ebx, [BPSLine_calc_area+ebx*4]
95
        mov     ebx, [BPSLine_calc_area+ebx*4]
Line 96... Line 96...
96
        lea     edi, [eax+eax*2]        ; edi = x*3
96
        lea     edi, [eax+eax*2]        ; edi = x*3
97
        add     edi, ebx      ; edi = x*3+(y*y multiplier)
97
        add     edi, ebx                ; edi = x*3+(y*y multiplier)
98
 
98
 
99
        mov     ecx, [LFB_BASE+edi]
99
        mov     ecx, [LFB_BASE+edi]
Line 114... Line 114...
114
        cmp     [_display.select_cursor], 0
114
        cmp     [_display.select_cursor], 0
115
        jne     .no_mouseunder
115
        jne     .no_mouseunder
116
  @@:
116
  @@:
Line 117... Line 117...
117
 
117
 
118
        ; check mouse area for putpixel
118
        ; check mouse area for putpixel
119
        test    ecx, 0x04000000  ; don't load to mouseunder area
119
        test    ecx, 0x04000000         ; don't load to mouseunder area
120
        jnz     .no_mouseunder
120
        jnz     .no_mouseunder
121
        call    [_display.check_m_pixel]
121
        call    [_display.check_m_pixel]
122
        test    ecx, ecx                ; 0xff000000
122
        test    ecx, ecx                ; 0xff000000
Line 877... Line 877...
877
        pushad
877
        pushad
878
        cmp     eax, [_display.width]
878
        cmp     eax, [_display.width]
879
        jge     .exit
879
        jge     .exit
880
        cmp     ebx, [_display.height]
880
        cmp     ebx, [_display.height]
881
        jge     .exit
881
        jge     .exit
882
        test    edi, 1           ; force ?
882
        test    edi, 1          ; force ?
883
        jnz     .forced
883
        jnz     .forced
Line 884... Line 884...
884
 
884
 
885
; not forced
885
; not forced
886
        mov     edx, [d_width_calc_area + ebx*4]
886
        mov     edx, [d_width_calc_area + ebx*4]
Line 1173... Line 1173...
1173
dl_dx equ esp+4
1173
dl_dx equ esp+4
1174
dl_dy equ esp+0
1174
dl_dy equ esp+0
Line 1175... Line 1175...
1175
 
1175
 
Line 1176... Line 1176...
1176
        pusha
1176
        pusha
1177
 
1177
 
1178
        xor     edx, edx   ; clear edx
1178
        xor     edx, edx        ; clear edx
1179
        xor     esi, esi   ; unpack arguments
1179
        xor     esi, esi        ; unpack arguments
1180
        xor     ebp, ebp
1180
        xor     ebp, ebp
1181
        mov     si, ax     ; esi = x2
1181
        mov     si, ax          ; esi = x2
1182
        mov     bp, bx     ; ebp = y2
1182
        mov     bp, bx          ; ebp = y2
1183
        shr     eax, 16    ; eax = x1
1183
        shr     eax, 16         ; eax = x1
1184
        shr     ebx, 16    ; ebx = y1
1184
        shr     ebx, 16         ; ebx = y1
1185
        push    eax        ; save x1
1185
        push    eax             ; save x1
1186
        push    ebx        ; save y1
1186
        push    ebx             ; save y1
1187
        push    esi        ; save x2
1187
        push    esi             ; save x2
1188
        push    ebp        ; save y2
1188
        push    ebp             ; save y2
1189
; checking x-axis...
1189
; checking x-axis...
1190
        sub     esi, eax   ; esi = x2-x1
1190
        sub     esi, eax        ; esi = x2-x1
1191
        push    esi        ; save y2-y1
1191
        push    esi             ; save y2-y1
1192
        jl      .x2lx1     ; is x2 less than x1 ?
1192
        jl      .x2lx1          ; is x2 less than x1 ?
1193
        jg      .no_vline  ; x1 > x2 ?
1193
        jg      .no_vline       ; x1 > x2 ?
1194
        mov     edx, ebp   ; else (if x1=x2)
1194
        mov     edx, ebp        ; else (if x1=x2)
1195
        call    vline
1195
        call    vline
Line 1196... Line 1196...
1196
        push    edx ; necessary to rightly restore stack frame at .exit
1196
        push    edx             ; necessary to rightly restore stack frame at .exit
1197
        jmp     .exit
1197
        jmp     .exit
Line 1198... Line 1198...
1198
 
1198
 
1199
  .x2lx1:
1199
  .x2lx1:
1200
        neg     esi         ; get esi absolute value
1200
        neg     esi             ; get esi absolute value
1201
 
1201
 
1202
  .no_vline:
1202
  .no_vline:
1203
; checking y-axis...
1203
; checking y-axis...
1204
        sub     ebp, ebx    ; ebp = y2-y1
1204
        sub     ebp, ebx        ; ebp = y2-y1
1205
        push    ebp         ; save y2-y1
1205
        push    ebp             ; save y2-y1
1206
        jl      .y2ly1      ; is y2 less than y1 ?
1206
        jl      .y2ly1          ; is y2 less than y1 ?
Line 1207... Line 1207...
1207
        jg      .no_hline   ; y1 > y2 ?
1207
        jg      .no_hline       ; y1 > y2 ?
1208
        mov     edx, [dl_x2]    ; else (if y1=y2)
1208
        mov     edx, [dl_x2]    ; else (if y1=y2)
Line 1209... Line 1209...
1209
        call    hline
1209
        call    hline
1210
        jmp     .exit
1210
        jmp     .exit
1211
 
1211
 
1212
  .y2ly1:
1212
  .y2ly1:
1213
        neg     ebp         ; get ebp absolute value
1213
        neg     ebp             ; get ebp absolute value
1214
 
1214
 
1215
  .no_hline:
1215
  .no_hline:
1216
        cmp     ebp, esi
1216
        cmp     ebp, esi
Line 1225... Line 1225...
1225
        mov     [dl_y2], ebx
1225
        mov     [dl_y2], ebx
1226
        mov     [dl_y1], edx
1226
        mov     [dl_y1], edx
Line 1227... Line 1227...
1227
 
1227
 
1228
  .no_reverse1:
1228
  .no_reverse1:
1229
        mov     eax, [dl_dx]
1229
        mov     eax, [dl_dx]
1230
        cdq                 ; extend eax sing to edx
1230
        cdq                     ; extend eax sing to edx
1231
        shl     eax, 16     ; using 16bit fix-point maths
1231
        shl     eax, 16         ; using 16bit fix-point maths
Line 1232... Line 1232...
1232
        idiv    ebp         ; eax = ((x2-x1)*65536)/(y2-y1)
1232
        idiv    ebp             ; eax = ((x2-x1)*65536)/(y2-y1)
1233
 
1233
 
1234
; correction for the remainder of the division
1234
; correction for the remainder of the division
1235
        shl     edx, 1
1235
        shl     edx, 1
1236
        cmp     ebp, edx
1236
        cmp     ebp, edx
1237
        jb      @f
1237
        jb      @f
1238
        inc     eax
1238
        inc     eax
1239
  @@:
1239
  @@:
1240
        mov     edx, ebp    ; edx = counter (number of pixels to draw)
1240
        mov     edx, ebp        ; edx = counter (number of pixels to draw)
1241
        mov     ebp, 1 shl 16   ; ebp = dy = 1.0
1241
        mov     ebp, 1 shl 16   ; ebp = dy = 1.0
1242
        mov     esi, eax    ; esi = dx
1242
        mov     esi, eax        ; esi = dx
1243
        jmp     .y_rules
1243
        jmp     .y_rules
1244
  .x_rules:
1244
  .x_rules:
1245
        cmp     [dl_x2], eax ; make sure x1 is at the begining
1245
        cmp     [dl_x2], eax    ; make sure x1 is at the begining
1246
        jge     .no_reverse2
1246
        jge     .no_reverse2
1247
        neg     dword [dl_dy]
1247
        neg     dword [dl_dy]
1248
        mov     edx, [dl_x2]
1248
        mov     edx, [dl_x2]
Line 1252... Line 1252...
1252
        mov     [dl_y2], ebx
1252
        mov     [dl_y2], ebx
1253
        mov     [dl_y1], edx
1253
        mov     [dl_y1], edx
1254
  .no_reverse2:
1254
  .no_reverse2:
1255
        xor     edx, edx
1255
        xor     edx, edx
1256
        mov     eax, [dl_dy]
1256
        mov     eax, [dl_dy]
1257
        cdq                 ; extend eax sing to edx
1257
        cdq                     ; extend eax sing to edx
1258
        shl     eax, 16     ; using 16bit fix-point maths
1258
        shl     eax, 16         ; using 16bit fix-point maths
1259
        idiv    esi         ; eax = ((y2-y1)*65536)/(x2-x1)
1259
        idiv    esi             ; eax = ((y2-y1)*65536)/(x2-x1)
1260
; correction for the remainder of the division
1260
; correction for the remainder of the division
1261
        shl     edx, 1
1261
        shl     edx, 1
1262
        cmp     esi, edx
1262
        cmp     esi, edx
1263
        jb      @f
1263
        jb      @f
1264
        inc     eax
1264
        inc     eax
1265
  @@:
1265
  @@:
1266
        mov     edx, esi    ; edx = counter (number of pixels to draw)
1266
        mov     edx, esi        ; edx = counter (number of pixels to draw)
1267
        mov     esi, 1 shl 16   ; esi = dx = 1.0
1267
        mov     esi, 1 shl 16   ; esi = dx = 1.0
1268
        mov     ebp, eax    ; ebp = dy
1268
        mov     ebp, eax        ; ebp = dy
Line 1269... Line 1269...
1269
 
1269
 
1270
  .y_rules:
1270
  .y_rules:
1271
        mov     eax, [dl_x1]
1271
        mov     eax, [dl_x1]
1272
        mov     ebx, [dl_y1]
1272
        mov     ebx, [dl_y1]
Line 2013... Line 2013...
2013
; External loop for all y from start to end
2013
; External loop for all y from start to end
2014
        mov     ebx, [draw_data+32+RECT.top]    ; y start
2014
        mov     ebx, [draw_data+32+RECT.top]    ; y start
2015
  dp2:
2015
  dp2:
2016
        mov     ebp, [draw_data+32+RECT.left]   ; x start
2016
        mov     ebp, [draw_data+32+RECT.left]   ; x start
2017
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
2017
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
2018
;                       and LFB data (output for our function) [edi]
2018
;    and LFB data (output for our function) [edi]
2019
;        mov     eax, [BytesPerScanLine]
2019
;        mov     eax, [BytesPerScanLine]
2020
;        mul     ebx
2020
;        mul     ebx
2021
        mov     eax, [BPSLine_calc_area+ebx*4]
2021
        mov     eax, [BPSLine_calc_area+ebx*4]
2022
        xchg    ebp, eax
2022
        xchg    ebp, eax
2023
        add     ebp, eax
2023
        add     ebp, eax