Rev 5351 | Rev 6790 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5351 | Rev 5363 | ||
---|---|---|---|
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2011-2014. 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 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
7 | 7 | ||
8 | $Revision: 5351 $ |
8 | $Revision: 5363 $ |
9 | 9 | ||
10 | 10 | ||
11 | struct BLITTER_BLOCK |
11 | struct BLITTER_BLOCK |
12 | xmin dd ? |
12 | xmin dd ? |
13 | ymin dd ? |
13 | ymin dd ? |
14 | xmax dd ? |
14 | xmax dd ? |
15 | ymax dd ? |
15 | ymax dd ? |
16 | ends |
16 | ends |
17 | 17 | ||
18 | 18 | ||
19 | struct BLITTER |
19 | struct BLITTER |
20 | dc RECT |
20 | dc RECT |
21 | sc RECT |
21 | sc RECT |
22 | dst_x dd ? ; 32 |
22 | dst_x dd ? ; 32 |
23 | dst_y dd ? ; 36 |
23 | dst_y dd ? ; 36 |
24 | src_x dd ? ; 40 |
24 | src_x dd ? ; 40 |
25 | src_y dd ? ; 44 |
25 | src_y dd ? ; 44 |
26 | w dd ? ; 48 |
26 | w dd ? ; 48 |
27 | h dd ? ; 52 |
27 | h dd ? ; 52 |
28 | 28 | ||
29 | bitmap dd ? ; 56 |
29 | bitmap dd ? ; 56 |
30 | stride dd ? ; 60 |
30 | stride dd ? ; 60 |
31 | ends |
31 | ends |
32 | 32 | ||
33 | 33 | ||
34 | 34 | ||
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 | ;CF= 0 - draw, 1 - don't draw |
40 | ;CF= 0 - draw, 1 - don't draw |
41 | 41 | ||
42 | push ebx |
42 | push ebx |
43 | 43 | ||
44 | mov eax, [edi+RECT.left] |
44 | mov eax, [edi+RECT.left] |
45 | mov ebx, [edi+RECT.right] |
45 | mov ebx, [edi+RECT.right] |
46 | mov ecx, [esi+RECT.left] ;clip.left |
46 | mov ecx, [esi+RECT.left] ;clip.left |
47 | mov edx, [esi+RECT.right] ;clip.right |
47 | mov edx, [esi+RECT.right] ;clip.right |
48 | 48 | ||
49 | cmp eax, edx ;left >= clip.right |
49 | cmp eax, edx ;left >= clip.right |
50 | jge .fail |
50 | jge .fail |
51 | 51 | ||
52 | cmp ebx, ecx ;right < clip.left |
52 | cmp ebx, ecx ;right < clip.left |
53 | jl .fail |
53 | jl .fail |
54 | 54 | ||
55 | cmp eax, ecx ;left >= clip.left |
55 | cmp eax, ecx ;left >= clip.left |
56 | jge @F |
56 | jge @F |
57 | 57 | ||
58 | mov [edi+RECT.left], ecx |
58 | mov [edi+RECT.left], ecx |
59 | @@: |
59 | @@: |
60 | cmp ebx, edx ;right <= clip.right |
60 | cmp ebx, edx ;right <= clip.right |
61 | jle @f |
61 | jle @f |
62 | 62 | ||
63 | mov [edi+RECT.right], edx |
63 | mov [edi+RECT.right], edx |
64 | @@: |
64 | @@: |
65 | mov eax, [edi+RECT.top] |
65 | mov eax, [edi+RECT.top] |
66 | mov ebx, [edi+RECT.bottom] |
66 | mov ebx, [edi+RECT.bottom] |
67 | mov ecx, [esi+RECT.top] ;clip.top |
67 | mov ecx, [esi+RECT.top] ;clip.top |
68 | mov edx, [esi+RECT.bottom] ;clip.bottom |
68 | mov edx, [esi+RECT.bottom] ;clip.bottom |
69 | 69 | ||
70 | cmp eax, edx ;top >= clip.bottom |
70 | cmp eax, edx ;top >= clip.bottom |
71 | jge .fail |
71 | jge .fail |
72 | 72 | ||
73 | cmp ebx, ecx ;bottom < clip.top |
73 | cmp ebx, ecx ;bottom < clip.top |
74 | jl .fail |
74 | jl .fail |
75 | 75 | ||
76 | cmp eax, ecx ;top >= clip.top |
76 | cmp eax, ecx ;top >= clip.top |
77 | jge @F |
77 | jge @F |
78 | 78 | ||
79 | mov [edi+RECT.top], ecx |
79 | mov [edi+RECT.top], ecx |
80 | @@: |
80 | @@: |
81 | cmp ebx, edx ;bottom <= clip.bottom |
81 | cmp ebx, edx ;bottom <= clip.bottom |
82 | jle @f |
82 | jle @f |
83 | 83 | ||
84 | mov [edi+RECT.bottom], edx |
84 | mov [edi+RECT.bottom], edx |
85 | @@: |
85 | @@: |
86 | pop ebx |
86 | pop ebx |
87 | clc |
87 | clc |
88 | ret |
88 | ret |
89 | .fail: |
89 | .fail: |
90 | pop ebx |
90 | pop ebx |
91 | stc |
91 | stc |
92 | ret |
92 | ret |
93 | 93 | ||
94 | 94 | ||
95 | align 4 |
95 | align 4 |
96 | blit_clip: |
96 | blit_clip: |
97 | 97 | ||
98 | ;return code: |
98 | ;return code: |
99 | ;CF= 0 - draw, 1 - don't draw |
99 | ;CF= 0 - draw, 1 - don't draw |
100 | 100 | ||
101 | .sx0 equ 8 |
101 | .sx0 equ 8 |
102 | .sy0 equ 12 |
102 | .sy0 equ 12 |
103 | .sx1 equ 16 |
103 | .sx1 equ 16 |
104 | .sy1 equ 20 |
104 | .sy1 equ 20 |
105 | 105 | ||
106 | .dx0 equ 24 |
106 | .dx0 equ 24 |
107 | .dy0 equ 28 |
107 | .dy0 equ 28 |
108 | .dx1 equ 32 |
108 | .dx1 equ 32 |
109 | .dy1 equ 36 |
109 | .dy1 equ 36 |
110 | 110 | ||
111 | 111 | ||
112 | push edi |
112 | push edi |
113 | push esi |
113 | push esi |
114 | push ebx |
114 | push ebx |
115 | sub esp, 40 |
115 | sub esp, 40 |
116 | 116 | ||
117 | mov ebx, ecx |
117 | mov ebx, ecx |
118 | mov edx, [ecx+BLITTER.src_x] |
118 | mov edx, [ecx+BLITTER.src_x] |
119 | mov [esp+.sx0], edx |
119 | mov [esp+.sx0], edx |
120 | mov eax, [ecx+BLITTER.src_y] |
120 | mov eax, [ecx+BLITTER.src_y] |
121 | mov [esp+.sy0], eax |
121 | mov [esp+.sy0], eax |
122 | add edx, [ecx+BLITTER.w] |
122 | add edx, [ecx+BLITTER.w] |
123 | add eax, [ecx+BLITTER.h] |
123 | add eax, [ecx+BLITTER.h] |
124 | mov [esp+.sx1], edx |
124 | mov [esp+.sx1], edx |
125 | mov [esp+.sy1], eax |
125 | mov [esp+.sy1], eax |
126 | 126 | ||
127 | lea edi, [esp+.sx0] |
127 | lea edi, [esp+.sx0] |
128 | lea esi, [ebx+BLITTER.sc] |
128 | lea esi, [ebx+BLITTER.sc] |
129 | 129 | ||
130 | call block_clip |
130 | call block_clip |
131 | jc .done |
131 | jc .done |
132 | 132 | ||
133 | mov edi, [esp+.sx0] |
133 | mov edi, [esp+.sx0] |
134 | mov edx, [ebx+BLITTER.dst_x] |
134 | mov edx, [ebx+BLITTER.dst_x] |
135 | add edx, edi |
135 | add edx, edi |
136 | sub edx, [ebx+BLITTER.src_x] |
136 | sub edx, [ebx+BLITTER.src_x] |
137 | mov [esp+.dx0], edx |
137 | mov [esp+.dx0], edx |
138 | 138 | ||
139 | mov ecx, [esp+.sy0] |
139 | mov ecx, [esp+.sy0] |
140 | mov eax, [ebx+BLITTER.dst_y] |
140 | mov eax, [ebx+BLITTER.dst_y] |
141 | add eax, ecx |
141 | add eax, ecx |
142 | sub eax, [ebx+BLITTER.src_y] |
142 | sub eax, [ebx+BLITTER.src_y] |
143 | mov [esp+.dy0], eax |
143 | mov [esp+.dy0], eax |
144 | 144 | ||
145 | sub edx, edi |
145 | sub edx, edi |
146 | add edx, [esp+.sx1] |
146 | add edx, [esp+.sx1] |
147 | mov [esp+.dx1], edx |
147 | mov [esp+.dx1], edx |
148 | 148 | ||
149 | sub eax, ecx |
149 | sub eax, ecx |
150 | add eax, [esp+.sy1] |
150 | add eax, [esp+.sy1] |
151 | mov [esp+.dy1], eax |
151 | mov [esp+.dy1], eax |
152 | 152 | ||
153 | lea edi, [esp+.dx0] |
153 | lea edi, [esp+.dx0] |
154 | lea esi, [ebx+BLITTER.dc] |
154 | lea esi, [ebx+BLITTER.dc] |
155 | call block_clip |
155 | call block_clip |
156 | jc .done |
156 | jc .done |
157 | 157 | ||
158 | mov edx, [esp+.dx0] |
158 | mov edx, [esp+.dx0] |
159 | mov eax, [esp+.dx1] |
159 | mov eax, [esp+.dx1] |
160 | sub eax, edx |
160 | sub eax, edx |
161 | mov [ebx+BLITTER.w], eax |
161 | mov [ebx+BLITTER.w], eax |
162 | 162 | ||
163 | mov eax, [esp+.dy0] |
163 | mov eax, [esp+.dy0] |
164 | mov ecx, [esp+.dy1] |
164 | mov ecx, [esp+.dy1] |
165 | sub ecx, eax |
165 | sub ecx, eax |
166 | mov [ebx+BLITTER.h], ecx |
166 | mov [ebx+BLITTER.h], ecx |
167 | 167 | ||
168 | mov ecx, [ebx+BLITTER.src_x] |
168 | mov ecx, [ebx+BLITTER.src_x] |
169 | add ecx, edx |
169 | add ecx, edx |
170 | sub ecx, [ebx+BLITTER.dst_x] |
170 | sub ecx, [ebx+BLITTER.dst_x] |
171 | mov [ebx+BLITTER.src_x], ecx |
171 | mov [ebx+BLITTER.src_x], ecx |
172 | 172 | ||
173 | mov ecx, [ebx+BLITTER.src_y] |
173 | mov ecx, [ebx+BLITTER.src_y] |
174 | add ecx, eax |
174 | add ecx, eax |
175 | sub ecx, [ebx+BLITTER.dst_y] |
175 | sub ecx, [ebx+BLITTER.dst_y] |
176 | mov [ebx+BLITTER.src_y], ecx |
176 | mov [ebx+BLITTER.src_y], ecx |
177 | mov [ebx+BLITTER.dst_x], edx |
177 | mov [ebx+BLITTER.dst_x], edx |
178 | mov [ebx+BLITTER.dst_y], eax |
178 | mov [ebx+BLITTER.dst_y], eax |
179 | clc |
179 | clc |
180 | .done: |
180 | .done: |
181 | add esp, 40 |
181 | add esp, 40 |
182 | pop ebx |
182 | pop ebx |
183 | pop esi |
183 | pop esi |
184 | pop edi |
184 | pop edi |
185 | 185 | ||
186 | 186 | ||
187 | purge .sx0 |
187 | purge .sx0 |
188 | purge .sy0 |
188 | purge .sy0 |
189 | purge .sx1 |
189 | purge .sx1 |
190 | purge .sy1 |
190 | purge .sy1 |
191 | 191 | ||
192 | purge .dx0 |
192 | purge .dx0 |
193 | purge .dy0 |
193 | purge .dy0 |
194 | purge .dx1 |
194 | purge .dx1 |
195 | purge .dy1 |
195 | purge .dy1 |
196 | 196 | ||
197 | ret |
197 | ret |
198 | 198 | ||
199 | align 4 |
199 | align 4 |
200 | blit_32: |
200 | blit_32: |
201 | push ebp |
201 | push ebp |
202 | push edi |
202 | push edi |
203 | push esi |
203 | push esi |
204 | push ebx |
204 | push ebx |
205 | virtual at sizeof.BLITTER |
205 | virtual at sizeof.BLITTER |
206 | .position dd ? ; (x shl 16) + y |
206 | .position dd ? ; (x shl 16) + y |
207 | ; ??? |
207 | ; ??? |
208 | .extra_var1 dd ? |
208 | .extra_var1 dd ? |
209 | .local_vars_size = $ |
209 | .local_vars_size = $ |
210 | end virtual |
210 | end virtual |
211 | sub esp, .local_vars_size |
211 | sub esp, .local_vars_size |
212 | 212 | ||
213 | mov eax, [TASK_BASE] |
213 | mov eax, [TASK_BASE] |
214 | mov ebx, [eax-twdw + WDATA.box.width] |
214 | mov ebx, [eax-twdw + WDATA.box.width] |
215 | mov edx, [eax-twdw + WDATA.box.height] |
215 | mov edx, [eax-twdw + WDATA.box.height] |
216 | inc ebx |
216 | inc ebx |
217 | inc edx |
217 | inc edx |
218 | 218 | ||
219 | xor eax, eax |
219 | xor eax, eax |
220 | 220 | ||
221 | mov [esp+BLITTER.dc.left], eax |
221 | mov [esp+BLITTER.dc.left], eax |
222 | mov [esp+BLITTER.dc.top], eax |
222 | mov [esp+BLITTER.dc.top], eax |
223 | mov [esp+BLITTER.dc.right], ebx |
223 | mov [esp+BLITTER.dc.right], ebx |
224 | mov [esp+BLITTER.dc.bottom], edx |
224 | mov [esp+BLITTER.dc.bottom], edx |
225 | 225 | ||
226 | mov [esp+BLITTER.sc.left], eax |
226 | mov [esp+BLITTER.sc.left], eax |
227 | mov [esp+BLITTER.sc.top], eax |
227 | mov [esp+BLITTER.sc.top], eax |
228 | mov eax, [ecx+24] |
228 | mov eax, [ecx+24] |
229 | 229 | ||
230 | mov [esp+BLITTER.sc.right], eax |
230 | mov [esp+BLITTER.sc.right], eax |
231 | mov eax, [ecx+28] |
231 | mov eax, [ecx+28] |
232 | 232 | ||
233 | mov [esp+BLITTER.sc.bottom], eax |
233 | mov [esp+BLITTER.sc.bottom], eax |
234 | 234 | ||
235 | mov eax, [ecx] |
235 | mov eax, [ecx] |
236 | mov [esp+BLITTER.dst_x], eax |
236 | mov [esp+BLITTER.dst_x], eax |
237 | mov eax, [ecx+4] |
237 | mov eax, [ecx+4] |
238 | mov [esp+BLITTER.dst_y], eax |
238 | mov [esp+BLITTER.dst_y], eax |
239 | 239 | ||
240 | mov eax, [ecx+16] |
240 | mov eax, [ecx+16] |
241 | mov [esp+BLITTER.src_x], eax |
241 | mov [esp+BLITTER.src_x], eax |
242 | mov eax, [ecx+20] |
242 | mov eax, [ecx+20] |
243 | mov [esp+BLITTER.src_y], eax |
243 | mov [esp+BLITTER.src_y], eax |
244 | mov eax, [ecx+8] |
244 | mov eax, [ecx+8] |
245 | mov [esp+BLITTER.w], eax |
245 | mov [esp+BLITTER.w], eax |
246 | mov eax, [ecx+12] |
246 | mov eax, [ecx+12] |
247 | mov [esp+BLITTER.h], eax |
247 | mov [esp+BLITTER.h], eax |
248 | 248 | ||
249 | 249 | ||
250 | mov eax, [ecx+32] |
250 | mov eax, [ecx+32] |
251 | mov [esp+BLITTER.bitmap], eax |
251 | mov [esp+BLITTER.bitmap], eax |
252 | mov eax, [ecx+36] |
252 | mov eax, [ecx+36] |
253 | mov [esp+BLITTER.stride], eax |
253 | mov [esp+BLITTER.stride], eax |
254 | 254 | ||
255 | mov ecx, esp |
255 | mov ecx, esp |
256 | call blit_clip |
256 | call blit_clip |
257 | jc .L57 |
257 | jc .L57 |
258 | 258 | ||
259 | mov eax, [TASK_BASE] |
259 | mov eax, [TASK_BASE] |
260 | 260 | ||
261 | mov ebx, [esp+BLITTER.dst_x] |
261 | mov ebx, [esp+BLITTER.dst_x] |
262 | mov ebp, [esp+BLITTER.dst_y] |
262 | mov ebp, [esp+BLITTER.dst_y] |
263 | add ebx, [eax-twdw + WDATA.box.left] |
263 | add ebx, [eax-twdw + WDATA.box.left] |
264 | add ebp, [eax-twdw + WDATA.box.top] |
264 | add ebp, [eax-twdw + WDATA.box.top] |
265 | 265 | ||
266 | mov ecx, ebx |
266 | mov ecx, ebx |
267 | add ecx, [esp+BLITTER.w] |
267 | add ecx, [esp+BLITTER.w] |
268 | shl ecx, 16 |
268 | shl ecx, 16 |
269 | mov cx, bp |
269 | mov cx, bp |
270 | add ecx, [esp+BLITTER.h] |
270 | add ecx, [esp+BLITTER.h] |
271 | 271 | ||
272 | mov eax, ebx |
272 | mov eax, ebx |
273 | shl eax, 16 |
273 | shl eax, 16 |
274 | mov ax, bp |
274 | mov ax, bp |
275 | mov [esp+.position], eax |
275 | mov [esp+.position], eax |
276 | 276 | ||
277 | mov edi, ebp |
277 | mov edi, ebp |
278 | 278 | ||
279 | ; imul edi, [_display.pitch] |
279 | ; imul edi, [_display.pitch] |
280 | mov edi, [BPSLine_calc_area+edi*4] |
280 | mov edi, [BPSLine_calc_area+edi*4] |
281 | ; imul ebp, [_display.width] |
281 | ; imul ebp, [_display.width] |
282 | mov ebp, [d_width_calc_area+ebp*4] |
282 | mov ebp, [d_width_calc_area+ebp*4] |
283 | 283 | ||
284 | add ebp, ebx |
284 | add ebp, ebx |
285 | add ebp, [_display.win_map] |
285 | add ebp, [_display.win_map] |
286 | 286 | ||
287 | mov eax, [esp+BLITTER.src_y] |
287 | mov eax, [esp+BLITTER.src_y] |
288 | imul eax, [esp+BLITTER.stride] |
288 | imul eax, [esp+BLITTER.stride] |
289 | mov esi, [esp+BLITTER.src_x] |
289 | mov esi, [esp+BLITTER.src_x] |
290 | lea esi, [eax+esi*4] |
290 | lea esi, [eax+esi*4] |
291 | add esi, [esp+BLITTER.bitmap] |
291 | add esi, [esp+BLITTER.bitmap] |
292 | 292 | ||
293 | mov eax, ecx |
293 | mov eax, ecx |
294 | mov ecx, [esp+BLITTER.h] |
294 | mov ecx, [esp+BLITTER.h] |
295 | mov edx, [esp+BLITTER.w] |
295 | mov edx, [esp+BLITTER.w] |
296 | 296 | ||
297 | test ecx, ecx ;FIXME check clipping |
297 | test ecx, ecx ;FIXME check clipping |
298 | jz .L57 |
298 | jz .L57 |
299 | 299 | ||
300 | test edx, edx |
300 | test edx, edx |
301 | jz .L57 |
301 | jz .L57 |
302 | 302 | ||
303 | cmp [_display.bits_per_pixel], 32 |
303 | cmp [_display.bits_per_pixel], 32 |
304 | jne .core_24 |
304 | jne .core_24 |
305 | 305 | ||
306 | lea edi, [edi+ebx*4] |
306 | lea edi, [edi+ebx*4] |
307 | 307 | ||
308 | mov ebx, [CURRENT_TASK] |
308 | mov ebx, [CURRENT_TASK] |
309 | ; check for hardware cursor |
309 | ; check for hardware cursor |
310 | cmp [_display.select_cursor], select_cursor |
310 | cmp [_display.select_cursor], select_cursor |
311 | je .core_32.software_cursor |
311 | je .core_32.software_cursor |
312 | cmp [_display.select_cursor], 0 |
312 | cmp [_display.select_cursor], 0 |
313 | jne .core_32.hardware_cursor |
313 | jne .core_32.hardware_cursor |
314 | ;-------------------------------------- |
314 | ;-------------------------------------- |
315 | .core_32.software_cursor: |
315 | .core_32.software_cursor: |
316 | align 4 |
316 | align 4 |
317 | .outer32: |
317 | .outer32: |
318 | 318 | ||
319 | align 4 |
319 | align 4 |
320 | .inner32: |
320 | .inner32: |
321 | cmp [ebp], bl |
321 | cmp [ebp], bl |
322 | jne .skip |
322 | jne .skip |
323 | ;-------------------------------------- |
323 | ;-------------------------------------- |
324 | mov eax, [esi] |
324 | mov eax, [esi] |
325 | 325 | ||
326 | mov ecx, [esp+.position] |
326 | mov ecx, [esp+.position] |
327 | 327 | ||
328 | ; check mouse area for putpixel |
328 | ; check mouse area for putpixel |
329 | call [_display.check_mouse] |
329 | call [_display.check_mouse] |
330 | ;-------------------------------------- |
330 | ;-------------------------------------- |
331 | ; store to real LFB |
331 | ; store to real LFB |
332 | mov [LFB_BASE+edi], eax |
332 | mov [LFB_BASE+edi], eax |
333 | ;-------------------------------------- |
333 | ;-------------------------------------- |
334 | align 4 |
334 | align 4 |
335 | .skip: |
335 | .skip: |
336 | add esi, 4 |
336 | add esi, 4 |
337 | add edi, 4 |
337 | add edi, 4 |
338 | inc ebp |
338 | inc ebp |
339 | add [esp+.position], 1 shl 16 |
339 | add [esp+.position], 1 shl 16 |
340 | dec edx |
340 | dec edx |
341 | jnz .inner32 |
341 | jnz .inner32 |
342 | 342 | ||
343 | add esi, [esp+BLITTER.stride] |
343 | add esi, [esp+BLITTER.stride] |
344 | add edi, [_display.lfb_pitch] |
344 | add edi, [_display.lfb_pitch] |
345 | add ebp, [_display.width] |
345 | add ebp, [_display.width] |
346 | 346 | ||
347 | mov edx, [esp+BLITTER.w] |
347 | mov edx, [esp+BLITTER.w] |
348 | mov eax, edx |
348 | mov eax, edx |
349 | inc [esp+.position] |
349 | inc [esp+.position] |
350 | sub ebp, edx |
350 | sub ebp, edx |
351 | shl eax, 2 |
351 | shl eax, 2 |
352 | sub esi, eax |
352 | sub esi, eax |
353 | sub edi, eax |
353 | sub edi, eax |
354 | shl eax, 16-2 |
354 | shl eax, 16-2 |
355 | sub [esp+.position], eax |
355 | sub [esp+.position], eax |
356 | dec [esp+BLITTER.h] |
356 | dec [esp+BLITTER.h] |
357 | jnz .outer32 |
357 | jnz .outer32 |
358 | jmp .done |
358 | jmp .done |
359 | .core_32.hardware_cursor: |
359 | .core_32.hardware_cursor: |
360 | align 4 |
360 | align 4 |
361 | .hw.outer32: |
361 | .hw.outer32: |
362 | xor ecx, ecx |
362 | xor ecx, ecx |
363 | 363 | ||
364 | align 4 |
364 | align 4 |
365 | .hw.inner32: |
365 | .hw.inner32: |
366 | cmp [ebp+ecx], bl |
366 | cmp [ebp+ecx], bl |
367 | jne .hw.skip |
367 | jne .hw.skip |
368 | mov eax, [esi+ecx*4] |
368 | mov eax, [esi+ecx*4] |
369 | mov [LFB_BASE+edi+ecx*4], eax |
369 | mov [LFB_BASE+edi+ecx*4], eax |
370 | 370 | ||
371 | align 4 |
371 | align 4 |
372 | .hw.skip: |
372 | .hw.skip: |
373 | inc ecx |
373 | inc ecx |
374 | dec edx |
374 | dec edx |
375 | jnz .hw.inner32 |
375 | jnz .hw.inner32 |
376 | 376 | ||
377 | add esi, [esp+BLITTER.stride] |
377 | add esi, [esp+BLITTER.stride] |
378 | add edi, [_display.lfb_pitch] |
378 | add edi, [_display.lfb_pitch] |
379 | add ebp, [_display.width] |
379 | add ebp, [_display.width] |
380 | 380 | ||
381 | mov edx, [esp+BLITTER.w] |
381 | mov edx, [esp+BLITTER.w] |
382 | dec [esp+BLITTER.h] |
382 | dec [esp+BLITTER.h] |
383 | jnz .hw.outer32 |
383 | jnz .hw.outer32 |
384 | 384 | ||
385 | .done: |
385 | .done: |
386 | ; call [draw_pointer] |
386 | ; call [draw_pointer] |
387 | ; call __sys_draw_pointer |
387 | ; call __sys_draw_pointer |
388 | .L57: |
388 | .L57: |
389 | add esp, .local_vars_size |
389 | add esp, .local_vars_size |
390 | pop ebx |
390 | pop ebx |
391 | pop esi |
391 | pop esi |
392 | pop edi |
392 | pop edi |
393 | pop ebp |
393 | pop ebp |
394 | ret |
394 | ret |
395 | 395 | ||
396 | .core_24: |
396 | .core_24: |
397 | cmp [_display.bits_per_pixel], 24 |
397 | cmp [_display.bits_per_pixel], 24 |
398 | jne .core_16 |
398 | jne .core_16 |
399 | 399 | ||
400 | lea ebx, [ebx+ebx*2] |
400 | lea ebx, [ebx+ebx*2] |
401 | lea edi, [LFB_BASE+edi+ebx] |
401 | lea edi, [LFB_BASE+edi+ebx] |
402 | mov ebx, [CURRENT_TASK] |
402 | mov ebx, [CURRENT_TASK] |
403 | 403 | ||
404 | align 4 |
404 | align 4 |
405 | .outer24: |
405 | .outer24: |
406 | mov [esp+.extra_var1], edi |
406 | mov [esp+.extra_var1], edi |
407 | xor ecx, ecx |
407 | xor ecx, ecx |
408 | 408 | ||
409 | align 4 |
409 | align 4 |
410 | .inner24: |
410 | .inner24: |
411 | cmp [ebp+ecx], bl ; Does the process own this pixel? |
411 | cmp [ebp+ecx], bl ; Does the process own this pixel? |
412 | jne .skip_1 |
412 | jne .skip_1 |
413 | ;-------------------------------------- |
413 | ;-------------------------------------- |
414 | push eax |
414 | push eax |
415 | mov eax, [esi+ecx*4] |
415 | mov eax, [esi+ecx*4] |
416 | 416 | ||
417 | lea edi, [edi+ecx*2] |
417 | lea edi, [edi+ecx*2] |
418 | 418 | ||
419 | ; check for hardware cursor |
419 | ; check for hardware cursor |
420 | cmp [_display.select_cursor], select_cursor |
420 | cmp [_display.select_cursor], select_cursor |
421 | je @f |
421 | je @f |
422 | cmp [_display.select_cursor], 0 |
422 | cmp [_display.select_cursor], 0 |
423 | jne .no_mouseunder_1 |
423 | jne .no_mouseunder_1 |
424 | ;-------------------------------------- |
424 | ;-------------------------------------- |
425 | align 4 |
425 | align 4 |
426 | @@: |
426 | @@: |
427 | push ecx |
427 | push ecx |
428 | 428 | ||
429 | mov ecx, [esp+4] |
429 | mov ecx, [esp+4] |
430 | ror ecx, 16 |
430 | ror ecx, 16 |
431 | sub ecx, edx |
431 | sub ecx, edx |
432 | rol ecx, 16 |
432 | rol ecx, 16 |
433 | sub ecx, [esp+BLITTER.h + 8] |
433 | sub ecx, [esp+BLITTER.h + 8] |
434 | 434 | ||
435 | ; check mouse area for putpixel |
435 | ; check mouse area for putpixel |
436 | call [_display.check_mouse] |
436 | call [_display.check_mouse] |
437 | pop ecx |
437 | pop ecx |
438 | ;-------------------------------------- |
438 | ;-------------------------------------- |
439 | align 4 |
439 | align 4 |
440 | .no_mouseunder_1: |
440 | .no_mouseunder_1: |
441 | mov [edi+ecx], ax |
441 | mov [edi+ecx], ax |
442 | shr eax, 16 |
442 | shr eax, 16 |
443 | mov [edi+ecx+2], al |
443 | mov [edi+ecx+2], al |
444 | 444 | ||
445 | pop eax |
445 | pop eax |
446 | ;-------------------------------------- |
446 | ;-------------------------------------- |
447 | align 4 |
447 | align 4 |
448 | .skip_1: |
448 | .skip_1: |
449 | inc ecx |
449 | inc ecx |
450 | dec edx |
450 | dec edx |
451 | jnz .inner24 |
451 | jnz .inner24 |
452 | 452 | ||
453 | add esi, [esp+BLITTER.stride] |
453 | add esi, [esp+BLITTER.stride] |
454 | mov edi, [esp+.extra_var1] |
454 | mov edi, [esp+.extra_var1] |
455 | add edi, [_display.lfb_pitch] |
455 | add edi, [_display.lfb_pitch] |
456 | add ebp, [_display.width] |
456 | add ebp, [_display.width] |
457 | 457 | ||
458 | mov edx, [esp+BLITTER.w] |
458 | mov edx, [esp+BLITTER.w] |
459 | dec [esp+BLITTER.h] |
459 | dec [esp+BLITTER.h] |
460 | jnz .outer24 |
460 | jnz .outer24 |
461 | 461 | ||
462 | jmp .done |
462 | jmp .done |
463 | 463 | ||
464 | 464 | ||
465 | .core_16: |
465 | .core_16: |
466 | lea edi, [LFB_BASE+edi+ebx*2] |
466 | lea edi, [LFB_BASE+edi+ebx*2] |
467 | mov ebx, [CURRENT_TASK] |
467 | mov ebx, [CURRENT_TASK] |
468 | 468 | ||
469 | .outer16: |
469 | .outer16: |
470 | mov [esp+.extra_var1], edi |
470 | mov [esp+.extra_var1], edi |
471 | xor ecx, ecx |
471 | xor ecx, ecx |
472 | 472 | ||
473 | .inner16: |
473 | .inner16: |
474 | cmp [ebp+ecx], bl ; Does the process own this pixel? |
474 | cmp [ebp+ecx], bl ; Does the process own this pixel? |
475 | jne .skip_2 |
475 | jne .skip_2 |
476 | ;-------------------------------------- |
476 | ;-------------------------------------- |
477 | push eax |
477 | push eax |
478 | mov eax, [esi+ecx*4] |
478 | mov eax, [esi+ecx*4] |
479 | 479 | ||
480 | ; check for hardware cursor |
480 | ; check for hardware cursor |
481 | cmp [_display.select_cursor], select_cursor |
481 | cmp [_display.select_cursor], select_cursor |
482 | je @f |
482 | je @f |
483 | cmp [_display.select_cursor], 0 |
483 | cmp [_display.select_cursor], 0 |
484 | jne .no_mouseunder_2 |
484 | jne .no_mouseunder_2 |
485 | ;-------------------------------------- |
485 | ;-------------------------------------- |
486 | @@: |
486 | @@: |
487 | push ecx |
487 | push ecx |
488 | 488 | ||
489 | mov ecx, [esp+4] |
489 | mov ecx, [esp+4] |
490 | ror ecx, 16 |
490 | ror ecx, 16 |
491 | sub ecx, edx |
491 | sub ecx, edx |
492 | rol ecx, 16 |
492 | rol ecx, 16 |
493 | sub ecx, [esp+BLITTER.h + 8] |
493 | sub ecx, [esp+BLITTER.h + 8] |
494 | 494 | ||
495 | ; check mouse area for putpixel |
495 | ; check mouse area for putpixel |
496 | call [_display.check_mouse] |
496 | call [_display.check_mouse] |
497 | pop ecx |
497 | pop ecx |
498 | ;-------------------------------------- |
498 | ;-------------------------------------- |
499 | .no_mouseunder_2: |
499 | .no_mouseunder_2: |
500 | ; convert to 16 bpp and store to LFB |
500 | ; convert to 16 bpp and store to LFB |
501 | and eax, 00000000111110001111110011111000b |
501 | and eax, 00000000111110001111110011111000b |
502 | shr ah, 2 |
502 | shr ah, 2 |
503 | shr ax, 3 |
503 | shr ax, 3 |
504 | ror eax, 8 |
504 | ror eax, 8 |
505 | add al, ah |
505 | add al, ah |
506 | rol eax, 8 |
506 | rol eax, 8 |
507 | mov [edi+ecx*2], ax |
507 | mov [edi+ecx*2], ax |
508 | pop eax |
508 | pop eax |
509 | ;-------------------------------------- |
509 | ;-------------------------------------- |
510 | .skip_2: |
510 | .skip_2: |
511 | inc ecx |
511 | inc ecx |
512 | dec edx |
512 | dec edx |
513 | jnz .inner16 |
513 | jnz .inner16 |
514 | 514 | ||
515 | add esi, [esp+BLITTER.stride] |
515 | add esi, [esp+BLITTER.stride] |
516 | mov edi, [esp+.extra_var1] |
516 | mov edi, [esp+.extra_var1] |
517 | add edi, [_display.lfb_pitch] |
517 | add edi, [_display.lfb_pitch] |
518 | add ebp, [_display.width] |
518 | add ebp, [_display.width] |
519 | 519 | ||
520 | mov edx, [esp+BLITTER.w] |
520 | mov edx, [esp+BLITTER.w] |
521 | dec [esp+BLITTER.h] |
521 | dec [esp+BLITTER.h] |
522 | jnz .outer16 |
522 | jnz .outer16 |
523 | 523 | ||
524 | jmp .done=>>=>> |
524 | jmp .done=>>=>> |