Subversion Repositories Kolibri OS

Rev

Rev 8869 | Rev 9715 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2288 clevermous 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
5363 yogev_ezra 3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
2288 clevermous 4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
6
;;  VESA20.INC                                                  ;;
7
;;                                                              ;;
8
;;  Vesa 2.0 functions for MenuetOS                             ;;
9
;;                                                              ;;
10
;;  Copyright 2002 Ville Turjanmaa                              ;;
11
;;  Alexey, kgaz@crosswindws.net                                ;;
12
;;  - Voodoo compatible graphics                                ;;
13
;;  Juan M. Caravaca                                            ;;
14
;;  - Graphics optimimizations eg. drawline                     ;;
15
;;                                                              ;;
16
;;  See file COPYING for details                                ;;
17
;;                                                              ;;
18
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
19
 
20
$Revision: 9679 $
21
 
5154 hidnplayr 22
uglobal
23
align 4
7522 dunkaist 24
        bgr_cur_line    rd MAX_SCREEN_WIDTH
25
        bgr_next_line   rd MAX_SCREEN_WIDTH
5154 hidnplayr 26
endg
2288 clevermous 27
 
5154 hidnplayr 28
iglobal
29
align 4
30
        overlapping_of_points_ptr       dd overlapping_of_points
31
endg
2288 clevermous 32
 
33
 
5154 hidnplayr 34
;-----------------------------------------------------------------------------
35
; eax = x
36
; ebx = y
2288 clevermous 37
 
5154 hidnplayr 38
align 4
39
Vesa20_getpixel16:
2288 clevermous 40
 
5154 hidnplayr 41
        ; check for hardware cursor
42
        cmp     [_display.select_cursor], select_cursor
43
        je      @f
44
        cmp     [_display.select_cursor], 0
45
        jne     .no_mouseunder
46
  @@:
47
 
48
        ; check mouse area for putpixel
49
        test    ecx, 0x04000000         ; don't load to mouseunder area
50
        jnz     .no_mouseunder
51
        call    [_display.check_m_pixel]
52
        test    ecx, ecx                ; 0xff000000
53
        jnz     @f
54
 
55
  .no_mouseunder:
56
;        imul    ebx, [BytesPerScanLine] ; ebx = y * y multiplier
57
        mov     ebx, [BPSLine_calc_area+ebx*4]
58
        lea     edi, [eax*2]            ; edi = x*2
59
        add     edi, ebx                ; edi = x*2+(y*y multiplier)
60
 
61
        movzx   ecx, word[LFB_BASE+edi]
62
        shl     ecx, 3
63
        ror     ecx, 8
64
        shl     cx, 2
65
        ror     ecx, 8
66
        shl     cl, 3
67
        rol     ecx, 16
68
  @@:
69
        and     ecx, 0x00ffffff
2288 clevermous 70
        ret
5154 hidnplayr 71
 
2430 mario79 72
;-----------------------------------------------------------------------------
5154 hidnplayr 73
; eax = x
74
; ebx = y
75
 
2430 mario79 76
align 4
2288 clevermous 77
Vesa20_getpixel24:
5154 hidnplayr 78
 
79
        ; check for hardware cursor
2451 mario79 80
        cmp     [_display.select_cursor], select_cursor
81
        je      @f
2448 mario79 82
        cmp     [_display.select_cursor], 0
83
        jne     .no_mouseunder
5154 hidnplayr 84
  @@:
85
 
86
        ; check mouse area for putpixel
87
        test    ecx, 0x04000000         ; don't load to mouseunder area
2430 mario79 88
        jnz     .no_mouseunder
89
        call    [_display.check_m_pixel]
5154 hidnplayr 90
        test    ecx, ecx                ; 0xff000000
2430 mario79 91
        jnz     @f
5154 hidnplayr 92
 
93
  .no_mouseunder:
2446 mario79 94
;        imul    ebx, [BytesPerScanLine] ; ebx = y * y multiplier
2480 mario79 95
        mov     ebx, [BPSLine_calc_area+ebx*4]
5154 hidnplayr 96
        lea     edi, [eax+eax*2]        ; edi = x*3
97
        add     edi, ebx                ; edi = x*3+(y*y multiplier)
98
 
2288 clevermous 99
        mov     ecx, [LFB_BASE+edi]
5154 hidnplayr 100
  @@:
101
        and     ecx, 0x00ffffff
2288 clevermous 102
        ret
5154 hidnplayr 103
 
2430 mario79 104
;-----------------------------------------------------------------------------
5154 hidnplayr 105
; eax = x
106
; ebx = y
107
 
2430 mario79 108
align 4
2288 clevermous 109
Vesa20_getpixel32:
5154 hidnplayr 110
 
111
        ; check for hardware cursor
2451 mario79 112
        cmp     [_display.select_cursor], select_cursor
113
        je      @f
2448 mario79 114
        cmp     [_display.select_cursor], 0
115
        jne     .no_mouseunder
5154 hidnplayr 116
  @@:
117
 
118
        ; check mouse area for putpixel
119
        test    ecx, 0x04000000         ; don't load to mouseunder area
2430 mario79 120
        jnz     .no_mouseunder
121
        call    [_display.check_m_pixel]
5154 hidnplayr 122
        test    ecx, ecx                ; 0xff000000
2430 mario79 123
        jnz     @f
5154 hidnplayr 124
 
125
  .no_mouseunder:
2446 mario79 126
;        imul    ebx, [BytesPerScanLine] ; ebx = y * y multiplier
2480 mario79 127
        mov     ebx, [BPSLine_calc_area+ebx*4]
5154 hidnplayr 128
        lea     edi, [ebx+eax*4]        ; edi = x*4+(y*y multiplier)
129
 
2288 clevermous 130
        mov     ecx, [LFB_BASE+edi]
5154 hidnplayr 131
  @@:
132
        and     ecx, 0x00ffffff
2288 clevermous 133
        ret
5154 hidnplayr 134
 
2430 mario79 135
;-----------------------------------------------------------------------------
5154 hidnplayr 136
; ebx = pointer
137
; ecx = size [x|y]
138
; edx = coordinates [x|y]
139
; ebp = pointer to 'get' function
140
; esi = pointer to 'init' function
141
; edi = parameter for 'get' function
142
 
143
align 16
144
vesa20_putimage:
145
 
2288 clevermous 146
virtual at esp
147
 putimg:
148
   .real_sx        dd ?
149
   .real_sy        dd ?
150
   .image_sx       dd ?
151
   .image_sy       dd ?
152
   .image_cx       dd ?
153
   .image_cy       dd ?
154
   .pti            dd ?
155
   .abs_cx         dd ?
156
   .abs_cy         dd ?
157
   .line_increment dd ?
158
   .winmap_newline dd ?
159
   .screen_newline dd ?
2430 mario79 160
   .real_sx_and_abs_cx dd ?
161
   .real_sy_and_abs_cy dd ?
162
   .stack_data = 4*14
2288 clevermous 163
   .edi         dd      ?
164
   .esi         dd      ?
165
   .ebp         dd      ?
166
   .esp         dd      ?
167
   .ebx         dd      ?
168
   .edx         dd      ?
169
   .ecx         dd      ?
170
   .eax         dd      ?
171
   .ret_addr    dd      ?
172
   .arg_0       dd      ?
173
end virtual
5154 hidnplayr 174
 
2288 clevermous 175
        pushad
176
        sub     esp, putimg.stack_data
177
; save pointer to image
178
        mov     [putimg.pti], ebx
179
; unpack the size
180
        mov     eax, ecx
181
        and     ecx, 0xFFFF
182
        shr     eax, 16
183
        mov     [putimg.image_sx], eax
184
        mov     [putimg.image_sy], ecx
185
; unpack the coordinates
186
        mov     eax, edx
187
        and     edx, 0xFFFF
188
        shr     eax, 16
189
        mov     [putimg.image_cx], eax
190
        mov     [putimg.image_cy], edx
191
; calculate absolute (i.e. screen) coordinates
9679 Doczom 192
        ;mov     eax, [TASK_BASE]
193
        mov     eax, [current_slot_idx]
194
        shl     eax, 5 ; sizeof.WDATA
195
        mov     ebx, [eax + window_data + WDATA.box.left]
2288 clevermous 196
        add     ebx, [putimg.image_cx]
197
        mov     [putimg.abs_cx], ebx
9679 Doczom 198
        mov     ebx, [eax +window_data + WDATA.box.top]
2288 clevermous 199
        add     ebx, [putimg.image_cy]
200
        mov     [putimg.abs_cy], ebx
201
; real_sx = MIN(wnd_sx-image_cx, image_sx);
9679 Doczom 202
        mov     ebx, [eax + window_data + WDATA.box.width]       ; ebx = wnd_sx
5154 hidnplayr 203
        inc     ebx                                     ; WDATA.box.width is one pixel less than real window x-size
2288 clevermous 204
        sub     ebx, [putimg.image_cx]
205
        ja      @f
206
        add     esp, putimg.stack_data
207
        popad
208
        ret
5154 hidnplayr 209
 
210
  @@:
2288 clevermous 211
        cmp     ebx, [putimg.image_sx]