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