Rev 5867 | Rev 5926 | 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: 5921 $ |
||
9 | |||
5665 | Pathoswith | 10 | dtext_asciiz_esi: |
11 | btr ecx, 31 |
||
2536 | mario79 | 12 | dtext: |
5665 | Pathoswith | 13 | ; edx -> string |
14 | ; esi = number of characters |
||
15 | ; ebx = output coordinates XXXXYYYY h |
||
16 | ; ecx = char color and flags flRRGGBB h |
||
17 | ; fl = ZBFFRSSS b |
||
18 | ; Z=1: edx -> zero terminated string, esi = ? |
||
19 | ; B=1: fill background with color eax |
||
20 | ; R=1: edi -> user area for redirect |
||
5867 | pathoswith | 21 | ; FF=3: UTF-8 8x16, FF=2: UTF-16LE 8x16 |
22 | ; FF=1: cp866 8x16, FF=0: cp866 6x9 |
||
5665 | Pathoswith | 23 | ; SSS = (font multiplier)-1 |
24 | ; edi=1: force output |
||
25 | and eax, 0xFFFFFF |
||
26 | bt ecx, 30 |
||
27 | jc @f |
||
2288 | clevermous | 28 | xor eax, eax |
5665 | Pathoswith | 29 | dec eax |
30 | @@: |
||
31 | pushd 0 0 0 eax |
||
32 | movsx eax, bx |
||
33 | sar ebx, 16 |
||
34 | push eax ebx edi |
||
35 | bt ecx, 27 |
||
36 | jc .redirect |
||
37 | mov ebp, [_display.width] |
||
38 | xor edi, edi |
||
2288 | clevermous | 39 | jmp @f |
5839 | pathoswith | 40 | .ret: |
41 | add esp, 28 |
||
42 | ret |
||
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 |
||
93 | xor edx, edx |
||
94 | bt ebx, 29 |
||
5867 | pathoswith | 95 | jc @f |
5665 | Pathoswith | 96 | bt ebx, 28 |
5867 | pathoswith | 97 | jc .draw866toUni |
98 | jmp .draw866 |
||
99 | @@: |
||
100 | bt ebx, 28 |
||
5665 | Pathoswith | 101 | jc .drawUTF8 |
2536 | mario79 | 102 | |
5921 | pathoswith | 103 | ; ebp = font color |
104 | ; esi -> string |
||
105 | ; edi -> buffer |
||
106 | |||
5839 | pathoswith | 107 | ; Stack map: |
5665 | Pathoswith | 108 | ; char counter +0 |
109 | fontMultiplier = 4 |
||
110 | widthX = 8 |
||
111 | ; edi +12 |
||
112 | ; X +16 |
||
113 | ; Y +20 |
||
114 | ; background +24 |
||
115 | deltaToScreen = 28 |
||
116 | ; temp buffer height +32 |
||
5839 | pathoswith | 117 | ; temp buffer pointer +36 |
2536 | mario79 | 118 | |
5665 | Pathoswith | 119 | .drawUTF16: |
120 | dec dword [esp] |
||
121 | js .done |
||
5921 | pathoswith | 122 | movzx ebx, word [esi] |
5665 | Pathoswith | 123 | test ebx, ebx |
124 | jz .done |
||
125 | inc esi |
||
126 | inc esi |
||
127 | cmp bx, 1419 |
||
128 | jc @f |
||
129 | xor ebx, ebx |
||
2536 | mario79 | 130 | @@: |
5665 | Pathoswith | 131 | pushd esi edi 16 |
132 | shl ebx, 4 |
||
133 | add ebx, fontUni |
||
134 | mov esi, [esp+12+fontMultiplier] |
||
135 | call drawChar |
||
136 | imul esi, 8*4 |
||
137 | pop edi |
||
138 | pop edi |
||
139 | add edi, esi |
||
140 | pop esi |
||
141 | jmp .drawUTF16 |
||
5839 | pathoswith | 142 | |
5665 | Pathoswith | 143 | .drawUTF8: |
144 | dec dword [esp] |
||
145 | js .done |
||
5681 | leency | 146 | @@: |
5921 | pathoswith | 147 | movzx ebx, byte [esi] |
5665 | Pathoswith | 148 | inc esi |
149 | test bl, bl |
||
150 | jz .done |
||
151 | jns .valid |
||
152 | shl bx, 10 |
||
5681 | leency | 153 | jnc @b |
5665 | Pathoswith | 154 | mov bl, [esi] |
5921 | pathoswith | 155 | test bl, bl |
156 | jns @b |
||
5665 | Pathoswith | 157 | shl bl, 2 |
5921 | pathoswith | 158 | jc @b |
159 | shr bh, 2 |
||
5665 | Pathoswith | 160 | shr bx, 2 |
161 | inc esi |
||
162 | cmp bx, 1419 |
||
163 | jc .valid |
||
5921 | pathoswith | 164 | shl bh, 4 |
5665 | Pathoswith | 165 | jns @f |
5921 | pathoswith | 166 | .tail: |
167 | mov bl, [esi] |
||
168 | shl bl, 1 |
||
169 | jnc @b |
||
170 | js @b |
||
5665 | Pathoswith | 171 | inc esi |
5921 | pathoswith | 172 | shl bh, 1 |
173 | js .tail |
||
5665 | Pathoswith | 174 | @@: |
175 | xor ebx, ebx |
||
176 | .valid: |
||
177 | pushd esi edi 16 |
||
178 | shl ebx, 4 |
||
179 | add ebx, fontUni |
||
180 | mov esi, [esp+12+fontMultiplier] |
||
181 | call drawChar |
||
182 | imul esi, 8*4 |
||
183 | pop edi |
||
184 | pop edi |
||
185 | add edi, esi |
||
186 | pop esi |
||
187 | jmp .drawUTF8 |
||
5839 | pathoswith | 188 | |
5665 | Pathoswith | 189 | .draw866: |
190 | dec dword [esp] |
||
191 | js .done |
||
5921 | pathoswith | 192 | movzx ebx, byte [esi] |
5665 | Pathoswith | 193 | test ebx, ebx |
194 | jz .done |
||
195 | inc esi |
||
196 | pushd esi edi 9 |
||
197 | lea ebx, [ebx*8+ebx+font1] |
||
198 | mov esi, [esp+12+fontMultiplier] |
||
199 | call drawChar |
||
200 | imul esi, 6*4 |
||
201 | pop edi |
||
202 | pop edi |
||
203 | add edi, esi |
||
204 | pop esi |
||
205 | jmp .draw866 |
||
5839 | pathoswith | 206 | |
5867 | pathoswith | 207 | .draw866toUni: |
208 | dec dword [esp] |
||
209 | js .done |
||
5921 | pathoswith | 210 | movzx eax, byte [esi] |
5867 | pathoswith | 211 | test eax, eax |
212 | jz .done |
||
213 | call ansi2uni_char |
||
214 | shl eax, 4 |
||
215 | lea ebx, [eax+fontUni] |
||
216 | inc esi |
||
217 | pushd esi edi 16 |
||
218 | mov esi, [esp+12+fontMultiplier] |
||
219 | call drawChar |
||
220 | imul esi, 8*4 |
||
221 | pop edi |
||
222 | pop edi |
||
223 | add edi, esi |
||
224 | pop esi |
||
225 | jmp .draw866toUni |
||
226 | |||
5665 | Pathoswith | 227 | .done: |
228 | mov ecx, edi |
||
229 | pop eax eax eax esi edx ebx ebp ebp ebp |
||
230 | mov edi, [esp] |
||
231 | test edi, edi |
||
232 | jnz @f |
||
233 | pop eax |
||
234 | ret |
||
5839 | pathoswith | 235 | @@: ; redraw from buffer to screen |
5665 | Pathoswith | 236 | push eax |
237 | sub ecx, edi |
||
238 | shr ecx, 2 |
||
239 | add edx, ecx |
||
240 | inc ecx |
||
241 | push ecx |
||
242 | push edi |
||
243 | .drawPicture: |
||
244 | mov eax, -1 |
||
245 | repz scasd |
||
246 | jcxz @f |
||
247 | mov eax, edx |
||
248 | sub eax, ecx |
||
249 | push ecx |
||
250 | mov ecx, [edi-4] |
||
251 | xchg esi, edi |
||
2453 | mario79 | 252 | call __sys_putpixel |
5665 | Pathoswith | 253 | xchg esi, edi |
2536 | mario79 | 254 | pop ecx |
5665 | Pathoswith | 255 | jmp .drawPicture |
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 |
||
345 | .subpixelLeft: |
||
5839 | pathoswith | 346 | mov cl, bl |
347 | lea edx, [ecx*8+ecx] |
||
348 | lea edx, [ecx*2+edx] |
||
349 | mov cl, al |
||
350 | lea ecx, [ecx*4+ecx] |
||
351 | add edx, ecx |
||
352 | shr edx, 4 |
||
353 | mov al, dl |
||
354 | |||
355 | xor ecx, ecx |
||
356 | mov cl, ah |
||
357 | lea edx, [ecx*8+ecx] |
||
358 | lea edx, [ecx*2+edx] |
||
359 | mov cl, bh |
||
360 | lea ecx, [ecx*4+ecx] |
||
361 | add edx, ecx |
||
362 | shr edx, 4 |
||
363 | mov ah, dl |
||
364 | |||
365 | rol eax, 16 |
||
366 | rol ebx, 16 |
||
367 | xor ecx, ecx |
||
368 | mov cl, al |
||
369 | mov edx, ecx |
||
370 | shl ecx, 3 |
||
371 | sub ecx, edx |
||
372 | mov dl, bl |
||
373 | add ecx, edx |
||
374 | shr ecx, 3 |
||
375 | mov al, cl |
||
376 | rol eax, 16 |
||
5847 | pathoswith | 377 | @@: |
5665 | Pathoswith | 378 | mov [edi-4], eax |
5839 | pathoswith | 379 | pop edx ebx |
5847 | pathoswith | 380 | .checkRightSM: |
5665 | Pathoswith | 381 | bsf eax, edx |
382 | inc eax |
||
383 | bt [ebx], eax |
||
384 | jc .nextPixel |
||
385 | inc eax |
||
386 | bt [ebx], eax |
||
387 | jc .nextPixel |
||
388 | dec eax |
||
5847 | pathoswith | 389 | .checkRightDownSM: |
5665 | Pathoswith | 390 | bt [ebx+1], eax |
5847 | pathoswith | 391 | jnc .checkRightUpSM |
5665 | Pathoswith | 392 | dec eax |
393 | bt [ebx+1], eax |
||
394 | jnc @f |
||
395 | bt [ebx-1], eax |
||
396 | jc .nextPixel |
||
397 | inc eax |
||
398 | inc eax |
||
399 | bt [ebx+1], eax |
||
400 | jnc @f |
||
401 | dec eax |
||
5847 | pathoswith | 402 | .checkRightUpSM: |
5665 | Pathoswith | 403 | bt [ebx-1], eax |
404 | jnc .nextPixel |
||
405 | dec eax |
||
406 | bt [ebx-1], eax |
||
407 | jnc @f |
||
408 | bt [ebx+1], eax |
||
409 | jc .nextPixel |
||
410 | inc eax |
||
411 | inc eax |
||
412 | bt [ebx-1], eax |
||
413 | jc .nextPixel |
||
414 | @@: |
||
415 | mov ecx, [esp+20+deltaToScreen] |
||
416 | mov eax, [edi+4] |
||
417 | test ecx, ecx |
||
2536 | mario79 | 418 | jz @f |
5665 | Pathoswith | 419 | pusha |
420 | lea ebx, [edi+ecx+4] |
||
421 | shr ebx, 2 |
||
422 | call syscall_getpixel |
||
423 | popa |
||
2536 | mario79 | 424 | @@: |
5839 | pathoswith | 425 | push ebx edx |
426 | mov ebx, ebp |
||
427 | xor ecx, ecx |
||
5847 | pathoswith | 428 | cmp [fontSmoothing], 1 |
429 | jnz .subpixelRight |
||
430 | call antiAliasing |
||
431 | jmp @f |
||
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' |