Subversion Repositories Kolibri OS

Rev

Rev 5921 | Rev 6036 | 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: 5926 $
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
5681 leency 144
@@:
5921 pathoswith 145
        movzx   ebx, byte [esi]
5665 Pathoswith 146
        inc     esi
147
        test    bl, bl
148
        jz      .done
149
        jns     .valid
150
        shl     bx, 10
5681 leency 151
        jnc     @b
5665 Pathoswith 152
        mov     bl, [esi]
5921 pathoswith 153
        test    bl, bl
154
        jns     @b
5665 Pathoswith 155
        shl     bl, 2
5921 pathoswith 156
        jc      @b
157
        shr     bh, 2
5665 Pathoswith 158
        shr     bx, 2
159
        inc     esi
160
        cmp     bx, 1419
161
        jc      .valid
5921 pathoswith 162
        shl     bh, 4
5665 Pathoswith 163
        jns     @f
5921 pathoswith 164
.tail:
165
        mov     bl, [esi]
166
        shl     bl, 1
167
        jnc     @b
168
        js      @b
5665 Pathoswith 169
        inc     esi
5921 pathoswith 170
        shl     bh, 1
171
        js      .tail
5665 Pathoswith 172
@@:
173
        xor     ebx, ebx
174
.valid:
175
        pushd   esi edi 16
176
        shl     ebx, 4
177
        add     ebx, fontUni
178
        mov     esi, [esp+12+fontMultiplier]
179
        call    drawChar
180
        imul    esi, 8*4
181
        pop     edi
182
        pop     edi
183
        add     edi, esi
184
        pop     esi
185
        jmp     .drawUTF8
5839 pathoswith 186
 
5665 Pathoswith 187
.draw866:
188
        dec     dword [esp]
189
        js      .done
5921 pathoswith 190
        movzx   ebx, byte [esi]
5665 Pathoswith 191
        test    ebx, ebx
192
        jz      .done
193
        inc     esi
194
        pushd   esi edi 9
195
        lea     ebx, [ebx*8+ebx+font1]
196
        mov     esi, [esp+12+fontMultiplier]
197
        call    drawChar
198
        imul    esi, 6*4
199
        pop     edi
200
        pop     edi
201
        add     edi, esi
202
        pop     esi
203
        jmp     .draw866
5839 pathoswith 204
 
5867 pathoswith 205
.draw866toUni:
206
        dec     dword [esp]
207
        js      .done
5921 pathoswith 208
        movzx   eax, byte [esi]
5867 pathoswith 209
        test    eax, eax
210
        jz      .done
211
        call    ansi2uni_char
212
        shl     eax, 4
213
        lea     ebx, [eax+fontUni]
214
        inc     esi
215
        pushd   esi edi 16
216
        mov     esi, [esp+12+fontMultiplier]
217
        call    drawChar
218
        imul    esi, 8*4
219
        pop     edi
220
        pop     edi
221
        add     edi, esi
222
        pop     esi
223
        jmp     .draw866toUni
224
 
5665 Pathoswith 225
.done:
226
        mov     ecx, edi
227
        pop     eax eax eax esi edx ebx ebp ebp ebp
228
        mov     edi, [esp]
229
        test    edi, edi
230
        jnz     @f
231
        pop     eax
232
        ret
5839 pathoswith 233
@@:         ; redraw from buffer to screen
5665 Pathoswith 234
        push    eax
235
        sub     ecx, edi
236
        shr     ecx, 2
237
        add     edx, ecx
238
        inc     ecx
239
        push    ecx
240
        push    edi
241
.drawPicture:
242
        mov     eax, -1
243
        repz scasd
244
        jcxz    @f
245
        mov     eax, edx
246
        sub     eax, ecx
247
        push    ecx
248
        mov     ecx, [edi-4]
249
        xchg    esi, edi
2453 mario79 250
        call    __sys_putpixel
5665 Pathoswith 251
        xchg    esi, edi
2536 mario79 252
        pop     ecx
5665 Pathoswith 253
        jmp     .drawPicture
2536 mario79 254
@@:
5665 Pathoswith 255
        pop     edi
256
        mov     ecx, [esp]
257
        add     edi, [esp+4]
2288 clevermous 258
        inc     ebx
5665 Pathoswith 259
        push    edi
260
        dec     ebp
261
        jnz     .drawPicture
262
        add     esp, 12
263
        call    kernel_free
264
        ret
265
 
5839 pathoswith 266
; scaling/smoothing algorithm
5665 Pathoswith 267
drawChar:
5921 pathoswith 268
; ebp = font color
269
; esi = font multiplier
270
; edi -> buffer
271
; ebx -> char data
5665 Pathoswith 272
        mov     dl, [ebx]
273
.raw:
274
        bsf     eax, edx
275
        jz      .nextRaw
276
        imul    eax, esi
277
        shl     eax, 2
278
        push    edi
279
        add     edi, eax
280
        mov     ecx, esi
2288 clevermous 281
        dec     esi
5665 Pathoswith 282
        jnz     .square
283
        mov     [edi], ebp
284
        inc     esi
285
        cmp     [fontSmoothing], 0
286
        jz      .nextPixel
5847 pathoswith 287
.checkLeftSM:     ; smoothing
5665 Pathoswith 288
        bsf     eax, edx
289
        dec     eax
5847 pathoswith 290
        js      .checkRightSM
5665 Pathoswith 291
        bt      [ebx], eax
5847 pathoswith 292
        jc      .checkRightSM
5665 Pathoswith 293
        dec     eax
5847 pathoswith 294
        js      .checkLeftDownSM
5665 Pathoswith 295
        bt      [ebx], eax
5847 pathoswith 296
        jc      .checkRightSM
297
.checkLeftDownSM:
5665 Pathoswith 298
        inc     eax
299
        bt      [ebx+1], eax
5847 pathoswith 300
        jnc     .checkLeftUpSM
5665 Pathoswith 301
        inc     eax
302
        bt      [ebx+1], eax
303
        jnc     @f
304
        bt      [ebx-1], eax
5847 pathoswith 305
        jc      .checkRightSM
5665 Pathoswith 306
        dec     eax
307
        dec     eax
308
        js      @f
309
        bt      [ebx+1], eax
310
        jnc     @f
311
        inc     eax
5847 pathoswith 312
.checkLeftUpSM:
5665 Pathoswith 313
        bt      [ebx-1], eax
5847 pathoswith 314
        jnc     .checkRightSM
5665 Pathoswith 315
        inc     eax
316
        bt      [ebx-1], eax
317
        jnc     @f
318
        bt      [ebx+1], eax
5847 pathoswith 319
        jc      .checkRightSM
5665 Pathoswith 320
        dec     eax
321
        dec     eax
322
        js      @f
323
        bt      [ebx-1], eax
5847 pathoswith 324
        jc      .checkRightSM
5665 Pathoswith 325
@@:
326
        mov     ecx, [esp+20+deltaToScreen]
327
        mov     eax, [edi-4]
328
        test    ecx, ecx
2536 mario79 329
        jz      @f
5665 Pathoswith 330
        pusha
331
        lea     ebx, [edi+ecx-4]
332
        shr     ebx, 2
333
        call    syscall_getpixel
334
        popa
2536 mario79 335
@@:
5839 pathoswith 336
        push    ebx edx
337
        mov     ebx, ebp
338
        xor     ecx, ecx
5847 pathoswith 339
        cmp     [fontSmoothing], 1
340
        jnz     .subpixelLeft
341
        call    antiAliasing
342
        jmp     @f
343
.subpixelLeft:
5839 pathoswith 344
        mov     cl, bl
345
        lea     edx, [ecx*8+ecx]
346
        lea     edx, [ecx*2+edx]
347
        mov     cl, al
348
        lea     ecx, [ecx*4+ecx]
349
        add     edx, ecx
350
        shr     edx, 4
351
        mov     al, dl
352
 
353
        xor     ecx, ecx
354
        mov     cl, ah
355
        lea     edx, [ecx*8+ecx]
356
        lea     edx, [ecx*2+edx]
357
        mov     cl, bh
358
        lea     ecx, [ecx*4+ecx]
359
        add     edx, ecx
360
        shr     edx, 4
361
        mov     ah, dl
362
 
363
        rol     eax, 16
364
        rol     ebx, 16
365
        xor     ecx, ecx
366
        mov     cl, al
367
        mov     edx, ecx
368
        shl     ecx, 3
369
        sub     ecx, edx
370
        mov     dl, bl
371
        add     ecx, edx
372
        shr     ecx, 3
373
        mov     al, cl
374
        rol     eax, 16
5847 pathoswith 375
@@:
5665 Pathoswith 376
        mov     [edi-4], eax
5839 pathoswith 377
        pop     edx ebx
5847 pathoswith 378
.checkRightSM:
5665 Pathoswith 379
        bsf     eax, edx
380
        inc     eax
381
        bt      [ebx], eax
382
        jc      .nextPixel
383
        inc     eax
384
        bt      [ebx], eax
385
        jc      .nextPixel
386
        dec     eax
5847 pathoswith 387
.checkRightDownSM:
5665 Pathoswith 388
        bt      [ebx+1], eax
5847 pathoswith 389
        jnc     .checkRightUpSM
5665 Pathoswith 390
        dec     eax
391
        bt      [ebx+1], eax
392
        jnc     @f
393
        bt      [ebx-1], eax
394
        jc      .nextPixel
395
        inc     eax
396
        inc     eax
397
        bt      [ebx+1], eax
398
        jnc     @f
399
        dec     eax
5847 pathoswith 400
.checkRightUpSM:
5665 Pathoswith 401
        bt      [ebx-1], eax
402
        jnc     .nextPixel
403
        dec     eax
404
        bt      [ebx-1], eax
405
        jnc     @f
406
        bt      [ebx+1], eax
407
        jc      .nextPixel
408
        inc     eax
409
        inc     eax
410
        bt      [ebx-1], eax
411
        jc      .nextPixel
412
@@:
413
        mov     ecx, [esp+20+deltaToScreen]
414
        mov     eax, [edi+4]
415
        test    ecx, ecx
2536 mario79 416
        jz      @f
5665 Pathoswith 417
        pusha
418
        lea     ebx, [edi+ecx+4]
419
        shr     ebx, 2
420
        call    syscall_getpixel
421
        popa
2536 mario79 422
@@:
5839 pathoswith 423
        push    ebx edx
424
        mov     ebx, ebp
425
        xor     ecx, ecx
5847 pathoswith 426
        cmp     [fontSmoothing], 1
427
        jnz     .subpixelRight
428
        call    antiAliasing
429
        jmp     @f
430
.subpixelRight:
5839 pathoswith 431
        mov     cl, al
432
        mov     edx, ecx
433
        shl     ecx, 3
434
        sub     ecx, edx
435
        mov     dl, bl
436
        add     ecx, edx
437
        shr     ecx, 3
5665 Pathoswith 438
        mov     al, cl
5839 pathoswith 439
 
440
        xor     ecx, ecx
441
        mov     cl, ah
442
        lea     edx, [ecx*8+ecx]
443
        lea     edx, [ecx*2+edx]
444
        mov     cl, bh
445
        lea     ecx, [ecx*4+ecx]
446
        add     edx, ecx
447
        shr     edx, 4
448
        mov     ah, dl
449
 
450
        rol     ebx, 16
451
        rol     eax, 16
452
        xor     ecx, ecx
453
        mov     cl, bl
454
        lea     edx, [ecx*8+ecx]
455
        lea     edx, [ecx*2+edx]
456
        mov     cl, al
457
        lea     ecx, [ecx*4+ecx]
458
        add     edx, ecx
459
        shr     edx, 4
460
        mov     al, dl
461
        rol     eax, 16
5847 pathoswith 462
@@:
5665 Pathoswith 463
        mov     [edi+4], eax
5839 pathoswith 464
        pop     edx ebx
5665 Pathoswith 465
        jmp     .nextPixel
5839 pathoswith 466
 
467
.square:    ; scaling
5665 Pathoswith 468
        mov     eax, esi
469
@@:
470
        mov     [edi+eax*4], ebp
471
        dec     eax
472
        jns     @b
473
        add     edi, [esp+20+widthX]
474
        dec     ecx
475
        jnz     .square
476
        inc     esi
477
        mov     edi, [esp]
478
.checkLeft:
479
        bsf     eax, edx
480
        dec     eax
481
        js      .checkRight
482
        bt      [ebx], eax
483
        jc      .checkRight
484
.checkLeftDown:
485
        bt      [ebx+1], eax
486
        jnc     .checkLeftUp
487
        mov     ecx, eax
2288 clevermous 488
        inc     eax
5665 Pathoswith 489
        bt      [ebx+1], eax
490
        jc      @f
491
        bt      [ebx-1], eax
492
        jnc     .downRightLow
493
        bt      [ebx-2], eax
494
        jc      .downRightLow
495
        dec     eax
496
        bt      [ebx-1], eax
497
        jc      .downRightLow
498
        dec     eax
499
        js      .downRightHigh
500
        bt      [ebx-2], eax
501
        jc      .downRightLow
502
        jmp     .downRightHigh
5839 pathoswith 503
 
5665 Pathoswith 504
@@:
505
        bt      [ebx-1], eax
506
        jc      .checkLeftUp
507
        dec     eax
508
        dec     eax
509
        js      .downRightLow
510
        bt      [ebx+1], eax
511
        jc      .checkLeftUp
512
.downRightLow:
513
        imul    ecx, esi
514
        shl     ecx, 2
515
        add     edi, ecx
2288 clevermous 516
        dec     esi
5665 Pathoswith 517
        mov     eax, [esp+20+widthX]
518
        imul    eax, esi
519
        add     edi, eax
520
        add     edi, 4
521
        mov     ecx, esi
522
        dec     ecx
523
.drawDownRight:
524
        mov     eax, ecx
525
@@:
526
        mov     [edi+eax*4], ebp
527
        dec     eax
528
        jns     @b
529
        sub     edi, [esp+20+widthX]
530
        add     edi, 4
531
        dec     ecx
532
        jns     .drawDownRight
533
        inc     esi
534
        mov     edi, [esp]
535
        jmp     .checkLeftUp
5839 pathoswith 536
 
5665 Pathoswith 537
.downRightHigh:
538
        imul    ecx, esi
539
        shl     ecx, 2
540
        add     edi, ecx
541
        dec     esi
542
        mov     eax, [esp+20+widthX]
543
        imul    eax, esi
544
        add     edi, eax
545
        add     edi, 4
546
        mov     ecx, esi
547
        dec     ecx
548
.drawDownRightHigh:
549
        mov     eax, ecx
550
@@:
551
        mov     [edi+eax*4], ebp
552
        dec     eax
553
        jns     @b
554
        sub     edi, [esp+20+widthX]
555
        mov     eax, ecx
556
@@:
557
        mov     [edi+eax*4], ebp
558
        dec     eax
559
        jns     @b
560
        sub     edi, [esp+20+widthX]
561
        add     edi, 4
562
        dec     ecx
563
        jns     .drawDownRightHigh
564
        inc     esi
565
        mov     edi, [esp]
566
.checkLeftUp:
567
        bsf     eax, edx
568
        dec     eax
569
        bt      [ebx-1], eax
570
        jnc     .checkRight
571
        mov     ecx, eax
572
        inc     eax
573
        bt      [ebx-1], eax
574
        jc      @f
575
        bt      [ebx+1], eax
576
        jnc     .upRightLow
577
        bt      [ebx+2], eax
578
        jc      .upRightLow
579
        dec     eax
580
        bt      [ebx+1], eax
581
        jc      .upRightLow
582
        dec     eax
583
        js      .upRightHigh
584
        bt      [ebx+2], eax
585
        jc      .upRightLow
586
        jmp     .upRightHigh
5839 pathoswith 587
 
5665 Pathoswith 588
@@:
589
        bt      [ebx+1], eax
590
        jc      .checkRight
591
        dec     eax
592
        dec     eax
593
        js      .upRightLow
594
        bt      [ebx-1], eax
595
        jc      .checkRight
596
.upRightLow:
597
        imul    ecx, esi
598
        shl     ecx, 2
599
        add     edi, ecx
600
        add     edi, 4
601
        mov     ecx, esi
602
        dec     ecx
603
        dec     ecx
604
.drawUpRight:
605
        mov     eax, ecx
606
@@:
607
        mov     [edi+eax*4], ebp
608
        dec     eax
609
        jns     @b
610
        add     edi, [esp+20+widthX]
611
        add     edi, 4
612
        dec     ecx
613
        jns     .drawUpRight
614
        mov     edi, [esp]
615
        jmp     .checkRight
5839 pathoswith 616
 
5665 Pathoswith 617
.upRightHigh:
618
        imul    ecx, esi
619
        shl     ecx, 2
620
        add     edi, ecx
621
        add     edi, 4
622
        mov     ecx, esi
623
        dec     ecx
624
        dec     ecx
625
.drawUpRightHigh:
626
        mov     eax, ecx
627
@@:
628
        mov     [edi+eax*4], ebp
629
        dec     eax
630
        jns     @b
631
        add     edi, [esp+20+widthX]
632
        mov     eax, ecx
633
@@:
634
        mov     [edi+eax*4], ebp
635
        dec     eax
636
        jns     @b
637
        add     edi, [esp+20+widthX]
638
        add     edi, 4
639
        dec     ecx
640
        jns     .drawUpRightHigh
641
        mov     edi, [esp]
642
.checkRight:
643
        bsf     eax, edx
644
        inc     eax
645
        bt      [ebx], eax
646
        jc      .nextPixel
647
.checkRightDown:
648
        bt      [ebx+1], eax
649
        jnc     .checkRightUp
650
        mov     ecx, eax
651
        dec     eax
652
        bt      [ebx+1], eax
653
        jc      @f
654
        bt      [ebx-1], eax
655
        jnc     .downLeftLow
656
        bt      [ebx-2], eax
657
        jc      .downLeftLow
658
        inc     eax
659
        bt      [ebx-1], eax
660
        jc      .downLeftLow
661
        inc     eax
662
        bt      [ebx-2], eax
663
        jc      .downLeftLow
664
        jmp     .downLeftHigh
5839 pathoswith 665
 
5665 Pathoswith 666
@@:
667
        bt      [ebx-1], eax
668
        jc      .checkRightUp
669
        inc     eax
670
        inc     eax
671
        bt      [ebx+1], eax
672
        jc      .checkRightUp
673
.downLeftLow:
674
        imul    ecx, esi
675
        shl     ecx, 2
676
        add     edi, ecx
677
        dec     esi
678
        mov     eax, [esp+20+widthX]
679
        imul    eax, esi
680
        add     edi, eax
681
        mov     ecx, esi
682
        dec     ecx
683
.drawDownLeft:
684
        mov     eax, ecx
685
@@:
686
        mov     [edi+eax*4], ebp
687
        dec     eax
688
        jns     @b
689
        sub     edi, [esp+20+widthX]
690
        dec     ecx
691
        jns     .drawDownLeft
692
        inc     esi
693
        mov     edi, [esp]
694
        jmp     .checkRightUp
5839 pathoswith 695
 
5665 Pathoswith 696
.downLeftHigh:
697
        imul    ecx, esi
698
        shl     ecx, 2
699
        add     edi, ecx
700
        dec     esi
701
        mov     eax, [esp+20+widthX]
702
        imul    eax, esi
703
        add     edi, eax
704
        mov     ecx, esi
705
        dec     ecx
706
.drawDownLeftHigh:
707
        mov     eax, ecx
708
@@:
709
        mov     [edi+eax*4], ebp
710
        dec     eax
711
        jns     @b
712
        sub     edi, [esp+20+widthX]
713
        mov     eax, ecx
714
@@:
715
        mov     [edi+eax*4], ebp
716
        dec     eax
717
        jns     @b
718
        sub     edi, [esp+20+widthX]
719
        dec     ecx
720
        jns     .drawDownLeftHigh
721
        inc     esi
722
        mov     edi, [esp]
723
.checkRightUp:
724
        bsf     eax, edx
725
        inc     eax
726
        bt      [ebx-1], eax
727
        jnc     .nextPixel
728
        mov     ecx, eax
729
        dec     eax
730
        bt      [ebx-1], eax
731
        jc      @f
732
        bt      [ebx+1], eax
733
        jnc     .upLeftLow
734
        bt      [ebx+2], eax
735
        jc      .upLeftLow
736
        inc     eax
737
        bt      [ebx+1], eax
738
        jc      .upLeftLow
739
        inc     eax
740
        bt      [ebx+2], eax
741
        jc      .upLeftLow
742
        jmp     .upLeftHigh
5839 pathoswith 743
 
5665 Pathoswith 744
@@:
745
        bt      [ebx+1], eax
746
        jc      .nextPixel
747
        inc     eax
748
        inc     eax
749
        bt      [ebx-1], eax
750
        jc      .nextPixel
751
.upLeftLow:
752
        imul    ecx, esi
753
        shl     ecx, 2
754
        add     edi, ecx
755
        mov     ecx, esi
756
        dec     ecx
757
        dec     ecx
758
.drawUpLeft:
759
        mov     eax, ecx
760
@@:
761
        mov     [edi+eax*4], ebp
762
        dec     eax
763
        jns     @b
764
        add     edi, [esp+20+widthX]
765
        dec     ecx
766
        jns     .drawUpLeft
767
        jmp     .nextPixel
5839 pathoswith 768
 
5665 Pathoswith 769
.upLeftHigh:
770
        imul    ecx, esi
771
        shl     ecx, 2
772
        add     edi, ecx
773
        mov     ecx, esi
774
        dec     ecx
775
        dec     ecx
776
.drawUpLeftHigh:
777
        mov     eax, ecx
778
@@:
779
        mov     [edi+eax*4], ebp
780
        dec     eax
781
        jns     @b
782
        add     edi, [esp+20+widthX]
783
        mov     eax, ecx
784
@@:
785
        mov     [edi+eax*4], ebp
786
        dec     eax
787
        jns     @b
788
        add     edi, [esp+20+widthX]
789
        dec     ecx
790
        jns     .drawUpLeftHigh
791
.nextPixel:
792
        bsf     eax, edx
793
        btr     edx, eax
794
        pop     edi
795
        jmp     .raw
5839 pathoswith 796
 
5665 Pathoswith 797
.nextRaw:
2288 clevermous 798
        inc     ebx
5665 Pathoswith 799
        mov     eax, [esp+16+widthX]
800
        imul    eax, esi
801
        add     edi, eax
802
        dec     dword [esp+4]
803
        jnz     drawChar
804
        ret
2536 mario79 805
 
5847 pathoswith 806
antiAliasing:
807
        mov     bp, 3
808
@@:
809
        mov     cl, al
810
        mov     dl, bl
811
        lea     ecx, [ecx*2+ecx]
812
        add     ecx, edx
813
        shr     ecx, 2
814
        mov     al, cl
815
        ror     eax, 8
816
        ror     ebx, 8
817
        dec     bp
818
        jnz     @b
819
        ror     eax, 8
820
        ror     ebx, 8
821
        mov     ebp, ebx
822
        ret
823
 
5867 pathoswith 824
fontSmoothing   db  2   ; = 0, 1 or 2
825
fontSize        db  0   ; user mode setting
5665 Pathoswith 826
font1:
3415 esevece 827
  if lang eq sp
828
  file 'char_sp.mt'
3927 kaitz 829
  else if lang eq et
830
  file 'char_et.mt'
3415 esevece 831
  else
2640 mario79 832
  file 'char.mt'
3415 esevece 833
  end if
5665 Pathoswith 834
fontUni:
835
file 'charUni.mt'