Rev 5681 | Rev 5847 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5681 | Rev 5839 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 7... | Line 7... | ||
7 | 7 | ||
Line 8... | Line 8... | ||
8 | $Revision: 5681 $ |
8 | $Revision: 5839 $ |
9 | 9 | ||
10 | dtext_asciiz_esi: |
10 | dtext_asciiz_esi: |
11 | btr ecx, 31 |
11 | btr ecx, 31 |
Line 34... | Line 34... | ||
34 | bt ecx, 27 |
34 | bt ecx, 27 |
35 | jc .redirect |
35 | jc .redirect |
36 | mov ebp, [_display.width] |
36 | mov ebp, [_display.width] |
37 | xor edi, edi |
37 | xor edi, edi |
38 | jmp @f |
38 | jmp @f |
- | 39 | .ret: |
|
- | 40 | add esp, 28 |
|
- | 41 | ret |
|
39 | .redirect: |
42 | .redirect: |
40 | mov ebp, [edi] |
43 | mov ebp, [edi] |
41 | add edi, 8 |
44 | add edi, 8 |
42 | @@: |
45 | @@: |
43 | shl ebp, 2 |
46 | shl ebp, 2 |
Line 90... | Line 93... | ||
90 | bt ebx, 29 |
93 | bt ebx, 29 |
91 | jnc .draw866 |
94 | jnc .draw866 |
92 | bt ebx, 28 |
95 | bt ebx, 28 |
93 | jc .drawUTF8 |
96 | jc .drawUTF8 |
Line -... | Line 97... | ||
- | 97 | ||
94 | 98 | ; Stack map: |
|
95 | ; char counter +0 |
99 | ; char counter +0 |
96 | fontMultiplier = 4 |
100 | fontMultiplier = 4 |
97 | widthX = 8 |
101 | widthX = 8 |
98 | ; edi +12 |
102 | ; edi +12 |
99 | ; X +16 |
103 | ; X +16 |
100 | ; Y +20 |
104 | ; Y +20 |
101 | ; background +24 |
105 | ; background +24 |
102 | deltaToScreen = 28 |
106 | deltaToScreen = 28 |
103 | ; temp buffer height +32 |
107 | ; temp buffer height +32 |
Line 104... | Line 108... | ||
104 | ; temp buffer +36 |
108 | ; temp buffer pointer +36 |
105 | 109 | ||
106 | .drawUTF16: |
110 | .drawUTF16: |
107 | dec dword [esp] |
111 | dec dword [esp] |
Line 125... | Line 129... | ||
125 | pop edi |
129 | pop edi |
126 | pop edi |
130 | pop edi |
127 | add edi, esi |
131 | add edi, esi |
128 | pop esi |
132 | pop esi |
129 | jmp .drawUTF16 |
133 | jmp .drawUTF16 |
- | 134 | ||
130 | .drawUTF8: |
135 | .drawUTF8: |
131 | dec dword [esp] |
136 | dec dword [esp] |
132 | js .done |
137 | js .done |
133 | @@: |
138 | @@: |
134 | xor ebx, ebx |
139 | xor ebx, ebx |
Line 164... | Line 169... | ||
164 | pop edi |
169 | pop edi |
165 | pop edi |
170 | pop edi |
166 | add edi, esi |
171 | add edi, esi |
167 | pop esi |
172 | pop esi |
168 | jmp .drawUTF8 |
173 | jmp .drawUTF8 |
- | 174 | ||
169 | .draw866: |
175 | .draw866: |
170 | dec dword [esp] |
176 | dec dword [esp] |
171 | js .done |
177 | js .done |
172 | xor ebx, ebx |
178 | xor ebx, ebx |
173 | mov bl, [esi] |
179 | mov bl, [esi] |
Line 182... | Line 188... | ||
182 | pop edi |
188 | pop edi |
183 | pop edi |
189 | pop edi |
184 | add edi, esi |
190 | add edi, esi |
185 | pop esi |
191 | pop esi |
186 | jmp .draw866 |
192 | jmp .draw866 |
- | 193 | ||
187 | .done: |
194 | .done: |
188 | mov ecx, edi |
195 | mov ecx, edi |
189 | pop eax eax eax esi edx ebx ebp ebp ebp |
196 | pop eax eax eax esi edx ebx ebp ebp ebp |
190 | mov edi, [esp] |
197 | mov edi, [esp] |
191 | test edi, edi |
198 | test edi, edi |
192 | jnz @f |
199 | jnz @f |
193 | pop eax |
200 | pop eax |
194 | ret |
201 | ret |
195 | @@: |
202 | @@: ; redraw from buffer to screen |
196 | push eax |
203 | push eax |
197 | sub ecx, edi |
204 | sub ecx, edi |
198 | shr ecx, 2 |
205 | shr ecx, 2 |
199 | add edx, ecx |
206 | add edx, ecx |
200 | inc ecx |
207 | inc ecx |
Line 222... | Line 229... | ||
222 | dec ebp |
229 | dec ebp |
223 | jnz .drawPicture |
230 | jnz .drawPicture |
224 | add esp, 12 |
231 | add esp, 12 |
225 | call kernel_free |
232 | call kernel_free |
226 | ret |
233 | ret |
227 | .ret: |
- | |
228 | add esp, 28 |
- | |
229 | ret |
- | |
Line -... | Line 234... | ||
- | 234 | ||
230 | 235 | ; scaling/smoothing algorithm |
|
231 | drawChar: |
236 | drawChar: |
232 | mov dl, [ebx] |
237 | mov dl, [ebx] |
233 | .raw: |
238 | .raw: |
234 | bsf eax, edx |
239 | bsf eax, edx |
Line 242... | Line 247... | ||
242 | jnz .square |
247 | jnz .square |
243 | mov [edi], ebp |
248 | mov [edi], ebp |
244 | inc esi |
249 | inc esi |
245 | cmp [fontSmoothing], 0 |
250 | cmp [fontSmoothing], 0 |
246 | jz .nextPixel |
251 | jz .nextPixel |
247 | .checkLeftSubP: |
252 | .checkLeftSubP: ; subpixel smoothing |
248 | bsf eax, edx |
253 | bsf eax, edx |
249 | dec eax |
254 | dec eax |
250 | js .checkRightSubP |
255 | js .checkRightSubP |
251 | bt [ebx], eax |
256 | bt [ebx], eax |
252 | jc .checkRightSubP |
257 | jc .checkRightSubP |
Line 291... | Line 296... | ||
291 | lea ebx, [edi+ecx-4] |
296 | lea ebx, [edi+ecx-4] |
292 | shr ebx, 2 |
297 | shr ebx, 2 |
293 | call syscall_getpixel |
298 | call syscall_getpixel |
294 | popa |
299 | popa |
295 | @@: |
300 | @@: |
- | 301 | push ebx edx |
|
296 | mov ecx, eax |
302 | mov ebx, ebp |
297 | mov eax, ebp |
303 | xor ecx, ecx |
298 | shr al, 1 |
304 | mov cl, bl |
- | 305 | lea edx, [ecx*8+ecx] |
|
- | 306 | lea edx, [ecx*2+edx] |
|
299 | shr cl, 1 |
307 | mov cl, al |
- | 308 | lea ecx, [ecx*4+ecx] |
|
300 | add al, cl |
309 | add edx, ecx |
301 | shr ah, 2 |
310 | shr edx, 4 |
- | 311 | mov al, dl |
|
- | 312 | ||
- | 313 | xor ecx, ecx |
|
302 | shr ch, 2 |
314 | mov cl, ah |
- | 315 | lea edx, [ecx*8+ecx] |
|
- | 316 | lea edx, [ecx*2+edx] |
|
303 | add ah, ch |
317 | mov cl, bh |
- | 318 | lea ecx, [ecx*4+ecx] |
|
304 | add ah, ch |
319 | add edx, ecx |
- | 320 | shr edx, 4 |
|
305 | add ah, ch |
321 | mov ah, dl |
- | 322 | ||
306 | ror eax, 8 |
323 | rol eax, 16 |
- | 324 | rol ebx, 16 |
|
- | 325 | xor ecx, ecx |
|
- | 326 | mov cl, al |
|
- | 327 | mov edx, ecx |
|
- | 328 | shl ecx, 3 |
|
- | 329 | sub ecx, edx |
|
- | 330 | mov dl, bl |
|
- | 331 | add ecx, edx |
|
307 | ror ecx, 8 |
332 | shr ecx, 3 |
308 | mov ah, ch |
333 | mov al, cl |
309 | rol eax, 8 |
334 | rol eax, 16 |
310 | mov [edi-4], eax |
335 | mov [edi-4], eax |
- | 336 | pop edx ebx |
|
311 | .checkRightSubP: |
337 | .checkRightSubP: |
312 | bsf eax, edx |
338 | bsf eax, edx |
313 | inc eax |
339 | inc eax |
314 | bt [ebx], eax |
340 | bt [ebx], eax |
315 | jc .nextPixel |
341 | jc .nextPixel |
Line 351... | Line 377... | ||
351 | lea ebx, [edi+ecx+4] |
377 | lea ebx, [edi+ecx+4] |
352 | shr ebx, 2 |
378 | shr ebx, 2 |
353 | call syscall_getpixel |
379 | call syscall_getpixel |
354 | popa |
380 | popa |
355 | @@: |
381 | @@: |
- | 382 | push ebx edx |
|
356 | mov ecx, eax |
383 | mov ebx, ebp |
- | 384 | xor ecx, ecx |
|
- | 385 | mov cl, al |
|
357 | mov eax, ebp |
386 | mov edx, ecx |
358 | shr ah, 2 |
387 | shl ecx, 3 |
359 | shr ch, 2 |
388 | sub ecx, edx |
360 | add ah, ch |
389 | mov dl, bl |
361 | add ah, ch |
390 | add ecx, edx |
362 | add ah, ch |
391 | shr ecx, 3 |
363 | mov al, cl |
392 | mov al, cl |
- | 393 | ||
364 | ror eax, 8 |
394 | xor ecx, ecx |
- | 395 | mov cl, ah |
|
- | 396 | lea edx, [ecx*8+ecx] |
|
- | 397 | lea edx, [ecx*2+edx] |
|
- | 398 | mov cl, bh |
|
- | 399 | lea ecx, [ecx*4+ecx] |
|
- | 400 | add edx, ecx |
|
365 | ror ecx, 8 |
401 | shr edx, 4 |
366 | shr ah, 1 |
402 | mov ah, dl |
- | 403 | ||
- | 404 | rol ebx, 16 |
|
- | 405 | rol eax, 16 |
|
- | 406 | xor ecx, ecx |
|
- | 407 | mov cl, bl |
|
- | 408 | lea edx, [ecx*8+ecx] |
|
- | 409 | lea edx, [ecx*2+edx] |
|
- | 410 | mov cl, al |
|
- | 411 | lea ecx, [ecx*4+ecx] |
|
- | 412 | add edx, ecx |
|
367 | shr ch, 1 |
413 | shr edx, 4 |
368 | add ah, ch |
414 | mov al, dl |
369 | rol eax, 8 |
415 | rol eax, 16 |
370 | mov [edi+4], eax |
416 | mov [edi+4], eax |
- | 417 | pop edx ebx |
|
371 | jmp .nextPixel |
418 | jmp .nextPixel |
- | 419 | ||
372 | .square: |
420 | .square: ; scaling |
373 | mov eax, esi |
421 | mov eax, esi |
374 | @@: |
422 | @@: |
375 | mov [edi+eax*4], ebp |
423 | mov [edi+eax*4], ebp |
376 | dec eax |
424 | dec eax |
377 | jns @b |
425 | jns @b |
Line 403... | Line 451... | ||
403 | dec eax |
451 | dec eax |
404 | js .downRightHigh |
452 | js .downRightHigh |
405 | bt [ebx-2], eax |
453 | bt [ebx-2], eax |
406 | jc .downRightLow |
454 | jc .downRightLow |
407 | jmp .downRightHigh |
455 | jmp .downRightHigh |
- | 456 | ||
408 | @@: |
457 | @@: |
409 | bt [ebx-1], eax |
458 | bt [ebx-1], eax |
410 | jc .checkLeftUp |
459 | jc .checkLeftUp |
411 | dec eax |
460 | dec eax |
412 | dec eax |
461 | dec eax |
Line 435... | Line 484... | ||
435 | dec ecx |
484 | dec ecx |
436 | jns .drawDownRight |
485 | jns .drawDownRight |
437 | inc esi |
486 | inc esi |
438 | mov edi, [esp] |
487 | mov edi, [esp] |
439 | jmp .checkLeftUp |
488 | jmp .checkLeftUp |
- | 489 | ||
440 | .downRightHigh: |
490 | .downRightHigh: |
441 | imul ecx, esi |
491 | imul ecx, esi |
442 | shl ecx, 2 |
492 | shl ecx, 2 |
443 | add edi, ecx |
493 | add edi, ecx |
444 | dec esi |
494 | dec esi |
Line 485... | Line 535... | ||
485 | dec eax |
535 | dec eax |
486 | js .upRightHigh |
536 | js .upRightHigh |
487 | bt [ebx+2], eax |
537 | bt [ebx+2], eax |
488 | jc .upRightLow |
538 | jc .upRightLow |
489 | jmp .upRightHigh |
539 | jmp .upRightHigh |
- | 540 | ||
490 | @@: |
541 | @@: |
491 | bt [ebx+1], eax |
542 | bt [ebx+1], eax |
492 | jc .checkRight |
543 | jc .checkRight |
493 | dec eax |
544 | dec eax |
494 | dec eax |
545 | dec eax |
Line 513... | Line 564... | ||
513 | add edi, 4 |
564 | add edi, 4 |
514 | dec ecx |
565 | dec ecx |
515 | jns .drawUpRight |
566 | jns .drawUpRight |
516 | mov edi, [esp] |
567 | mov edi, [esp] |
517 | jmp .checkRight |
568 | jmp .checkRight |
- | 569 | ||
518 | .upRightHigh: |
570 | .upRightHigh: |
519 | imul ecx, esi |
571 | imul ecx, esi |
520 | shl ecx, 2 |
572 | shl ecx, 2 |
521 | add edi, ecx |
573 | add edi, ecx |
522 | add edi, 4 |
574 | add edi, 4 |
Line 561... | Line 613... | ||
561 | jc .downLeftLow |
613 | jc .downLeftLow |
562 | inc eax |
614 | inc eax |
563 | bt [ebx-2], eax |
615 | bt [ebx-2], eax |
564 | jc .downLeftLow |
616 | jc .downLeftLow |
565 | jmp .downLeftHigh |
617 | jmp .downLeftHigh |
- | 618 | ||
566 | @@: |
619 | @@: |
567 | bt [ebx-1], eax |
620 | bt [ebx-1], eax |
568 | jc .checkRightUp |
621 | jc .checkRightUp |
569 | inc eax |
622 | inc eax |
570 | inc eax |
623 | inc eax |
Line 590... | Line 643... | ||
590 | dec ecx |
643 | dec ecx |
591 | jns .drawDownLeft |
644 | jns .drawDownLeft |
592 | inc esi |
645 | inc esi |
593 | mov edi, [esp] |
646 | mov edi, [esp] |
594 | jmp .checkRightUp |
647 | jmp .checkRightUp |
- | 648 | ||
595 | .downLeftHigh: |
649 | .downLeftHigh: |
596 | imul ecx, esi |
650 | imul ecx, esi |
597 | shl ecx, 2 |
651 | shl ecx, 2 |
598 | add edi, ecx |
652 | add edi, ecx |
599 | dec esi |
653 | dec esi |
Line 637... | Line 691... | ||
637 | jc .upLeftLow |
691 | jc .upLeftLow |
638 | inc eax |
692 | inc eax |
639 | bt [ebx+2], eax |
693 | bt [ebx+2], eax |
640 | jc .upLeftLow |
694 | jc .upLeftLow |
641 | jmp .upLeftHigh |
695 | jmp .upLeftHigh |
- | 696 | ||
642 | @@: |
697 | @@: |
643 | bt [ebx+1], eax |
698 | bt [ebx+1], eax |
644 | jc .nextPixel |
699 | jc .nextPixel |
645 | inc eax |
700 | inc eax |
646 | inc eax |
701 | inc eax |
Line 661... | Line 716... | ||
661 | jns @b |
716 | jns @b |
662 | add edi, [esp+20+widthX] |
717 | add edi, [esp+20+widthX] |
663 | dec ecx |
718 | dec ecx |
664 | jns .drawUpLeft |
719 | jns .drawUpLeft |
665 | jmp .nextPixel |
720 | jmp .nextPixel |
- | 721 | ||
666 | .upLeftHigh: |
722 | .upLeftHigh: |
667 | imul ecx, esi |
723 | imul ecx, esi |
668 | shl ecx, 2 |
724 | shl ecx, 2 |
669 | add edi, ecx |
725 | add edi, ecx |
670 | mov ecx, esi |
726 | mov ecx, esi |
Line 688... | Line 744... | ||
688 | .nextPixel: |
744 | .nextPixel: |
689 | bsf eax, edx |
745 | bsf eax, edx |
690 | btr edx, eax |
746 | btr edx, eax |
691 | pop edi |
747 | pop edi |
692 | jmp .raw |
748 | jmp .raw |
- | 749 | ||
693 | .nextRaw: |
750 | .nextRaw: |
694 | inc ebx |
751 | inc ebx |
695 | mov eax, [esp+16+widthX] |
752 | mov eax, [esp+16+widthX] |
696 | imul eax, esi |
753 | imul eax, esi |
697 | add edi, eax |
754 | add edi, eax |