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