Subversion Repositories Kolibri OS

Rev

Rev 2089 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1894 serge 1
 
2
 
3
 
4
   .dc.ymin    rd  1   ;   4
5
   .dc.xmax    rd  1   ;   8
6
   .dc.ymax    rd  1   ;  12
7
8
   .sc:
9
   .sc.xmin    rd  1   ;  16
10
 
11
   .sc.xmax    rd  1   ;  24
12
   .sc.ymax    rd  1   ;  28
13
14
   .dst_x      rd  1   ;  32
15
   .dst_y      rd  1   ;  36
16
 
17
   .src_y      rd  1   ;  44
18
   .w          rd  1   ;  48
19
   .h          rd  1   ;  52
20
21
   .bitmap     rd  1   ;  56
22
   .stride     rd  1   ;  60
23
 
24
}
25
26
 
27
  BLITTER BLITTER
28
 
29
30
31
align 4
32
 
33
 
34
        push  ebx
35
 
36
        cmp edx, [eax]
37
        jl  .L2
38
        xor ebx, ebx
39
        cmp edx, [eax+8]
40
        setg  bl
41
        sal ebx, 2
42
.L2:
43
        cmp ecx, [eax+4]
44
        jge .L3
45
        or  ebx, 1
46
        jmp .L4
47
48
.L3:
49
        cmp ecx, [eax+12]
50
 
51
        or  ebx, 2
52
.L4:
53
        mov eax, ebx
54
        pop ebx
55
        ret
56
57
align 4
58
block_clip:
59
 
60
        push  edi
61
        push  esi
62
        push  ebx
63
        sub esp, 4
64
65
        mov ebx, eax
66
        mov [esp], edx
67
 
68
        mov ecx, [ecx]
69
        mov edx, [edx]
70
        mov eax, ebx
71
        call  __L1OutCode
72
73
        mov esi, eax
74
        mov edx, [esp+28]
75
 
76
.L21:
77
        mov  eax, [esp+24]
78
        mov  edx, [eax]
79
        mov  eax, ebx
80
        call __L1OutCode
81
82
        mov  edi, eax
83
.L20:
84
 
85
        and eax, esi
86
        jne .L9
87
        cmp esi, edi
88
        je  .L9
89
        test  esi, esi
90
        jne .L10
91
        test  edi, 1
92
        je  .L11
93
        mov eax, [ebx+4]
94
        jmp .L25
95
.L11:
96
        test  edi, 2
97
        je  .L13
98
        mov eax, [ebx+12]
99
.L25:
100
        mov edx, [esp+28]
101
        jmp .L22
102
.L13:
103
        test  edi, 4
104
        je  .L14
105
        mov eax, [ebx+8]
106
        jmp .L26
107
.L14:
108
        and  edi, 8
109
        je .L12
110
        mov  eax, [ebx]
111
.L26:
112
        mov  edx, [esp+24]
113
.L22:
114
        mov  [edx], eax
115
.L12:
116
        mov eax, [esp+28]
117
        mov ecx, [eax]
118
        jmp .L21
119
.L10:
120
        test  esi, 1
121
        je  .L16
122
        mov eax, [ebx+4]
123
        jmp .L23
124
.L16:
125
        test  esi, 2
126
        je  .L18
127
        mov eax, [ebx+12]
128
.L23:
129
        mov [ebp+0], eax
130
        jmp .L17
131
.L18:
132
        test  esi, 4
133
        je  .L19
134
        mov eax, [ebx+8]
135
        jmp .L24
136
.L19:
137
        and esi, 8
138
        je  .L17
139
        mov eax, [ebx]
140
.L24:
141
        mov edx, [esp]
142
        mov [edx], eax
143
.L17:
144
        mov ecx, [ebp+0]
145
        mov eax, [esp]
146
        mov edx, [eax]
147
        mov eax, ebx
148
        call  __L1OutCode
149
        mov esi, eax
150
        jmp .L20
151
.L9:
152
        add esp, 4
153
        pop ebx
154
        pop esi
155
        pop edi
156
        pop ebp
157
        ret
158
159
align 4
160
blit_clip:
161
 
162
.sx0   equ 36
163
.sy0   equ 32
164
 
165
.sy1   equ 24
166
167
.dx0   equ 20
168
.dy0   equ 16
169
 
170
.dy1   equ 8
171
172
173
        push  edi
174
 
175
 
176
        sub esp, 40
177
178
        mov ebx, ecx
179
        mov edx, [ecx+BLITTER.src_x]
180
 
181
        mov eax, [ecx+BLITTER.src_y]
182
        mov [esp+.sy0], eax
183
        add edx, [ecx+BLITTER.w]
184
        dec edx
185
        mov [esp+.sx1], edx
186
        add eax, [ecx+BLITTER.h]
187
        dec eax
188
        mov [esp+.sy1], eax
189
190
        lea ecx, [esp+.sy0]
191
        lea edx, [esp+.sx0]
192
 
193
        lea esi, [esp+.sy1]
194
195
        mov [esp+4], esi
196
        lea esi, [esp+.sx1]
197
 
198
        call  block_clip
199
200
        mov esi, 1
201
        test  eax, eax
202
 
203
204
        mov edi, [esp+.sx0]
205
        mov edx, [ebx+BLITTER.dst_x]
206
 
207
        sub edx, [ebx+BLITTER.src_x]
208
        mov [esp+.dx0], edx
209
210
        mov ecx, [esp+.sy0]
211
        mov eax, [ebx+BLITTER.dst_y]
212
 
213
        sub eax, [ebx+BLITTER.src_y]
214
        mov [esp+.dy0], eax
215
        sub edx, edi
216
        add edx, [esp+.sx1]
217
        mov [esp+.dx1], edx
218
219
        sub eax, ecx
220
        add eax, [esp+.sy1]
221
 
222
223
        lea ecx, [esp+.dy0]
224
        lea edx, [esp+.dx0]
225
 
226
        mov [esp+4], eax
227
        lea eax, [esp+.dx1]
228
        mov [esp], eax
229
        mov eax, ebx
230
        call  block_clip
231
        test  eax, eax
232
        jne .L28
233
234
        mov edx, [esp+.dx0]
235
        mov eax, [esp+.dx1]
236
 
237
        sub eax, edx
238
        mov [ebx+BLITTER.w], eax
239
240
        mov eax, [esp+.dy0]
241
        mov ecx, [esp+.dy1]
242
 
243
        sub ecx, eax
244
        mov [ebx+BLITTER.h], ecx
245
246
        mov ecx, [ebx+BLITTER.src_x]
247
        add ecx, edx
248
 
249
        mov [ebx+BLITTER.src_x], ecx
250
251
        mov ecx, [ebx+BLITTER.src_y]
252
        add ecx, eax
253
 
254
        mov [ebx+BLITTER.src_y], ecx
255
        mov [ebx+BLITTER.dst_x], edx
256
        mov [ebx+BLITTER.dst_y], eax
257
        xor esi, esi
258
.L28:
259
        mov eax, esi
260
        add esp, 40
261
        pop ebx
262
        pop esi
263
        pop edi
264
265
266
purge .sx0
267
 
268
 
269
purge .sy1
270
271
purge .dx0
272
purge .dy0
273
 
274
purge .dy1
275
276
        ret
277
278
 
279
280
 
281
 
282
 
283
        push ebp
284
 
285
        push esi
286
        push ebx
287
        sub  esp, 72
288
289
        mov  eax, [TASK_BASE]
290
        mov  ebx, [eax-twdw + WDATA.box.width]
291
 
292
293
        xor  eax, eax
294
295
 
296
        mov  [esp+BLITTER.dc.ymin], eax
297
 
298
        mov  [esp+BLITTER.dc.ymax], edx
299
300
        mov  [esp+BLITTER.sc.xmin], eax
301
        mov  [esp+BLITTER.sc.ymin], eax
302
 
303
        dec  eax
304
        mov  [esp+BLITTER.sc.xmax], eax
305
        mov  eax, [ecx+28]
306
        dec  eax
307
        mov  [esp+BLITTER.sc.ymax], eax
308
309
        mov  eax, [ecx]
310
        mov  [esp+BLITTER.dst_x], eax
311
 
312
        mov  [esp+BLITTER.dst_y], eax
313
314
        mov  eax, [ecx+16]
315
        mov  [esp+BLITTER.src_x], eax
316
 
317
        mov  [esp+BLITTER.src_y], eax
318
        mov  eax, [ecx+8]
319
        mov  [esp+BLITTER.w], eax
320
        mov  eax, [ecx+12]
321
        mov  [esp+BLITTER.h], eax
322
323
324
        mov  eax, [ecx+32]
325
 
326
 
327
        mov  [esp+60], eax
328
329
        mov  ecx, esp
330
        call blit_clip
331
 
332
        jne  .L57
333
334
        inc  [mouse_pause]
335
        call [_display.disable_mouse]
336
 
337
        mov  eax, [TASK_BASE]
338
339
 
340
        mov  ebp, [esp+BLITTER.dst_y]
341
 
342
        add  ebp, [eax-twdw + WDATA.box.top]
343
        mov  edi, ebp
344
345
        imul edi, [_display.pitch]
346
        imul ebp, [_display.width]
347
 
348
        add  ebp, [_WinMapAddress]
349
350
        mov  eax, [esp+BLITTER.src_y]
351
        imul eax, [esp+BLITTER.stride]
352
 
353
        lea  esi, [eax+esi*4]
354
        add  esi, [esp+BLITTER.bitmap]
355
356
        mov  ecx, [esp+BLITTER.h]
357
        mov  edx, [esp+BLITTER.w]
358
 
359
        test ecx, ecx       ;FIXME check clipping
360
        jz   .L57
361
 
362
        test edx, edx
363
        jz   .L57
364
 
365
        cmp [_display.bpp], 32
366
        jne .core_24
367
 
368
        lea edi, [edi+ebx*4]
369
370
 
371
372
 
373
.outer32:
374
 
375
376
align 4
377
.inner32:
378
 
379
        jne @F
380
381
        mov eax, [esi+ecx*4]
382
        mov [LFB_BASE+edi+ecx*4], eax
383
 
384
        inc ecx
385
        dec edx
386
        jnz .inner32
387
388
        add esi, [esp+BLITTER.stride]
389
        add edi, [_display.pitch]
390
 
391
392
        mov edx, [esp+BLITTER.w]
393
        dec [esp+BLITTER.h]
394
 
395
396
.done:
397
        dec  [mouse_pause]
398
 
399
.L57:
400
        add  esp, 72
401
        pop  ebx
402
        pop  esi
403
        pop  edi
404
        pop  ebp
405
        ret
406
407
.core_24:
408
        lea ebx, [ebx+ebx*2]
409
 
410
        mov ebx, [CURRENT_TASK]
411
412
align 4
413
.outer24:
414
 
415
        xor ecx, ecx
416
417
align 4
418
.inner24:
419
 
420
        jne @F
421
422
        mov eax, [esi+ecx*4]
423
424
 
425
        mov [edi+ecx], ax
426
 
427
        mov [edi+ecx+2], al
428
@@:
429
        mov edi, [esp+64]
430
        inc ecx
431
        dec edx
432
        jnz .inner24
433
434
        add esi, [esp+BLITTER.stride]
435
        add edi, [_display.pitch]
436
 
437
438
        mov edx, [esp+BLITTER.w]
439
        dec [esp+BLITTER.h]
440
 
441
442
        jmp .done
443