Subversion Repositories Kolibri OS

Rev

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