Subversion Repositories Kolibri OS

Rev

Rev 1859 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1859 Rev 1899
Line 49... Line 49...
49
.new_line:
49
.new_line:
50
        btr     ebx, 26
50
        btr     ebx, 26
51
        mov     eax, [img_map_x]
51
        mov     eax, [img_map_x]
52
        xor     ecx, ecx
52
        xor     ecx, ecx
53
        cmp	bl, byte[ebp]		        ; check the left tile first
53
        cmp	bl, byte[ebp]		        ; check the left tile first
54
        jz      .new_tile
54
        je      .new_tile
55
        bts     ebx, 26                         ; ebx[26] = 1 if edi/esi already pushed
55
        bts     ebx, 26                         ; ebx[26] = 1 if edi/esi pushed
56
        jc      .seek_visible
-
 
57
        push    edi
56
        push    edi
58
        push    esi
57
        push    esi
-
 
58
        push    [img_bitoffset]
59
        jmp     .seek_visible
59
        jmp     .seek_visible
60
.new_tile:
60
.new_tile:
61
        inc     ecx			        ; visible - scan the open space
61
        inc     ecx			        ; visible - scan the open space
62
        cmp     ecx, eax      
62
        cmp     ecx, eax      
63
        jz      .end_of_line
63
        jz      .end_of_line
64
        cmp     bl, byte[ebp+ecx]               ; overlapped? draw the visible segment if so
64
        cmp     bl, byte[ebp+ecx]  
65
        je      .new_tile
65
        je      .new_tile
-
 
66
                                                ; overlapped? draw the last visible segment if so
-
 
67
        bts     ebx, 26                         ; check if edi/esi already pushed
-
 
68
        jc      @f
-
 
69
        push    edi
-
 
70
        push    esi
-
 
71
        push    [img_bitoffset]
66
 
-
 
67
        call    [img_draw_core_fn]	        ; bpp-specific helper (see below)
72
@@:     call    [img_draw_core_fn]	        ; bpp-specific helper (see below)
Line 68... Line 73...
68
 
73
 
69
.seek_visible:
74
.seek_visible:
70
        inc     ecx
75
        inc     ecx
71
        cmp     ecx, eax	
76
        cmp     ecx, eax	
Line 74... Line 79...
74
        jne     .seek_visible
79
        jne     .seek_visible
75
.got_visible:
80
.got_visible:
76
        sub     eax, ecx
81
        sub     eax, ecx
77
	shl     ecx, 4
82
	shl     ecx, 4
78
        add	edi, ecx                        ; shift the left edge 
83
        add	edi, ecx                        ; shift the left edge
-
 
84
        bt      ebx, 25                         ; 1bpp?
-
 
85
        jc      @f 
79
        shr     ecx, 2
86
        shr     ecx, 2
80
        imul    ecx, [img_bytes_per_pix]
87
        imul    ecx, [img_bytes_per_pix] 
-
 
88
        jmp     .new_visible      
-
 
89
@@:     shr     ecx, 8                          ; 2 tiles = 1 byte 
-
 
90
        jnc     .new_visible
-
 
91
        rol     [img_bitoffset], 4
-
 
92
        jnc     .new_visible
-
 
93
        inc     ecx
-
 
94
.new_visible:
81
        add     esi, ecx
95
        add     esi, ecx
82
        xor     ecx, ecx
96
        xor     ecx, ecx
83
        jmp     .new_tile
97
        jmp     .new_tile
Line 84... Line 98...
84
 
98
 
85
.end_of_line:
99
.end_of_line:
Line 86... Line 100...
86
        call    [img_draw_core_fn]
100
        call    [img_draw_core_fn]
87
 
101
 
88
.next_line:  
102
.next_line:  
-
 
103
        bt      ebx, 26
89
        bt      ebx, 26
104
        jnc     @f
90
        jnc     @f
105
        pop     [img_bitoffset]
91
        pop     esi
106
        pop     esi
92
        pop     edi                                   
107
        pop     edi                                   
93
@@:	inc	edx
108
@@:	inc	edx
Line 115... Line 130...
115
align 4
130
align 4
116
draw_unaligned_edge:
131
draw_unaligned_edge:
117
        pushad
132
        pushad
118
        mov     eax, [img_buf_line_size]
133
        mov     eax, [img_buf_line_size]
119
        mov     bh, dl                  ; store the 1st tile offset
134
        mov     bh, dl                  ; store the 1st tile offset
120
        bt      ebx, 24                 ; check if the 1st line odd
135
        btr     ebx, 24                 ; check if the 1st line odd
121
        jnc     .new_tile           
136
        jnc     .new_tile           
122
        cmp     bl, byte[ebp]
137
        cmp     bl, byte[ebp]
123
        jne     @f
138
        jne     @f
124
        call    [img_draw_edge_fn]      ; bpp-specific helper (see below)
139
        call    [img_draw_edge_fn]      ; bpp-specific helper (see below)
125
@@:     
140
@@:     
126
        dec     ecx
141
        dec     ecx
127
        jz      .exit
142
        jz      .exit
128
        add     edi, [BytesPerScanLine]
143
        add     edi, [BytesPerScanLine]
129
        add     ebp, [_WinMapWidth]
144
        add     ebp, [_WinMapWidth]
130
        add     esi, eax
145
        add     esi, eax
131
        btr     ebx, 24                 
-
 
132
.new_tile:
146
.new_tile:
133
        cmp     bl, byte[ebp]
147
        cmp     bl, byte[ebp]
134
        jne     .skip_tile
148
        jne     .skip_tile
135
        call    [img_draw_edge_fn]      
149
        call    [img_draw_edge_fn]      
136
        dec     ecx
150
        dec     ecx
Line 164... Line 178...
164
; esi -> left point of the image edge 
178
; esi -> left point of the image edge 
165
; edi -> left point of the screen edge
179
; edi -> left point of the screen edge
166
; bh = edx = tile offset (0, 4, 8 or 12 bytes)
180
; bh = edx = tile offset (0, 4, 8 or 12 bytes)
Line 167... Line 181...
167
 
181
 
-
 
182
align 4
-
 
183
draw_edge_0bpp:
-
 
184
        push    eax 
-
 
185
        mov     eax, [esi]
-
 
186
.putpix:
-
 
187
        mov     [edi+edx], eax
-
 
188
        sub     dl,  4
-
 
189
        jae     .putpix
-
 
190
.exit:
-
 
191
	movzx	edx, bh
-
 
192
        pop     eax
-
 
193
        ret
168
align 4
194
align 4
169
draw_edge_32bpp:
195
draw_edge_32bpp:
170
        push    eax 
196
        push    eax 
171
.putpix:
197
.putpix:
172
        mov     eax, [esi+edx]
198
        mov     eax, [esi+edx]
173
        mov     [edi+edx], eax
199
        mov     [edi+edx], eax
174
        sub     dl,  4
200
        sub     dl,  4
175
        jae     .putpix
201
        jae     .putpix
176
.exit:
202
.exit:
177
	mov	dl, bh
203
	movzx	edx, bh
178
        pop     eax
204
        pop     eax
179
        ret
205
        ret
180
align 4
206
align 4
181
draw_edge_24bpp:
207
draw_edge_24bpp:
182
        push    eax esi
208
        push    eax esi
183
	xor	dl, dl
209
	xor	dl, dl
184
.putpix:
210
.putpix:
185
        mov     eax, [esi]
211
        mov     eax, [esi]
186
        and     eax, 0x00FFFFFF
212
        and     eax, 0x00FFFFFF
187
        mov     [edi+edx], eax
213
        mov     [edi+edx], eax
188
        test    dl, bh
214
        cmp     dl, bh
189
        jz      .exit
215
        je      .exit
190
        add     dl,  4
216
        add     dl,  4
191
        add     esi, 3
217
        add     esi, 3
192
        jmp     .putpix
218
        jmp     .putpix
193
.exit:
219
.exit:
Line 200... Line 226...
200
        mov     ebp, [img_palette]
226
        mov     ebp, [img_palette]
201
.putpix:
227
.putpix:
202
        movzx   eax, byte[esi]
228
        movzx   eax, byte[esi]
203
        mov     eax, [ebp+eax*4]
229
        mov     eax, [ebp+eax*4]
204
        mov     [edi+edx], eax
230
        mov     [edi+edx], eax
205
        test    dl, bh
231
        cmp     dl, bh
206
        jz      .exit
232
        je      .exit
207
        add     dl,  4
233
        add     dl,  4
208
        inc     esi
234
        inc     esi
209
        jmp     .putpix
235
        jmp     .putpix
210
.exit:
236
.exit:
211
        pop     ebp esi eax
237
        pop     ebp esi eax
212
        ret
238
        ret
213
align 4
239
align 4
214
draw_edge_1bpp:
240
draw_edge_1bpp:
-
 
241
        pushad
-
 
242
        movzx   edx, bh
215
        push    eax ecx ebx ebp
243
        add     edx, edi
216
        mov     ebp, [img_palette]
244
        mov     ebp, [img_palette]
217
        mov     ebx, [ebp+4]            ; forecolor
245
        mov     ebx, [ebp+4]            ; forecolor
218
        mov     ebp, [ebp]              ; backcolor
246
        mov     ebp, [ebp]              ; backcolor
219
        mov     ecx, [img_edgeoffset]    ; cl = 1 << left_edge_pix_num
247
        mov     ecx, [img_edgeoffset]    ; cl = 1 << left_edge_pix_num
220
        mov     ebp, [esi]     
248
        mov     eax, [esi]     
221
        xor     dl, dl
-
 
222
.testbit:
249
.testbit:
223
        test    ebp, ecx
250
        test    eax, ecx
224
        jnz     @f
251
        jnz     @f
225
        mov     eax, ebp 
252
        mov     eax, ebp 
226
        jmp     .putpix
253
        jmp     .putpix
227
@@:     mov     eax, ebx
254
@@:     mov     eax, ebx
228
.putpix:
255
.putpix:
229
        mov     [edi+edx], eax
256
        mov     [edi], eax
230
        test    dl, bh
257
        cmp     edi, edx
231
        jz      .exit
258
        je      .exit
232
        add     dl, 4
259
        add     edi, 4
233
        shl     ecx, 1
260
        rol     ecx, 1
234
        jmp     .testbit
261
        jmp     .testbit
235
.exit:
262
.exit:
236
        pop     ebp ebx ecx eax
263
        popad
237
        ret
264
        ret
Line 238... Line 265...
238
 
265
 
239
draw_edge_16bpp:
266
draw_edge_16bpp:
240
draw_core_16bpp:
267
draw_core_16bpp:
Line 241... Line 268...
241
        ret
268
        ret
242
 
269
 
243
;-------------
270
;-------------
244
; aligned core helpers
271
; aligned core helpers
245
; esi -> left point address (image) 
272
; esi -> left point address (buffer) 
-
 
273
; edi -> left point address (screen)
-
 
274
; ecx =  number of tiles to draw
-
 
275
align 4
-
 
276
draw_core_0bpp:
-
 
277
        push    eax ecx edi 
-
 
278
        pushfd
-
 
279
;        cli
-
 
280
        cld
-
 
281
        mov     eax, [esi]
-
 
282
        shl     ecx, 2
-
 
283
        rep     stosd
-
 
284
        popfd
246
; edi -> left point address (screen)
285
        pop     edi ecx eax
247
; cx  =  number of tiles to draw
286
        ret
248
align 4
287
align 4
249
draw_core_32bpp:
288
draw_core_32bpp:
250
        push    ecx 
289
        push    ecx esi edi 
251
        shl     ecx, 1
290
        pushfd
252
        dec     ecx
-
 
253
.putpix:
291
;        cli
254
        fld     qword[esi+ecx*8]        ; 2 qwords = 1 tile
292
        cld
255
        fstp    qword[edi+ecx*8]
293
        shl     ecx, 2
256
        dec     cx
294
        rep     movsd
257
        jnb     .putpix
295
        popfd
258
        pop     ecx 
296
        pop     edi esi ecx 
259
        ret
297
        ret
260
align 4
298
align 4
261
draw_core_24bpp:
299
draw_core_24bpp:
262
        push    eax ecx 
300
        push    eax ecx edx
263
        shl     ecx, 2
301
        shl     ecx, 2                  ; ecx = numpixels
264
        dec     ecx
302
        dec     ecx
265
        lea     eax, [ecx*2+ecx]
303
        lea     edx, [ecx*2+ecx]        ; edx = buffer byte offset
266
.putpix:
304
.putpix:
267
        mov     eax, [esi+eax]
305
        mov     eax, [esi+edx]
268
        and     eax, 0x00FFFFFF
306
        and     eax, 0x00FFFFFF
269
        mov     [edi+ecx*4], eax
307
        mov     [edi+ecx*4], eax
270
        sub     dx, 3
308
        dec     ecx
271
        dec     cx
309
        sub     edx, 3
272
        jnb     .putpix
310
        jnb     .putpix
273
        pop     ecx eax
311
        pop     edx ecx eax
274
        ret
312
        ret
275
align 4
313
align 4
276
draw_core_8bpp:
314
draw_core_8bpp:
Line 287... Line 325...
287
        inc     dl
325
        inc     dl
288
        cmp     dl, 4
326
        cmp     dl, 4
289
        jnz     .putone
327
        jnz     .putone
290
        add     esi, edx        ;-)
328
        add     esi, edx        ;-)
291
        add     edi, 16
329
        add     edi, 16
292
        dec     cx
330
        dec     ecx
293
        jnz     .putpix
331
        jnz     .putpix
294
.exit:
332
.exit:
295
        popad
333
        popad
296
        ret
334
        ret
297
align 4
335
align 4
Line 300... Line 338...
300
        mov     ebp, [img_palette]      
338
        mov     ebp, [img_palette]      
301
        mov     edx, [ebp+4]            ; foreground color
339
        mov     edx, [ebp+4]            ; foreground color
302
        mov     ebp, [ebp]              ; background color
340
        mov     ebp, [ebp]              ; background color
303
        mov     ebx, [img_bitoffset]
341
        mov     ebx, [img_bitoffset]
304
        shl     ecx, 2                  ; 1 tyle = 4 pix
342
        shl     ecx, 2                  ; 1 tyle = 4 pix
305
        dec     ecx
-
 
306
        jb      .exit
-
 
307
.newblock:
343
.newblock:
308
        mov     eax, [esi]
344
        mov     eax, [esi]
309
.putpix:
345
.putpix:
310
        test    ebx, eax
346
        test    ebx, eax
311
        jz      .bkcolor
347
        jz      .bkcolor
312
        mov     [edi], edx
348
        mov     [edi], edx
313
        jmp     .nextpix
349
        jmp     .nextpix
314
.bkcolor:
350
.bkcolor:
315
        mov     [edi], ebp
351
        mov     [edi], ebp
316
.nextpix:
352
.nextpix:
317
        dec     cx
353
        dec     ecx
318
        jb      .exit  
354
        jz      .exit  
319
        rol     ebx, 1
355
        rol     ebx, 1
320
        jc      .nextblock
356
        jc      .nextblock
321
        add     edi, 4
357
        add     edi, 4
322
        jmp     .putpix
358
        jmp     .putpix
323
.nextblock:
359
.nextblock:
Line 337... Line 373...
337
 
373
 
338
align 4
374
align 4
339
; ebx -> Buffer origin
375
; ebx -> Buffer origin
340
; ecx = packed size [x|y]
376
; ecx = packed size [x|y]
-
 
377
; edx = packed coordinates [x|y]
-
 
378
; static variables required:
-
 
379
; [img_draw_core_fn],  [img_draw_edge_fn]
-
 
380
; [img_bytes_per_pix], [img_buf_line_size]
Line 341... Line 381...
341
; edx = packed coordinates [x|y]
381
; [img_palette]  (1bpp and 8bpp only)
342
 
382
 
343
_putimage:
383
_putimage:
344
;     	call    [_display.disable_mouse]
384
;     	call    [_display.disable_mouse]
Line 354... Line 394...
354
     	mov     [putimg.image_sx], eax
394
     	mov     [putimg.image_sx], eax
355
    	mov     eax, edx
395
    	mov     eax, edx
356
     	and     edx, 0xFFFF			; Ytop
396
     	and     edx, 0xFFFF			; Ytop
357
     	shr     eax, 16			        ; Xleft
397
     	shr     eax, 16			        ; Xleft
358
.calculate_abs_coords:
398
.calculate_abs_coords:
-
 
399
        mov     edi, [TASK_BASE]
359
     	mov     ebx, [TASK_BASE-twdw + WDATA.box.left]
400
     	mov     ebx, [edi-twdw + WDATA.box.left]
360
     	mov     ecx, [TASK_BASE-twdw + WDATA.box.top]
401
     	mov     ecx, [edi-twdw + WDATA.box.top]
361
        add     ebx, eax
402
        add     ebx, eax
362
     	add     ecx, edx
403
     	add     ecx, edx
363
     	mov     [img_screen_x], ebx		; abs Xleft
404
     	mov     [img_screen_x], ebx		; abs Xleft
364
;     	mov     [img_screen_y], ecx		; ecx = abs Ytop        ; hold it !
405
;     	mov     [img_screen_y], ecx		; ecx = abs Ytop        ; hold it !
365
.check_x_size:
406
.check_x_size:
366
     	mov     ebx, [TASK_BASE-twdw + WDATA.box.width] 
407
     	mov     ebx, [edi-twdw + WDATA.box.width] 
367
     	inc     ebx				; ebx = window Xsize
408
     	inc     ebx				; ebx = window Xsize
368
     	sub     ebx, eax                        ; eax = rel Xleft
409
     	sub     ebx, eax                        ; eax = rel Xleft
369
     	jbe     .finish				; image is out of the window
410
     	jbe     .finish				; image is out of the window
370
        mov     eax, [putimg.image_sx]
411
        mov     eax, [putimg.image_sx]
371
     	cmp     ebx, eax		        ; real_sx = MIN(wnd_sx-image_cx, image_sx);
412
     	cmp     ebx, eax		        ; real_sx = MIN(wnd_sx-image_cx, image_sx);
372
     	jae     @f
413
     	jae     @f
373
        mov     eax, ebx
414
        mov     eax, ebx
374
@@:    	dec     eax
415
@@:    	dec     eax
375
        mov     [img_pix_x], eax
416
        mov     [img_pix_x], eax
376
.check_y_size:
417
.check_y_size:
377
     	mov     ebx, [TASK_BASE-twdw + WDATA.box.height] 
418
     	mov     ebx, [edi-twdw + WDATA.box.height] 
378
     	inc     ebx				; ebx = real window y-size
419
     	inc     ebx				; ebx = real window y-size
379
     	sub     ebx, edx                        ; edx = rel Ytop
420
     	sub     ebx, edx                        ; edx = rel Ytop
380
     	jbe     .finish				; image isn't visible
421
     	jbe     .finish				; image isn't visible
381
        mov     edx, [putimg.image_sy]
422
        mov     edx, [putimg.image_sy]
382
        cmp     ebx, edx
423
        cmp     ebx, edx
Line 394... Line 435...
394
.calculate_map_origin:
435
.calculate_map_origin:
395
	xor	ebx, ebx
436
	xor	ebx, ebx
396
        mov     bl,  byte [img_bytes_per_pix]
437
        mov     bl,  byte [img_bytes_per_pix]
397
        or      bl,  bl
438
        or      bl,  bl
398
        jnz     @f
439
        jnz     @f
-
 
440
        mov     ecx, [img_buf_line_size]
-
 
441
        or      cl, cl
-
 
442
        je      @f
399
        bts     ebx, 25
443
        bts     ebx, 25
400
@@:    	mov     bl,  byte [CURRENT_TASK]	; get process number 
444
@@:    	mov     bl,  byte [CURRENT_TASK]	; get process number 
401
    	mov     ebp, ecx                        ; ecx = absY
445
    	mov     ebp, ecx                        ; ecx = absY
402
	shr	ebp, 1				; CF= odd line
446
	shr	ebp, 1				; CF= odd line
403
	jnc	@f
447
	jnc	@f
Line 405... Line 449...
405
@@:    	imul    ebp, [_WinMapWidth]	
449
@@:    	imul    ebp, [_WinMapWidth]	
406
	add	ebp, [_WinMapAddress]
450
	add	ebp, [_WinMapAddress]
407
     	mov     ecx, eax                        ; eax = absX
451
     	mov     ecx, eax                        ; eax = absX
408
	shr	ecx, 2                 
452
	shr	ecx, 2                 
409
	add     eax, [img_pix_x]
453
	add     eax, [img_pix_x]
-
 
454
        inc     eax
410
        shr     eax, 2
455
        shr     eax, 2
411
        add     eax, ebp	
456
        add     eax, ebp	
412
        mov     [img_map_right], eax		; right edge tile
457
;        mov     [img_map_right], eax		; right edge tile
413
     	add     ebp, ecx			; left edge Map origin
458
     	add     ebp, ecx			; left edge Map origin
414
        mov	ecx, [img_pix_y]
459
        mov	ecx, [img_pix_y]
415
        sub     eax, ebp
460
        sub     eax, ebp
416
        jz      .thin_bar                       ; special case: all image is 1 tile  thick
461
        jz      .thin_bar                       ; special case: all image is 1 tile  thick
417
        mov     [img_map_x], eax                ; tiles in row (excluding the right one) 
462
        mov     [img_map_x], eax                ; tiles in row (excluding the right one) 
Line 420... Line 465...
420
; esi = [img_buf_origin] -> buffered image
465
; esi = [img_buf_origin] -> buffered image
421
; edi = [img_lfb_origin] -> LFB image (corner point, 0RGB format) 
466
; edi = [img_lfb_origin] -> LFB image (corner point, 0RGB format) 
422
; ebp -> corner tile position
467
; ebp -> corner tile position
423
; ecx = [img_pix_y] =  image height
468
; ecx = [img_pix_y] =  image height
424
;  bl = task #
469
;  bl = task #
425
; ebx[24] = 1 if the core Y is odd
470
; ebx[24] = 1 if Ytop is odd
426
; ebx[25] = 1bpp image
471
; ebx[25] = 1 if 1bpp image
Line 427... Line 472...
427
 
472
 
428
.start:
473
.start:
429
        bt      ebx, 25 
474
        bt      ebx, 25 
430
        jnc     @f
475
        jnc     @f
431
        xor     eax, eax
476
        xor     eax, eax
432
        inc     al
477
        inc     al
433
	mov	[img_bitoffset], eax		; 1bpp image must be byte-aligned
478
	mov	[img_bitoffset], eax		; 1bpp image must be byte-aligned
434
	mov	[img_edgeoffset], eax		
479
	mov	[img_edgeoffset], eax		
435
@@:
480
@@:
436
	mov	edx, edi
481
	mov	edx, edi
-
 
482
	mov	dh, 0x0C
437
	and	edx, 0x0C       
483
        and     dl, dh       
438
        jz      .go_right                       ; left edge already aligned
484
        jz      .go_right                       ; left edge already aligned
439
.left_edge:
-
 
440
        mov     dh, 0x0C
485
.left_edge:
441
        sub     dh, dl
486
        sub     dh, dl
442
        movzx   edx, dh
487
        movzx   edx, dh
443
	call	draw_unaligned_edge
488
	call	draw_unaligned_edge
444
        dec     [img_map_x]
489
        dec     [img_map_x]
Line 479... Line 524...
479
        push    ebp
524
        push    ebp
480
        add     ebp, edx                        ; rightEdge Map origin 
525
        add     ebp, edx                        ; rightEdge Map origin 
481
        mov     eax, [img_pix_x]
526
        mov     eax, [img_pix_x]
482
        shl     eax, 2                          ; 1 pix = 4 bytes
527
        shl     eax, 2                          ; 1 pix = 4 bytes
483
        add     eax, edi                        ; rightEdge last pix (LFB addr)
528
        add     eax, edi                        ; rightEdge last pix (LFB addr)
-
 
529
        shl     edx, 4
-
 
530
        add     edi, edx                        ; rightEdge Screen origin
484
        movzx   edx, al 
531
        movzx   edx, al 
-
 
532
        mov     eax, [img_map_x]
485
        and     dl, 0x0C
533
        and     dl, 0x0C
486
        jz      .core_block             	; rightEdge is already tile-aligned
-
 
487
        and     al, 0xF0
534
        cmp     dl, 0x0C
488
        mov     edi, eax                        ; rightEdge Screen origin
535
        je      .core_block             	; rightEdge is already tile-aligned
489
.right_edge:
536
.right_edge:
490
        call    draw_unaligned_edge
537
        call    draw_unaligned_edge
491
        dec     [img_map_x]             
-
 
492
.core_block:
538
.core_block:
493
        pop     ebp
-
 
494
        mov     eax, [img_map_x]
-
 
495
	or      eax, eax                        ; empty central core?
539
        or      eax, eax                        ; empty central core?
496
        jz      .finish
540
        jz      .finish            
-
 
541
        mov     ebp, [esp]
497
    	mov	edi, [img_lfb_origin]
542
    	mov	edi, [img_lfb_origin]
498
	mov	esi, [img_buf_origin]
543
	mov	esi, [img_buf_origin]
Line 499... Line 544...
499
	
544
	
Line 500... Line 545...
500
	call	draw_aligned_box
545
	call	draw_aligned_box
501
	
546
	
502
.finish:
547
.finish:
503
     	add     esp, putimg.stack_data
548
     	add     esp, (putimg.stack_data + 4)
504
;	call	[_display.enable_mouse]
549
;	call	[_display.enable_mouse]
Line 505... Line 550...
505
	popad
550
	popad
506
	ret
551
	ret
507
 
552
 
508
.thin_bar:                                      ; < a special case > :  one-tile-wide image
553
.thin_bar:                                      ; < a special case > :  one-tile-wide image
509
        mov     edx, [img_pix_x]
554
        mov     edx, [img_pix_x]
-
 
555
        shl     edx, 2                          ; edx = rightmost tile offset (0, 4, 8, or 12 bytes)
-
 
556
        call    draw_unaligned_edge
Line 510... Line 557...
510
        shl     edx, 2                          ; edx = rightmost tile offset (0, 4, 8, or 12 bytes)
557
     	add     esp, putimg.stack_data
511
        call    draw_unaligned_edge
558
	popad
-
 
559
	ret
-
 
560
 
-
 
561
 
-
 
562
;align 64
-
 
563
;img_test_struct_32:     ; 8 x 10
-
 
564
;        dd      0x112233, 0x223344, 0x334455, 0x445566, 0x556677, 0x667788, 0x778899, 0x887766
-
 
565
;        dd      0x223344, 0x334455, 0x445566, 0x556677, 0x667788, 0x777799, 0x887766, 0x997755
512
        jmp     .finish
566
;        dd      0x334455, 0x445566, 0x556677, 0x667788, 0x777799, 0x887766, 0x997755, 0xAA7744
513
 
567
;        dd      0x445566, 0x556677, 0x667788, 0x777799, 0x887766, 0x997755, 0xAA7744, 0xBB7733
-
 
568
;        dd      0x334455, 0x445566, 0x556677, 0x667788, 0x777799, 0x887766, 0x997755, 0xAA7744
-
 
569
;        dd      0x223344, 0x334455, 0x445566, 0x556677, 0x667788, 0x777799, 0x887766, 0x997755
-
 
570
;        dd      0x112233, 0x223344, 0x334455, 0x445566, 0x556677, 0x667788, 0x777799, 0x887766
-
 
571
;        dd      0x001122, 0x112233, 0x223344, 0x334455, 0x445566, 0x556677, 0x667788, 0x777799
-
 
572
;        dd      0x220000, 0x001122, 0x112233, 0x223344, 0x334455, 0x445566, 0x556677, 0x667788
-
 
573
;        dd      0x441100, 0x220000, 0x001122, 0x112233, 0x223344, 0x334455, 0x445566, 0x556677
-
 
574
 
-
 
575
;align 64
-
 
576
;img_test_struct_24:     ; 8 x 16
-
 
577
;        dw      0x1100, 0x0022, 0x2211, 0x1100, 0x0022, 0x2211, 0xBBAA, 0xAACC, 0xCCBB, 0xBBAA, 0xAACC, 0xCCBB
-
 
578
;        dw      0xBBAA, 0xAACC, 0xCCBB, 0xBBAA, 0xAACC, 0xCCBB, 0x1100, 0x0022, 0x2211, 0x1100, 0x0022, 0x2211
-
 
579
;        dw      0x1100, 0x0022, 0x2211, 0x1100, 0x0022, 0x2211, 0xBBAA, 0xAACC, 0xCCBB, 0xBBAA, 0xAACC, 0xCCBB
-
 
580
;        dw      0xBBAA, 0xAACC, 0xCCBB, 0xBBAA, 0xAACC, 0xCCBB, 0x1100, 0x0022, 0x2211, 0x1100, 0x0022, 0x2211
-
 
581
;        dw      0x1100, 0x0022, 0x2211, 0x1100, 0x0022, 0x2211, 0xBBAA, 0xAACC, 0xCCBB, 0xBBAA, 0xAACC, 0xCCBB
-
 
582
;        dw      0xBBAA, 0xAACC, 0xCCBB, 0xBBAA, 0xAACC, 0xCCBB, 0x1100, 0x0022, 0x2211, 0x1100, 0x0022, 0x2211
-
 
583
;        dw      0x1100, 0x0022, 0x2211, 0x1100, 0x0022, 0x2211, 0xBBAA, 0xAACC, 0xCCBB, 0xBBAA, 0xAACC, 0xCCBB
-
 
584
;        dw      0xBBAA, 0xAACC, 0xCCBB, 0xBBAA, 0xAACC, 0xCCBB, 0x1100, 0x0022, 0x2211, 0x1100, 0x0022, 0x2211
-
 
585
;        dw      0x1100, 0x0022, 0x2211, 0x1100, 0x0022, 0x2211, 0xBBAA, 0xAACC, 0xCCBB, 0xBBAA, 0xAACC, 0xCCBB
-
 
586
;        dw      0xBBAA, 0xAACC, 0xCCBB, 0xBBAA, 0xAACC, 0xCCBB, 0x1100, 0x0022, 0x2211, 0x1100, 0x0022, 0x2211
-
 
587
;        dw      0x1100, 0x0022, 0x2211, 0x1100, 0x0022, 0x2211, 0xBBAA, 0xAACC, 0xCCBB, 0xBBAA, 0xAACC, 0xCCBB
-
 
588
;        dw      0xBBAA, 0xAACC, 0xCCBB, 0xBBAA, 0xAACC, 0xCCBB, 0x1100, 0x0022, 0x2211, 0x1100, 0x0022, 0x2211
-
 
589
;        dw      0x1100, 0x0022, 0x2211, 0x1100, 0x0022, 0x2211, 0xBBAA, 0xAACC, 0xCCBB, 0xBBAA, 0xAACC, 0xCCBB
-
 
590
;        dw      0xBBAA, 0xAACC, 0xCCBB, 0xBBAA, 0xAACC, 0xCCBB, 0x1100, 0x0022, 0x2211, 0x1100, 0x0022, 0x2211
-
 
591
;        dw      0x1100, 0x0022, 0x2211, 0x1100, 0x0022, 0x2211, 0xBBAA, 0xAACC, 0xCCBB, 0xBBAA, 0xAACC, 0xCCBB
-
 
592
;        dw      0xBBAA, 0xAACC, 0xCCBB, 0xBBAA, 0xAACC, 0xCCBB, 0x1100, 0x0022, 0x2211, 0x1100, 0x0022, 0x2211
-
 
593
 
-
 
594
;align 64
-
 
595
;img_test_struct_8:     ; 20 x 10
-
 
596
;        db      0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0
514
 
597
;        db      0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0
515
align 64
598
;        db      0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0
-
 
599
;        db      0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0
-
 
600
;        db      0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0
-
 
601
;        db      0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0
-
 
602
;        db      0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0
-
 
603
;        db      0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0
-
 
604
;        db      0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0
-
 
605
;        db      0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0
-
 
606
 
-
 
607
;align 64
-
 
608
;img_test_struct_1:     ; 16 x 10
-
 
609
;        db      0x0F, 0xF0
-
 
610
;        db      0x0F, 0xF0
-
 
611
;        db      0x3C, 0xC3
-
 
612
;        db      0x3C, 0xC3
-
 
613
;        db      0xF0, 0x0F
-
 
614
;        db      0xF0, 0x0F
-
 
615
;        db      0x3C, 0xC3
-
 
616
;        db      0x3C, 0xC3
-
 
617
;        db      0x0F, 0xF0
Line 516... Line 618...
516
img_test_struct:
618
;        db      0x0F, 0xF0
517
        dd      0x00112233, 0x00223344, 0x00334455, 0x00445566
619
 
518
        dd      0x00223344, 0x00334455, 0x00445566, 0x00334455
620
;align 64
-
 
621
;img_test_palette:     ; 6 colors
-
 
622
;        dd      0x00BB2233, 0xAA4466, 0x995555, 0x00339966, 0x00884455, 0x00775566, 0x00664455, 0x00553344, 0x0
-
 
623
 
-
 
624
;**************************************************************************************
-
 
625
align 4
519
        dd      0x00334455, 0x00445566, 0x00334455, 0x00223344
626
__sys_putpixel:
Line 520... Line 627...
520
        dd      0x00445566, 0x00334455, 0x00223344, 0x00112233
627
        push    edx
521
 
628
	mov	edx, [TASK_BASE]
522
;**************************************************************************************
629
	add	eax, [edx-twdw+WDATA.box.left]
Line 537... Line 644...
537
     	test    edi,1		 ; force ?
644
     	test    edi,1		 ; force ?
538
     	jnz     .checked
645
     	jnz     .checked
Line 539... Line 646...
539
 
646
 
540
.not_forced:
647
.not_forced:
541
     	push    ebx eax
-
 
542
	shr	eax, 1
648
     	push    ebx eax
543
	shr	eax, 1
649
	shr	eax, 2
544
     	shr  	ebx, 1
650
     	shr  	ebx, 1
545
     	imul    ebx, [_WinMapWidth]	  ; win_map (X size)/2
651
     	imul    ebx, [_WinMapWidth]	  ; win_map (X size)/2
546
	add	ebx, eax
652
	add	ebx, eax
547
	mov	al, byte [CURRENT_TASK]
653
	mov	al, byte [CURRENT_TASK]
548
     	mov   	bl, byte [_WinMapAddress+ebx]
654
     	mov   	ah, byte [_WinMapAddress+ebx]
549
     	cmp     bl, al
655
     	cmp     ah, al
550
     	pop     eax ebx
656
     	pop     eax ebx
551
     	jne     .exit0
657
     	jne     .exit0
552
.checked:
658
.checked:
553
	push	ebx
659
	push	ebx
Line 563... Line 669...
563
.exit0:
669
.exit0:
564
     ret
670
     ret
Line 565... Line 671...
565
 
671
 
566
 
672
 
567
 
673
 
568
align 4
674
;align 4
569
put_pixel:	; left for compatibility with Vesa20_putpixel32
675
;_put_pixel:	; left for compatibility with Vesa20_putpixel32
570
; eax = x
676
;; eax = x
571
; ebx = y
677
;; ebx = y
572
     imul    ebx, [BytesPerScanLine]	 ; ebx = y * y multiplier
678
;     imul    ebx, [BytesPerScanLine]	 ; ebx = y * y multiplier
573
     lea     edi, [ebx+eax*4]  ; edi = x*4+(y*y multiplier)
679
;     lea     edi, [ebx+eax*4]  ; edi = x*4+(y*y multiplier)
Line 574... Line 680...
574
;     mov     eax, [esp+32-8+4] ; eax = color
680
;;     mov     eax, [esp+32-8+4] ; eax = color
Line 575... Line 681...
575
     mov     [LFB_BASE+edi], ecx
681
;     mov     [LFB_BASE+edi], ecx
Line 746... Line 852...
746
 
852
 
747
.newsegment:
853
.newsegment:
748
     mov     ecx, [ebp] 		; check the line segment (16 pixels!)
854
     mov     ecx, [ebp] 		; check the line segment (16 pixels!)
749
     xor     ecx, [CURRENT_TASK]
855
     xor     ecx, [CURRENT_TASK]
750
; -- the line ---
856
; -- the line ---
Line 751... Line 857...
751
     jmp     dword [hline.drawtable + edi*4]	; a coolhack (C) Serge
857
     jmp     dword [hline.drawtable + edi*4]	; (C) Serge, 2010
752
 
858
 
753
 
859
 
Line 883... Line 989...
883
 
989
 
Line 884... Line -...
884
 
-
 
885
;*************************************************
-
 
886
 
-
 
887
 
-
 
888
virtual at esp
-
 
889
drbar:
-
 
890
     .bar_sx	   dd ?
-
 
891
     .bar_sy	   dd ?
-
 
892
     .bar_cx	   dd ?
-
 
893
     .bar_cy	   dd ?
-
 
894
     .abs_cx	   dd ?
-
 
895
     .abs_cy	   dd ?
-
 
896
     .real_sx	   dd ?
-
 
897
     .real_sy	   dd ?
-
 
898
     .color	   dd ?
-
 
Line 899... Line 990...
899
     .line_inc_scr dd ?
990
 
900
     .line_inc_map dd ?
991
;*************************************************
901
     .stack_data = 4*11
992
 
902
end virtual
993
 
903
 
994
 
904
align 4
995
align 4
-
 
996
; eax   xOrigin
905
; eax   cx
997
; ebx   yOrigin
906
; ebx   cy
998
; ecx   xSize
907
; ecx   xe
-
 
908
; edx   ye
999
; edx   ySize
909
; edi   color
-
 
910
vesa20_drawbar:
-
 
911
     pushad
-
 
912
     call    [_display.disable_mouse]
-
 
913
     sub     esp, drbar.stack_data
-
 
914
     mov     [drbar.color], edi
1000
; edi   color
915
     sub     edx, ebx
1001
 
916
     jle     .exit
1002
_drawbar:
917
     sub     ecx, eax
1003
        pushad
918
     jle     .exit
-
 
919
     mov     [drbar.bar_sy], edx
-
 
920
     mov     [drbar.bar_sx], ecx
-
 
921
     mov     [drbar.bar_cx], eax
1004
        sub     esp, putimg.stack_data
922
     mov     [drbar.bar_cy], ebx
1005
	mov     [img_bytes_per_pix], 0
923
     mov     edi, [TASK_BASE]
-
 
924
     add     eax, [edi-twdw + WDATA.box.left] ; win_cx
-
 
925
     add     ebx, [edi-twdw + WDATA.box.top] ; win_cy
-
 
926
     mov     [drbar.abs_cx], eax
-
 
927
     mov     [drbar.abs_cy], ebx
-
 
928
; real_sx = MIN(wnd_sx-bar_cx, bar_sx);
-
 
929
     mov     ebx, [edi-twdw + WDATA.box.width] ; ebx = wnd_sx
-
 
930
; note that WDATA.box.width is one pixel less than real window x-size
-
 
931
     inc     ebx
-
 
932
     sub     ebx, [drbar.bar_cx]
1006
	mov     [img_buf_line_size], 0
933
     ja      @f
-
 
934
.exit:
-
 
935
     add     esp, drbar.stack_data
-
 
936
     popad
-
 
937
     xor     eax, eax
-
 
938
     inc     eax
-
 
939
     ret
-
 
940
@@:
1007
	mov	[img_draw_core_fn],  draw_core_0bpp
941
     cmp     ebx, [drbar.bar_sx]
-
 
942
     jbe     .end_x
-
 
943
     mov     ebx, [drbar.bar_sx]
-
 
944
.end_x:
-
 
945
     mov     [drbar.real_sx], ebx
-
 
946
; real_sy = MIN(wnd_sy-bar_cy, bar_sy);
-
 
947
     mov     ebx, [edi-twdw + WDATA.box.height] ; ebx = wnd_sy
-
 
948
     inc     ebx
-
 
949
     sub     ebx, [drbar.bar_cy]
-
 
950
     ja      @f
-
 
951
     add     esp, drbar.stack_data
-
 
952
     popad
-
 
953
     xor     eax, eax
-
 
954
     inc     eax
1008
	mov	[img_draw_edge_fn],  draw_edge_0bpp
955
     ret
-
 
956
@@:
1009
     	mov     [putimg.image_sx], ecx
957
     cmp     ebx, [drbar.bar_sy]
-
 
958
     jbe     .end_y
-
 
959
     mov     ebx, [drbar.bar_sy]
-
 
960
.end_y:
-
 
961
     mov     [drbar.real_sy], ebx
-
 
962
; line_inc_map
-
 
963
     mov     eax, [Screen_Max_X]
-
 
964
     sub     eax, [drbar.real_sx]
-
 
965
     inc     eax
-
 
966
     shr     eax, 1			; <<<<<<
-
 
967
     shr     eax, 1
-
 
968
     mov     [drbar.line_inc_map], eax	; vertical increment: map
-
 
969
; line_inc_scr
-
 
970
     mov     eax, [drbar.real_sx]
-
 
971
     shl     eax, 1
-
 
972
     shl     eax, 1
-
 
973
     neg     eax
-
 
974
     add     eax, [BytesPerScanLine]
-
 
975
     mov     [drbar.line_inc_scr], eax	; vertical increment: screen
-
 
976
; pointer to screen
-
 
977
     mov     edx, [drbar.abs_cy]
-
 
978
     mov     ebx, edx
-
 
979
     imul    edx, [BytesPerScanLine]    ; edx = LFB line offset
-
 
980
     mov     eax, [drbar.abs_cx]
-
 
981
     shl     eax, 1
-
 
982
     shl     eax, 1
-
 
983
     add     edx, eax			; edx = LFB corner offset
-
 
984
; pointer to pixel map
-
 
985
     shr     ebx, 1
-
 
986
     imul    ebx, [_WinMapWidth]	; eax = Wmap corner pos
-
 
987
     mov     eax, [drbar.abs_cx]
-
 
988
     shr     eax, 1
-
 
989
     shr     eax, 1
-
 
990
     add     eax, ebx
-
 
991
     add     eax, [_WinMapAddress]
-
 
992
     xchg    eax, ebp			; ebp = Wmap corner
-
 
993
; get process number
-
 
994
     mov     ebx, [CURRENT_TASK]
-
 
995
 
-
 
996
; eax - RGB-color   
-
 
997
; bl - process num
-
 
998
; ecx - pix counter (in a tile)
-
 
999
; edx - pointer to screen
-
 
1000
; esi - counter
-
 
1001
; edi - counter
-
 
1002
 
-
 
1003
     	mov     eax, [drbar.color]    ;; BBGGRR00
-
 
1004
     	mov     esi, 0
-
 
1005
align	4
-
 
1006
.new_y:
-
 
1007
     	mov     edi, [drbar.real_sx]
-
 
1008
     	movzx   ecx, dl
-
 
1009
     	shr	cl, 2		; pix# = edx/4
-
 
1010
	and     cl, 3   	; pix position in a tile
-
 
1011
.new_tile:
-
 
1012
	cmp     byte [ebp], bl
-
 
1013
	jne     .skip
-
 
1014
.new_x:
-
 
1015
	mov     [LFB_BASE+edx], eax
-
 
1016
	add     edx, 4
-
 
1017
	dec     edi
-
 
1018
	jz      .add_line
-
 
1019
	inc	cl
-
 
1020
	and	cl, 3
-
 
1021
	jnz	.new_x
-
 
1022
	jmp	.new_tile	
-
 
1023
.skip:
-
 
1024
     	add     edx, 4*4
-
 
1025
     	and     dl, 0xF0	; LFB align 16
-
 
1026
     	inc     ebp
-
 
1027
     	sub     edi, 4     	; <<<<< 
-
 
1028
	add	edi, ecx	; left tile may be 1,2 or 3px only 
-
 
1029
     	jae     .new_tile
-
 
1030
 
-
 
1031
.add_line:
-
 
1032
     	add     edx, [drbar.line_inc_scr] 
-
 
1033
; gradient-filled bars
-
 
1034
     test    eax, 0x80000000
-
 
1035
     jz      @f
-
 
1036
     test    al, al
-
 
1037
     jz      @f
-
 
1038
     dec     al
-
 
1039
@@:
-
 
1040
     	inc     esi
-
 
1041
     	test    esi, 1
-
 
1042
  	jne 	@f
-
 
1043
     	add     ebp, [drbar.line_inc_map]
-
 
1044
@@:	
-
 
1045
     	cmp     esi, [drbar.real_sy]
-
 
Line -... Line 1010...
-
 
1010
     	mov     [putimg.image_sy], edx
-
 
1011
        mov     edx, ebx
Line 1046... Line -...
1046
     	jbe     .new_y
-
 
1047
     	add     esp, drbar.stack_data
-
 
1048
     	popad
-
 
1049
     	xor     eax, eax
-
 
1050
     ret
-
 
1051
 
-
 
1052
 
-
 
1053
align 4
-
 
1054
;drawbackground:
-
 
1055
	call	[_display.disable_mouse]
-
 
1056
	pushad
-
 
1057
; External loop for all y from start to end
-
 
1058
	mov	ebx, [draw_data+32+RECT.top]	; y start
-
 
1059
.fill_line:
-
 
1060
	mov	edi, [draw_data+32+RECT.left]	; x start
-
 
Line -... Line 1012...
-
 
1012
        mov     [img_palette], edi
1061
	shl  	edi, 1
1013
        mov     esi, img_palette     
1062
	shl	edi, 1
1014
        mov     [img_buf_origin], esi     
-
 
1015
 
1063
	mov	eax, [BytesPerScanLine]
1016
	jmp     _putimage.calculate_abs_coords
-
 
1017
;       ret
1064
	mul	ebx
1018
 
1065
	xchg	edi, eax
1019
 
1066
	add	edi, eax
1020
draw_background:
1067
	add	edi, LFB_BASE
-
 
1068
 
-
 
1069
	mov	ebp, ebx
1021
        pushad
1070
	shr	ebp, 1
-
 
1071
	imul	ebp, [_WinMapWidth]
-
 
1072
	mov	edx, eax
-
 
1073
	shr	edx, 1
-
 
1074
	shr	edx, 1
-
 
1075
	add	ebp, edx
-
 
1076
	add 	ebp, [_WinMapAddress]
-
 
1077
	xor	edx, edx
-
 
1078
	inc	edx
-
 
1079
	mov	esi, 0x0336677		; <<< RGB
-
 
1080
; eax = x, ebx = y (screen coordinates)
-
 
1081
; ecx - aux. var 
-
 
1082
; edx = 1
-
 
1083
; esi = 0RGB, edi -> output
-
 
1084
; ebp = offset in WinMapAddress
1022
	pushfd
1085
.fill_tile:
-
 
1086
	cmp	[ebp], dl
-
 
1087
	jnz	.next_tile
-
 
1088
	mov     [edi],   esi
-
 
1089
	mov     [edi+4], esi
1023
	cld	; increment edi here!
1090
	mov     [edi+8], esi
-
 
1091
	mov     [edi+12],esi
1024
        mov     ebp, [_WinMapAddress]
1092
	mov	ecx, [BytesPerScanLine]
1025
        mov	eax, 0x00337766		; bgndcolor
1093
	mov     [ecx+edi],   esi
-
 
1094
	mov     [ecx+edi+4], esi
-
 
1095
	mov     [ecx+edi+8], esi
-
 
1096
	mov     [ecx+edi+12],esi
1026
	mov	bl, 1
1097
.next_tile:
1027
	mov	edx, [Screen_Max_X]
Line -... Line 1028...
-
 
1028
	shr	edx, 1
-
 
1029
	mov	edi, LFB_BASE
-
 
1030
	mov	esi, [BytesPerScanLine]	
-
 
1031
.new_row:
-
 
1032
	xor	ecx, ecx
-
 
1033
.fill:
-
 
1034
	cmp	byte [ebp+ecx], bl
-
 
1035
	jne	.next
1098
	add	edi, 4*4
1036
	
-
 
1037
	mov	[edi+esi], eax		; fill all 8 pixels of this tile
-
 
1038
	stosd
1099
	add	ebp, edx
1039
	mov	[edi+esi], eax
-
 
1040
	stosd
1100
	add	ax, 4
1041
	mov	[edi+esi], eax
-
 
1042
	stosd
1101
	mov	ecx, [draw_data+32+RECT.right]
1043
	mov	[edi+esi], eax
-
 
1044
	stosd
1102
	shr     ecx, 1
1045
.next:	inc	ecx
1103
        shr     ecx, 1
1046
	cmp	ecx, [_WinMapWidth]
1104
	cmp	eax, ecx
1047
	jb	.fill
Line 1105... Line -...
1105
	jbe	.fill_tile
-
 
1106
 
-
 
Line 1107... Line 1048...
1107
.next_line:
1048
	dec	edx
1108
	inc	ebx
1049
	jz	.done
1109
	mov	ecx, [draw_data+32+RECT.bottom]
1050
	add	ebp, ecx		; += [_WinMapWidth]
1110
	shr	ecx, 1
1051
	add	edi, esi 		; += [BytesPerScanLine]
Line 1126... Line 1067...
1126
align 4
1067
align 4
1127
bgr_cur_line	rd	1920	; maximum width of screen
1068
bgr_cur_line	rd	1920	; maximum width of screen
1128
bgr_next_line	rd	1920
1069
bgr_next_line	rd	1920
1129
endg
1070
endg
Line 1130... Line -...
1130
 
-
 
1131
smooth_line:
-
 
1132
	mov	al, [esi+2]
-
 
1133
	shl	eax, 16
-
 
1134
	mov	ax, [esi]
-
 
1135
	test	ecx, ecx
-
 
1136
	jz	@f
-
 
1137
	mov	ebx, [esi+2]
-
 
1138
	shr	ebx, 8
-
 
1139
	call	[overlapping_of_points_ptr]
-
 
1140
@@:
-
 
1141
	stosd
-
 
1142
	mov	eax, [esp+20+8]
-
 
1143
	inc	eax
-
 
1144
	mov	[esp+20+8], eax
-
 
1145
	cmp	eax, [draw_data+32+RECT.right]
-
 
1146
	ja	@f
-
 
1147
	add	ecx, [esp+36+8]
-
 
1148
	mov	eax, edx
-
 
1149
	adc	edx, [esp+40+8]
-
 
1150
	sub	eax, edx
-
 
1151
	lea	eax, [eax*3]
-
 
1152
	sub	esi, eax
-
 
1153
	jmp	smooth_line
-
 
1154
@@:
-
 
1155
	mov	eax, [draw_data+32+RECT.left]
-
 
1156
	mov	[esp+20+8], eax
-
 
Line 1157... Line -...
1157
	ret
-
 
1158
 
1071
 
1159
align 16
1072
 
1160
overlapping_of_points:
1073
_init_background:
1161
	push	ecx edx
1074
;	mov	edi, BgrAuxTable
1162
	mov	edx, eax
-
 
1163
	push	esi
-
 
1164
	shr	ecx, 26
1075
;	xor	edx, edx
1165
	mov	esi, ecx
1076
;.loop2:
1166
	mov	ecx, ebx
1077
;	mov	eax, edx
1167
	shl	esi, 9
1078
;	shl	eax, 8
1168
	movzx	ebx, dl
1079
;	neg	eax
1169
	movzx	eax, cl
1080
;	mov	ecx, 0x200
1170
	sub	eax, ebx
-
 
1171
	movzx	ebx, dh
1081
;.loop1:
1172
	add	dl, [BgrAuxTable+(eax+0x100)+esi]
1082
;	mov	byte [edi], ah
1173
	movzx	eax, ch
-
 
1174
	sub	eax, ebx
1083
;	inc	edi
1175
	add	dh, [BgrAuxTable+(eax+0x100)+esi]
1084
;	add	eax, edx
1176
	ror	ecx, 16
1085
;	loop	.loop1
1177
	ror	edx, 16
1086
;	add	dl, 4
1178
	movzx	eax, cl
-
 
1179
	movzx	ebx, dl
1087
;	jnz	.loop2
1180
	sub	eax, ebx
-
 
1181
	add	dl, [BgrAuxTable+(eax+0x100)+esi]
-
 
1182
	pop	esi
-
 
1183
	mov	eax, edx
-
 
1184
	pop	edx
-
 
1185
	ror	eax, 16
1088
        mov     byte [REDRAW_BACKGROUND], 1
Line 1186... Line -...
1186
	pop	ecx
-
 
1187
	ret
-
 
1188
 
-
 
1189
iglobal
-
 
1190
align 4
-
 
1191
overlapping_of_points_ptr	dd	overlapping_of_points
-
 
1192
endg
-
 
1193
 
-
 
1194
init_background:
-
 
1195
	mov	edi, BgrAuxTable
-
 
1196
	xor	edx, edx
-
 
1197
.loop2:
-
 
1198
	mov	eax, edx
-
 
1199
	shl	eax, 8
-
 
1200
	neg	eax
-
 
1201
	mov	ecx, 0x200
-
 
1202
.loop1:
-
 
1203
	mov	byte [edi], ah
-
 
1204
	inc	edi
-
 
1205
	add	eax, edx
-
 
1206
	loop	.loop1
-
 
1207
	add	dl, 4
-
 
1208
	jnz	.loop2
-
 
1209
	test	byte [cpu_caps+(CAPS_MMX/8)], 1 shl (CAPS_MMX mod 8)
-
 
1210
	jz	@f
-
 
Line 1211... Line -...
1211
	mov	[overlapping_of_points_ptr], overlapping_of_points_mmx
-
 
1212
@@:
-
 
1213
	ret
-
 
1214
 
-
 
1215
align 16
-
 
1216
overlapping_of_points_mmx:
-
 
1217
	movd	mm0, eax
-
 
1218
	movd	mm4, eax
-
 
1219
	movd	mm1, ebx
-
 
1220
	pxor	mm2, mm2
-
 
1221
	punpcklbw mm0, mm2
-
 
1222
	punpcklbw mm1, mm2
-
 
1223
	psubw	mm1, mm0
-
 
1224
	movd	mm3, ecx
-
 
1225
	psrld	mm3, 24
-
 
1226
	packuswb mm3, mm3
-
 
1227
	packuswb mm3, mm3
-
 
1228
	pmullw	mm1, mm3
-
 
1229
	psrlw	mm1, 8
-
 
1230
	packuswb mm1, mm2
1089
;        mov     dword[BgrAuxTable], 0x00337766
1231
	paddb	mm4, mm1
1090
	ret