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