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