Subversion Repositories Kolibri OS

Rev

Rev 6036 | Rev 6472 | 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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
 
8
$Revision: 6462 $
9
 
2536 mario79 10
dtext:
5665 Pathoswith 11
; edx -> string
12
; esi = number of characters
13
; ebx = output coordinates XXXXYYYY h
14
; ecx = char color and flags flRRGGBB h
15
; fl = ZBFFRSSS b
16
; Z=1: edx -> zero terminated string, esi = ?
17
; B=1: fill background with color eax
18
; R=1: edi -> user area for redirect
5867 pathoswith 19
; FF=3: UTF-8 8x16, FF=2: UTF-16LE 8x16
20
; FF=1: cp866 8x16, FF=0: cp866 6x9
5665 Pathoswith 21
; SSS = (font multiplier)-1
22
; edi=1: force output
23
        and     eax, 0xFFFFFF
24
        bt      ecx, 30
25
        jc      @f
2288 clevermous 26
        xor     eax, eax
5665 Pathoswith 27
        dec     eax
28
@@:
29
        pushd   0 0 0 eax
30
        movsx   eax, bx
31
        sar     ebx, 16
32
        push    eax ebx edi
33
        bt      ecx, 27
34
        jc      .redirect
35
        mov     ebp, [_display.width]
36
        xor     edi, edi
2288 clevermous 37
        jmp     @f
5839 pathoswith 38
.ret:
39
        add     esp, 28
40
        ret
5665 Pathoswith 41
.redirect:
42
        mov     ebp, [edi]
43
        add     edi, 8
2288 clevermous 44
@@:
5665 Pathoswith 45
        shl     ebp, 2
46
        imul    eax, ebp
47
        shl     ebx, 2
48
        add     eax, ebx
49
        js      .ret
5921 pathoswith 50
        add     edi, eax
5665 Pathoswith 51
        mov     eax, ecx
52
        mov     ebx, ecx
53
        test    ecx, ecx
54
        jns     @f
55
        mov     esi, 256
56
@@:
57
        shr     ecx, 24
58
        and     cl, 7
59
        inc     ecx
60
        push    ebp ecx esi
5921 pathoswith 61
        mov     esi, edx
5665 Pathoswith 62
        or      eax, 0xFF000000
63
        bt      ebx, 27
64
        jc      .bufferReady
65
        mov     eax, 9
5867 pathoswith 66
        test    ebx, 0x30000000
67
        jz      @f
5665 Pathoswith 68
        add     eax, 7
69
@@:
70
        imul    eax, ecx
71
        mov     [esp+32], eax
72
        imul    ebp, eax
73
        stdcall kernel_alloc, ebp
74
        mov     ecx, ebp
75
        shr     ecx, 2
76
        mov     [esp+36], eax
77
        sub     edi, eax
78
        mov     edx, eax
79
        mov     eax, [esp+24]
80
        cmp     eax, -1
5921 pathoswith 81
        jnz     @f
5665 Pathoswith 82
        mov     [esp+28], edi
5921 pathoswith 83
@@:
5665 Pathoswith 84
        mov     edi, edx
85
        rep stosd
86
        mov     edi, edx
87
        mov     eax, ebx
88
        and     eax, 0xFFFFFF
89
.bufferReady:
90
        mov     ebp, eax
91
        xor     edx, edx
92
        bt      ebx, 29
5867 pathoswith 93
        jc      @f
5665 Pathoswith 94
        bt      ebx, 28
5867 pathoswith 95
        jc      .draw866toUni
96
        jmp     .draw866
97
@@:
98
        bt      ebx, 28
5665 Pathoswith 99
        jc      .drawUTF8
2536 mario79 100
 
5921 pathoswith 101
; ebp = font color
102
; esi -> string
103
; edi -> buffer
104
 
5839 pathoswith 105
; Stack map:
5665 Pathoswith 106
; char counter +0
107
fontMultiplier = 4
108
widthX = 8
109
; edi +12
110
; X +16
111
; Y +20
112
; background +24
113
deltaToScreen = 28
114
; temp buffer height +32
5839 pathoswith 115
; temp buffer pointer +36
2536 mario79 116
 
5665 Pathoswith 117
.drawUTF16:
118
        dec     dword [esp]
119
        js      .done
5921 pathoswith 120
        movzx   ebx, word [esi]
5665 Pathoswith 121
        test    ebx, ebx
122
        jz      .done
123
        inc     esi
124
        inc     esi
125
        cmp     bx, 1419
126
        jc      @f
127
        xor     ebx, ebx
2536 mario79 128
@@:
5665 Pathoswith 129
        pushd   esi edi 16
130
        shl     ebx, 4
131
        add     ebx, fontUni
132
        mov     esi, [esp+12+fontMultiplier]
133
        call    drawChar
134
        imul    esi, 8*4
135
        pop     edi
136
        pop     edi
137
        add     edi, esi
138
        pop     esi
139
        jmp     .drawUTF16
5839 pathoswith 140
 
5665 Pathoswith 141
.drawUTF8:
142
        dec     dword [esp]
143
        js      .done
6462 pathoswith 144
        mov     ecx, 256
145
        xor     eax, eax
146
        call    utf8to16
147
        test    ax, ax
5665 Pathoswith 148
        jz      .done
6462 pathoswith 149
        cmp     eax, 1419
150
        jc      @f
151
        xor     eax, eax
5665 Pathoswith 152
@@:
6462 pathoswith 153
        shl     eax, 4
154
        lea     ebx, [eax+fontUni]
5665 Pathoswith 155
        pushd   esi edi 16
156
        mov     esi, [esp+12+fontMultiplier]
157
        call    drawChar
158
        imul    esi, 8*4
159
        pop     edi
160
        pop     edi
161
        add     edi, esi
162
        pop     esi
163
        jmp     .drawUTF8
5839 pathoswith 164
 
5665 Pathoswith 165
.draw866:
166
        dec     dword [esp]
167
        js      .done
5921 pathoswith 168
        movzx   ebx, byte [esi]
5665 Pathoswith 169
        test    ebx, ebx
170
        jz      .done
171
        inc     esi
172
        pushd   esi edi 9
173
        lea     ebx, [ebx*8+ebx+font1]
174
        mov     esi, [esp+12+fontMultiplier]
175
        call    drawChar
176
        imul    esi, 6*4
177
        pop     edi
178
        pop     edi
179
        add     edi, esi
180
        pop     esi
181
        jmp     .draw866
5839 pathoswith 182
 
5867 pathoswith 183
.draw866toUni:
184
        dec     dword [esp]
185
        js      .done
5921 pathoswith 186
        movzx   eax, byte [esi]
5867 pathoswith 187
        test    eax, eax
188
        jz      .done
189
        call    ansi2uni_char
190
        shl     eax, 4
191
        lea     ebx, [eax+fontUni]
192
        inc     esi
193
        pushd   esi edi 16
194
        mov     esi, [esp+12+fontMultiplier]
195
        call    drawChar
196
        imul    esi, 8*4
197
        pop     edi
198
        pop     edi
199
        add     edi, esi
200
        pop     esi
201
        jmp     .draw866toUni
202
 
5665 Pathoswith 203
.done:
204
        mov     ecx, edi
205
        pop     eax eax eax esi edx ebx ebp ebp ebp
206
        mov     edi, [esp]
207
        test    edi, edi
208
        jnz     @f
209
        pop     eax
210
        ret
5839 pathoswith 211
@@:         ; redraw from buffer to screen
5665 Pathoswith 212
        push    eax
213
        sub     ecx, edi
214
        shr     ecx, 2
215
        add     edx, ecx
216
        inc     ecx
217
        push    ecx
218
        push    edi
219
.drawPicture:
220
        mov     eax, -1
221
        repz scasd
6036 pathoswith 222
        jecxz   @f
5665 Pathoswith 223
        mov     eax, edx
224
        sub     eax, ecx
225
        push    ecx
226
        mov     ecx, [edi-4]
227
        xchg    esi, edi
2453 mario79 228
        call    __sys_putpixel
5665 Pathoswith 229
        xchg    esi, edi
2536 mario79 230
        pop     ecx
5665 Pathoswith 231
        jmp     .drawPicture
2536 mario79 232
@@:
5665 Pathoswith 233
        pop     edi
234
        mov     ecx, [esp]
235
        add     edi, [esp+4]
2288 clevermous 236
        inc     ebx
5665 Pathoswith 237
        push    edi
238
        dec     ebp
239
        jnz     .drawPicture
240
        add     esp, 12
241
        call    kernel_free
242
        ret
243
 
5839 pathoswith 244
; scaling/smoothing algorithm
5665 Pathoswith 245
drawChar:
5921 pathoswith 246
; ebp = font color
247
; esi = font multiplier
248
; edi -> buffer
249
; ebx -> char data
5665 Pathoswith 250
        mov     dl, [ebx]
251
.raw:
252
        bsf     eax, edx
253
        jz      .nextRaw
254
        imul    eax, esi
255
        shl     eax, 2
256
        push    edi
257
        add     edi, eax
258
        mov     ecx, esi
2288 clevermous 259
        dec     esi
5665 Pathoswith 260
        jnz     .square
261
        mov     [edi], ebp
262
        inc     esi
263
        cmp     [fontSmoothing], 0
264
        jz      .nextPixel
5847 pathoswith 265
.checkLeftSM:     ; smoothing
5665 Pathoswith 266
        bsf     eax, edx
267
        dec     eax
5847 pathoswith 268
        js      .checkRightSM
5665 Pathoswith 269
        bt      [ebx], eax
5847 pathoswith 270
        jc      .checkRightSM
5665 Pathoswith 271
        dec     eax
5847 pathoswith 272
        js      .checkLeftDownSM
5665 Pathoswith 273
        bt      [ebx], eax
5847 pathoswith 274
        jc      .checkRightSM
275
.checkLeftDownSM:
5665 Pathoswith 276
        inc     eax
277
        bt      [ebx+1], eax
5847 pathoswith 278
        jnc     .checkLeftUpSM
5665 Pathoswith 279
        inc     eax
280
        bt      [ebx+1], eax
281
        jnc     @f
282
        bt      [ebx-1], eax
5847 pathoswith 283
        jc      .checkRightSM
5665 Pathoswith 284
        dec     eax
285
        dec     eax
286
        js      @f
287
        bt      [ebx+1], eax
288
        jnc     @f
289
        inc     eax
5847 pathoswith 290
.checkLeftUpSM:
5665 Pathoswith 291
        bt      [ebx-1], eax
5847 pathoswith 292
        jnc     .checkRightSM
5665 Pathoswith 293
        inc     eax
294
        bt      [ebx-1], eax
295
        jnc     @f
296
        bt      [ebx+1], eax
5847 pathoswith 297
        jc      .checkRightSM
5665 Pathoswith 298
        dec     eax
299
        dec     eax
300
        js      @f
301
        bt      [ebx-1], eax
5847 pathoswith 302
        jc      .checkRightSM
5665 Pathoswith 303
@@:
304
        mov     ecx, [esp+20+deltaToScreen]
305
        mov     eax, [edi-4]
306
        test    ecx, ecx
2536 mario79 307
        jz      @f
5665 Pathoswith 308
        pusha
309
        lea     ebx, [edi+ecx-4]
310
        shr     ebx, 2
311
        call    syscall_getpixel
312
        popa
2536 mario79 313
@@:
5839 pathoswith 314
        push    ebx edx
315
        mov     ebx, ebp
316
        xor     ecx, ecx
5847 pathoswith 317
        cmp     [fontSmoothing], 1
318
        jnz     .subpixelLeft
319
        call    antiAliasing
320
        jmp     @f
321
.subpixelLeft:
5839 pathoswith 322
        mov     cl, bl
323
        lea     edx, [ecx*8+ecx]
324
        lea     edx, [ecx*2+edx]
325
        mov     cl, al
326
        lea     ecx, [ecx*4+ecx]
327
        add     edx, ecx
328
        shr     edx, 4
329
        mov     al, dl
330
 
331
        xor     ecx, ecx
332
        mov     cl, ah
333
        lea     edx, [ecx*8+ecx]
334
        lea     edx, [ecx*2+edx]
335
        mov     cl, bh
336
        lea     ecx, [ecx*4+ecx]
337
        add     edx, ecx
338
        shr     edx, 4
339
        mov     ah, dl
340
 
341
        rol     eax, 16
342
        rol     ebx, 16
343
        xor     ecx, ecx
344
        mov     cl, al
345
        mov     edx, ecx
346
        shl     ecx, 3
347
        sub     ecx, edx
348
        mov     dl, bl
349
        add     ecx, edx
350
        shr     ecx, 3
351
        mov     al, cl
352
        rol     eax, 16
5847 pathoswith 353
@@:
5665 Pathoswith 354
        mov     [edi-4], eax
5839 pathoswith 355
        pop     edx ebx
5847 pathoswith 356
.checkRightSM:
5665 Pathoswith 357
        bsf     eax, edx
358
        inc     eax
359
        bt      [ebx], eax
360
        jc      .nextPixel
361
        inc     eax
362
        bt      [ebx], eax
363
        jc      .nextPixel
364
        dec     eax
5847 pathoswith 365
.checkRightDownSM:
5665 Pathoswith 366
        bt      [ebx+1], eax
5847 pathoswith 367
        jnc     .checkRightUpSM
5665 Pathoswith 368
        dec     eax
369
        bt      [ebx+1], eax
370
        jnc     @f
371
        bt      [ebx-1], eax
372
        jc      .nextPixel
373
        inc     eax
374
        inc     eax
375
        bt      [ebx+1], eax
376
        jnc     @f
377
        dec     eax
5847 pathoswith 378
.checkRightUpSM:
5665 Pathoswith 379
        bt      [ebx-1], eax
380
        jnc     .nextPixel
381
        dec     eax
382
        bt      [ebx-1], eax
383
        jnc     @f
384
        bt      [ebx+1], eax
385
        jc      .nextPixel
386
        inc     eax
387
        inc     eax
388
        bt      [ebx-1], eax
389
        jc      .nextPixel
390
@@:
391
        mov     ecx, [esp+20+deltaToScreen]
392
        mov     eax, [edi+4]
393
        test    ecx, ecx
2536 mario79 394
        jz      @f
5665 Pathoswith 395
        pusha
396
        lea     ebx, [edi+ecx+4]
397
        shr     ebx, 2
398
        call    syscall_getpixel
399
        popa
2536 mario79 400
@@:
5839 pathoswith 401
        push    ebx edx
402
        mov     ebx, ebp
403
        xor     ecx, ecx
5847 pathoswith 404
        cmp     [fontSmoothing], 1
405
        jnz     .subpixelRight
406
        call    antiAliasing
407
        jmp     @f
408
.subpixelRight:
5839 pathoswith 409
        mov     cl, al
410
        mov     edx, ecx
411
        shl     ecx, 3
412
        sub     ecx, edx
413
        mov     dl, bl
414
        add     ecx, edx
415
        shr     ecx, 3
5665 Pathoswith 416
        mov     al, cl
5839 pathoswith 417
 
418
        xor     ecx, ecx
419
        mov     cl, ah
420
        lea     edx, [ecx*8+ecx]
421
        lea     edx, [ecx*2+edx]
422
        mov     cl, bh
423
        lea     ecx, [ecx*4+ecx]
424
        add     edx, ecx
425
        shr     edx, 4
426
        mov     ah, dl
427
 
428
        rol     ebx, 16
429
        rol     eax, 16
430
        xor     ecx, ecx
431
        mov     cl, bl
432
        lea     edx, [ecx*8+ecx]
433
        lea     edx, [ecx*2+edx]
434
        mov     cl, al
435
        lea     ecx, [ecx*4+ecx]
436
        add     edx, ecx
437
        shr     edx, 4
438
        mov     al, dl
439
        rol     eax, 16
5847 pathoswith 440
@@:
5665 Pathoswith 441
        mov     [edi+4], eax
5839 pathoswith 442
        pop     edx ebx
5665 Pathoswith 443
        jmp     .nextPixel
5839 pathoswith 444
 
445
.square:    ; scaling
5665 Pathoswith 446
        mov     eax, esi
447
@@:
448
        mov     [edi+eax*4], ebp
449
        dec     eax
450
        jns     @b
451
        add     edi, [esp+20+widthX]
452
        dec     ecx
453
        jnz     .square
454
        inc     esi
455
        mov     edi, [esp]
456
.checkLeft:
457
        bsf     eax, edx
458
        dec     eax
459
        js      .checkRight
460
        bt      [ebx], eax
461
        jc      .checkRight
462
.checkLeftDown:
463
        bt      [ebx+1], eax
464
        jnc     .checkLeftUp
465
        mov     ecx, eax
2288 clevermous 466
        inc     eax
5665 Pathoswith 467
        bt      [ebx+1], eax
468
        jc      @f
469
        bt      [ebx-1], eax
470
        jnc     .downRightLow
471
        bt      [ebx-2], eax
472
        jc      .downRightLow
473
        dec     eax
474
        bt      [ebx-1], eax
475
        jc      .downRightLow
476
        dec     eax
477
        js      .downRightHigh
478
        bt      [ebx-2], eax
479
        jc      .downRightLow
480
        jmp     .downRightHigh
5839 pathoswith 481
 
5665 Pathoswith 482
@@:
483
        bt      [ebx-1], eax
484
        jc      .checkLeftUp
485
        dec     eax
486
        dec     eax
487
        js      .downRightLow
488
        bt      [ebx+1], eax
489
        jc      .checkLeftUp
490
.downRightLow:
491
        imul    ecx, esi
492
        shl     ecx, 2
493
        add     edi, ecx
2288 clevermous 494
        dec     esi
5665 Pathoswith 495
        mov     eax, [esp+20+widthX]
496
        imul    eax, esi
497
        add     edi, eax
498
        add     edi, 4
499
        mov     ecx, esi
500
        dec     ecx
501
.drawDownRight:
502
        mov     eax, ecx
503
@@:
504
        mov     [edi+eax*4], ebp
505
        dec     eax
506
        jns     @b
507
        sub     edi, [esp+20+widthX]
508
        add     edi, 4
509
        dec     ecx
510
        jns     .drawDownRight
511
        inc     esi
512
        mov     edi, [esp]
513
        jmp     .checkLeftUp
5839 pathoswith 514
 
5665 Pathoswith 515
.downRightHigh:
516
        imul    ecx, esi
517
        shl     ecx, 2
518
        add     edi, ecx
519
        dec     esi
520
        mov     eax, [esp+20+widthX]
521
        imul    eax, esi
522
        add     edi, eax
523
        add     edi, 4
524
        mov     ecx, esi
525
        dec     ecx
526
.drawDownRightHigh:
527
        mov     eax, ecx
528
@@:
529
        mov     [edi+eax*4], ebp
530
        dec     eax
531
        jns     @b
532
        sub     edi, [esp+20+widthX]
533
        mov     eax, ecx
534
@@:
535
        mov     [edi+eax*4], ebp
536
        dec     eax
537
        jns     @b
538
        sub     edi, [esp+20+widthX]
539
        add     edi, 4
540
        dec     ecx
541
        jns     .drawDownRightHigh
542
        inc     esi
543
        mov     edi, [esp]
544
.checkLeftUp:
545
        bsf     eax, edx
546
        dec     eax
547
        bt      [ebx-1], eax
548
        jnc     .checkRight
549
        mov     ecx, eax
550
        inc     eax
551
        bt      [ebx-1], eax
552
        jc      @f
553
        bt      [ebx+1], eax
554
        jnc     .upRightLow
555
        bt      [ebx+2], eax
556
        jc      .upRightLow
557
        dec     eax
558
        bt      [ebx+1], eax
559
        jc      .upRightLow
560
        dec     eax
561
        js      .upRightHigh
562
        bt      [ebx+2], eax
563
        jc      .upRightLow
564
        jmp     .upRightHigh
5839 pathoswith 565
 
5665 Pathoswith 566
@@:
567
        bt      [ebx+1], eax
568
        jc      .checkRight
569
        dec     eax
570
        dec     eax
571
        js      .upRightLow
572
        bt      [ebx-1], eax
573
        jc      .checkRight
574
.upRightLow:
575
        imul    ecx, esi
576
        shl     ecx, 2
577
        add     edi, ecx
578
        add     edi, 4
579
        mov     ecx, esi
580
        dec     ecx
581
        dec     ecx
582
.drawUpRight:
583
        mov     eax, ecx
584
@@:
585
        mov     [edi+eax*4], ebp
586
        dec     eax
587
        jns     @b
588
        add     edi, [esp+20+widthX]
589
        add     edi, 4
590
        dec     ecx
591
        jns     .drawUpRight
592
        mov     edi, [esp]
593
        jmp     .checkRight
5839 pathoswith 594
 
5665 Pathoswith 595
.upRightHigh:
596
        imul    ecx, esi
597
        shl     ecx, 2
598
        add     edi, ecx
599
        add     edi, 4
600
        mov     ecx, esi
601
        dec     ecx
602
        dec     ecx
603
.drawUpRightHigh:
604
        mov     eax, ecx
605
@@:
606
        mov     [edi+eax*4], ebp
607
        dec     eax
608
        jns     @b
609
        add     edi, [esp+20+widthX]
610
        mov     eax, ecx
611
@@:
612
        mov     [edi+eax*4], ebp
613
        dec     eax
614
        jns     @b
615
        add     edi, [esp+20+widthX]
616
        add     edi, 4
617
        dec     ecx
618
        jns     .drawUpRightHigh
619
        mov     edi, [esp]
620
.checkRight:
621
        bsf     eax, edx
622
        inc     eax
623
        bt      [ebx], eax
624
        jc      .nextPixel
625
.checkRightDown:
626
        bt      [ebx+1], eax
627
        jnc     .checkRightUp
628
        mov     ecx, eax
629
        dec     eax
630
        bt      [ebx+1], eax
631
        jc      @f
632
        bt      [ebx-1], eax
633
        jnc     .downLeftLow
634
        bt      [ebx-2], eax
635
        jc      .downLeftLow
636
        inc     eax
637
        bt      [ebx-1], eax
638
        jc      .downLeftLow
639
        inc     eax
640
        bt      [ebx-2], eax
641
        jc      .downLeftLow
642
        jmp     .downLeftHigh
5839 pathoswith 643
 
5665 Pathoswith 644
@@:
645
        bt      [ebx-1], eax
646
        jc      .checkRightUp
647
        inc     eax
648
        inc     eax
649
        bt      [ebx+1], eax
650
        jc      .checkRightUp
651
.downLeftLow:
652
        imul    ecx, esi
653
        shl     ecx, 2
654
        add     edi, ecx
655
        dec     esi
656
        mov     eax, [esp+20+widthX]
657
        imul    eax, esi
658
        add     edi, eax
659
        mov     ecx, esi
660
        dec     ecx
661
.drawDownLeft:
662
        mov     eax, ecx
663
@@:
664
        mov     [edi+eax*4], ebp
665
        dec     eax
666
        jns     @b
667
        sub     edi, [esp+20+widthX]
668
        dec     ecx
669
        jns     .drawDownLeft
670
        inc     esi
671
        mov     edi, [esp]
672
        jmp     .checkRightUp
5839 pathoswith 673
 
5665 Pathoswith 674
.downLeftHigh:
675
        imul    ecx, esi
676
        shl     ecx, 2
677
        add     edi, ecx
678
        dec     esi
679
        mov     eax, [esp+20+widthX]
680
        imul    eax, esi
681
        add     edi, eax
682
        mov     ecx, esi
683
        dec     ecx
684
.drawDownLeftHigh:
685
        mov     eax, ecx
686
@@:
687
        mov     [edi+eax*4], ebp
688
        dec     eax
689
        jns     @b
690
        sub     edi, [esp+20+widthX]
691
        mov     eax, ecx
692
@@:
693
        mov     [edi+eax*4], ebp
694
        dec     eax
695
        jns     @b
696
        sub     edi, [esp+20+widthX]
697
        dec     ecx
698
        jns     .drawDownLeftHigh
699
        inc     esi
700
        mov     edi, [esp]
701
.checkRightUp:
702
        bsf     eax, edx
703
        inc     eax
704
        bt      [ebx-1], eax
705
        jnc     .nextPixel
706
        mov     ecx, eax
707
        dec     eax
708
        bt      [ebx-1], eax
709
        jc      @f
710
        bt      [ebx+1], eax
711
        jnc     .upLeftLow
712
        bt      [ebx+2], eax
713
        jc      .upLeftLow
714
        inc     eax
715
        bt      [ebx+1], eax
716
        jc      .upLeftLow
717
        inc     eax
718
        bt      [ebx+2], eax
719
        jc      .upLeftLow
720
        jmp     .upLeftHigh
5839 pathoswith 721
 
5665 Pathoswith 722
@@:
723
        bt      [ebx+1], eax
724
        jc      .nextPixel
725
        inc     eax
726
        inc     eax
727
        bt      [ebx-1], eax
728
        jc      .nextPixel
729
.upLeftLow:
730
        imul    ecx, esi
731
        shl     ecx, 2
732
        add     edi, ecx
733
        mov     ecx, esi
734
        dec     ecx
735
        dec     ecx
736
.drawUpLeft:
737
        mov     eax, ecx
738
@@:
739
        mov     [edi+eax*4], ebp
740
        dec     eax
741
        jns     @b
742
        add     edi, [esp+20+widthX]
743
        dec     ecx
744
        jns     .drawUpLeft
745
        jmp     .nextPixel
5839 pathoswith 746
 
5665 Pathoswith 747
.upLeftHigh:
748
        imul    ecx, esi
749
        shl     ecx, 2
750
        add     edi, ecx
751
        mov     ecx, esi
752
        dec     ecx
753
        dec     ecx
754
.drawUpLeftHigh:
755
        mov     eax, ecx
756
@@:
757
        mov     [edi+eax*4], ebp
758
        dec     eax
759
        jns     @b
760
        add     edi, [esp+20+widthX]
761
        mov     eax, ecx
762
@@:
763
        mov     [edi+eax*4], ebp
764
        dec     eax
765
        jns     @b
766
        add     edi, [esp+20+widthX]
767
        dec     ecx
768
        jns     .drawUpLeftHigh
769
.nextPixel:
770
        bsf     eax, edx
771
        btr     edx, eax
772
        pop     edi
773
        jmp     .raw
5839 pathoswith 774
 
5665 Pathoswith 775
.nextRaw:
2288 clevermous 776
        inc     ebx
5665 Pathoswith 777
        mov     eax, [esp+16+widthX]
778
        imul    eax, esi
779
        add     edi, eax
780
        dec     dword [esp+4]
781
        jnz     drawChar
782
        ret
2536 mario79 783
 
5847 pathoswith 784
antiAliasing:
785
        mov     bp, 3
786
@@:
787
        mov     cl, al
788
        mov     dl, bl
789
        lea     ecx, [ecx*2+ecx]
790
        add     ecx, edx
791
        shr     ecx, 2
792
        mov     al, cl
793
        ror     eax, 8
794
        ror     ebx, 8
795
        dec     bp
796
        jnz     @b
797
        ror     eax, 8
798
        ror     ebx, 8
799
        mov     ebp, ebx
800
        ret
801
 
5867 pathoswith 802
fontSmoothing   db  2   ; = 0, 1 or 2
803
fontSize        db  0   ; user mode setting
5665 Pathoswith 804
font1:
3415 esevece 805
  if lang eq sp
806
  file 'char_sp.mt'
3927 kaitz 807
  else if lang eq et
808
  file 'char_et.mt'
3415 esevece 809
  else
2640 mario79 810
  file 'char.mt'
3415 esevece 811
  end if
5665 Pathoswith 812
fontUni:
813
file 'charUni.mt'