Subversion Repositories Kolibri OS

Rev

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