2011-10-14 23:38:50 +02:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; ;;
|
2015-01-08 21:10:22 +01:00
|
|
|
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
2011-10-14 23:38:50 +02:00
|
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
|
|
;; ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
$Revision$
|
|
|
|
|
2015-08-03 14:38:30 +02:00
|
|
|
dtext_asciiz_esi:
|
|
|
|
btr ecx, 31
|
2012-04-02 00:29:11 +02:00
|
|
|
dtext:
|
2015-08-03 14:38:30 +02:00
|
|
|
; edx -> string
|
|
|
|
; esi = number of characters
|
|
|
|
; ebx = output coordinates XXXXYYYY h
|
|
|
|
; ecx = char color and flags flRRGGBB h
|
|
|
|
; fl = ZBFFRSSS b
|
|
|
|
; Z=1: edx -> zero terminated string, esi = ?
|
|
|
|
; B=1: fill background with color eax
|
|
|
|
; R=1: edi -> user area for redirect
|
2015-10-29 15:43:15 +01:00
|
|
|
; FF=3: UTF-8 8x16, FF=2: UTF-16LE 8x16
|
|
|
|
; FF=1: cp866 8x16, FF=0: cp866 6x9
|
2015-08-03 14:38:30 +02:00
|
|
|
; SSS = (font multiplier)-1
|
|
|
|
; edi=1: force output
|
|
|
|
and eax, 0xFFFFFF
|
|
|
|
bt ecx, 30
|
|
|
|
jc @f
|
2011-10-14 23:38:50 +02:00
|
|
|
xor eax, eax
|
2015-08-03 14:38:30 +02:00
|
|
|
dec eax
|
|
|
|
@@:
|
|
|
|
pushd 0 0 0 eax
|
|
|
|
movsx eax, bx
|
|
|
|
sar ebx, 16
|
|
|
|
push eax ebx edi
|
|
|
|
bt ecx, 27
|
|
|
|
jc .redirect
|
|
|
|
mov ebp, [_display.width]
|
|
|
|
xor edi, edi
|
2011-10-14 23:38:50 +02:00
|
|
|
jmp @f
|
2015-10-11 14:44:21 +02:00
|
|
|
.ret:
|
|
|
|
add esp, 28
|
|
|
|
ret
|
2015-08-03 14:38:30 +02:00
|
|
|
.redirect:
|
|
|
|
mov ebp, [edi]
|
|
|
|
add edi, 8
|
2012-04-02 00:29:11 +02:00
|
|
|
@@:
|
2015-08-03 14:38:30 +02:00
|
|
|
shl ebp, 2
|
|
|
|
imul eax, ebp
|
|
|
|
shl ebx, 2
|
|
|
|
add eax, ebx
|
|
|
|
js .ret
|
2015-11-19 12:48:55 +01:00
|
|
|
add edi, eax
|
2015-08-03 14:38:30 +02:00
|
|
|
mov eax, ecx
|
|
|
|
mov ebx, ecx
|
|
|
|
test ecx, ecx
|
|
|
|
jns @f
|
|
|
|
mov esi, 256
|
|
|
|
@@:
|
|
|
|
shr ecx, 24
|
|
|
|
and cl, 7
|
|
|
|
inc ecx
|
|
|
|
push ebp ecx esi
|
2015-11-19 12:48:55 +01:00
|
|
|
mov esi, edx
|
2015-08-03 14:38:30 +02:00
|
|
|
or eax, 0xFF000000
|
|
|
|
bt ebx, 27
|
|
|
|
jc .bufferReady
|
|
|
|
mov eax, 9
|
2015-10-29 15:43:15 +01:00
|
|
|
test ebx, 0x30000000
|
|
|
|
jz @f
|
2015-08-03 14:38:30 +02:00
|
|
|
add eax, 7
|
|
|
|
@@:
|
|
|
|
imul eax, ecx
|
|
|
|
mov [esp+32], eax
|
|
|
|
imul ebp, eax
|
|
|
|
stdcall kernel_alloc, ebp
|
|
|
|
mov ecx, ebp
|
|
|
|
shr ecx, 2
|
|
|
|
mov [esp+36], eax
|
|
|
|
sub edi, eax
|
|
|
|
mov edx, eax
|
|
|
|
mov eax, [esp+24]
|
|
|
|
cmp eax, -1
|
2015-11-19 12:48:55 +01:00
|
|
|
jnz @f
|
2015-08-03 14:38:30 +02:00
|
|
|
mov [esp+28], edi
|
2015-11-19 12:48:55 +01:00
|
|
|
@@:
|
2015-08-03 14:38:30 +02:00
|
|
|
mov edi, edx
|
|
|
|
rep stosd
|
|
|
|
mov edi, edx
|
|
|
|
mov eax, ebx
|
|
|
|
and eax, 0xFFFFFF
|
|
|
|
.bufferReady:
|
|
|
|
mov ebp, eax
|
|
|
|
xor edx, edx
|
|
|
|
bt ebx, 29
|
2015-10-29 15:43:15 +01:00
|
|
|
jc @f
|
|
|
|
bt ebx, 28
|
|
|
|
jc .draw866toUni
|
|
|
|
jmp .draw866
|
|
|
|
@@:
|
2015-08-03 14:38:30 +02:00
|
|
|
bt ebx, 28
|
|
|
|
jc .drawUTF8
|
2012-04-02 00:29:11 +02:00
|
|
|
|
2015-11-19 12:48:55 +01:00
|
|
|
; ebp = font color
|
|
|
|
; esi -> string
|
|
|
|
; edi -> buffer
|
|
|
|
|
2015-10-11 14:44:21 +02:00
|
|
|
; Stack map:
|
2015-08-03 14:38:30 +02:00
|
|
|
; char counter +0
|
|
|
|
fontMultiplier = 4
|
|
|
|
widthX = 8
|
|
|
|
; edi +12
|
|
|
|
; X +16
|
|
|
|
; Y +20
|
|
|
|
; background +24
|
|
|
|
deltaToScreen = 28
|
|
|
|
; temp buffer height +32
|
2015-10-11 14:44:21 +02:00
|
|
|
; temp buffer pointer +36
|
2012-04-02 00:29:11 +02:00
|
|
|
|
2015-08-03 14:38:30 +02:00
|
|
|
.drawUTF16:
|
|
|
|
dec dword [esp]
|
|
|
|
js .done
|
2015-11-19 12:48:55 +01:00
|
|
|
movzx ebx, word [esi]
|
2015-08-03 14:38:30 +02:00
|
|
|
test ebx, ebx
|
|
|
|
jz .done
|
|
|
|
inc esi
|
|
|
|
inc esi
|
|
|
|
cmp bx, 1419
|
|
|
|
jc @f
|
|
|
|
xor ebx, ebx
|
|
|
|
@@:
|
|
|
|
pushd esi edi 16
|
|
|
|
shl ebx, 4
|
|
|
|
add ebx, fontUni
|
|
|
|
mov esi, [esp+12+fontMultiplier]
|
|
|
|
call drawChar
|
|
|
|
imul esi, 8*4
|
|
|
|
pop edi
|
|
|
|
pop edi
|
|
|
|
add edi, esi
|
|
|
|
pop esi
|
|
|
|
jmp .drawUTF16
|
2015-10-11 14:44:21 +02:00
|
|
|
|
2015-08-03 14:38:30 +02:00
|
|
|
.drawUTF8:
|
|
|
|
dec dword [esp]
|
|
|
|
js .done
|
2015-08-05 11:59:57 +02:00
|
|
|
@@:
|
2015-11-19 12:48:55 +01:00
|
|
|
movzx ebx, byte [esi]
|
2015-08-03 14:38:30 +02:00
|
|
|
inc esi
|
|
|
|
test bl, bl
|
|
|
|
jz .done
|
|
|
|
jns .valid
|
|
|
|
shl bx, 10
|
2015-08-05 11:59:57 +02:00
|
|
|
jnc @b
|
2015-08-03 14:38:30 +02:00
|
|
|
mov bl, [esi]
|
2015-11-19 12:48:55 +01:00
|
|
|
test bl, bl
|
|
|
|
jns @b
|
2015-08-03 14:38:30 +02:00
|
|
|
shl bl, 2
|
2015-11-19 12:48:55 +01:00
|
|
|
jc @b
|
|
|
|
shr bh, 2
|
2015-08-03 14:38:30 +02:00
|
|
|
shr bx, 2
|
|
|
|
inc esi
|
|
|
|
cmp bx, 1419
|
|
|
|
jc .valid
|
2015-11-19 12:48:55 +01:00
|
|
|
shl bh, 4
|
2015-08-03 14:38:30 +02:00
|
|
|
jns @f
|
2015-11-19 12:48:55 +01:00
|
|
|
.tail:
|
|
|
|
mov bl, [esi]
|
|
|
|
shl bl, 1
|
|
|
|
jnc @b
|
|
|
|
js @b
|
2015-08-03 14:38:30 +02:00
|
|
|
inc esi
|
2015-11-19 12:48:55 +01:00
|
|
|
shl bh, 1
|
|
|
|
js .tail
|
2015-08-03 14:38:30 +02:00
|
|
|
@@:
|
|
|
|
xor ebx, ebx
|
|
|
|
.valid:
|
|
|
|
pushd esi edi 16
|
|
|
|
shl ebx, 4
|
|
|
|
add ebx, fontUni
|
|
|
|
mov esi, [esp+12+fontMultiplier]
|
|
|
|
call drawChar
|
|
|
|
imul esi, 8*4
|
|
|
|
pop edi
|
|
|
|
pop edi
|
|
|
|
add edi, esi
|
|
|
|
pop esi
|
|
|
|
jmp .drawUTF8
|
2015-10-11 14:44:21 +02:00
|
|
|
|
2015-08-03 14:38:30 +02:00
|
|
|
.draw866:
|
|
|
|
dec dword [esp]
|
|
|
|
js .done
|
2015-11-19 12:48:55 +01:00
|
|
|
movzx ebx, byte [esi]
|
2015-08-03 14:38:30 +02:00
|
|
|
test ebx, ebx
|
|
|
|
jz .done
|
|
|
|
inc esi
|
|
|
|
pushd esi edi 9
|
|
|
|
lea ebx, [ebx*8+ebx+font1]
|
|
|
|
mov esi, [esp+12+fontMultiplier]
|
|
|
|
call drawChar
|
|
|
|
imul esi, 6*4
|
|
|
|
pop edi
|
|
|
|
pop edi
|
|
|
|
add edi, esi
|
|
|
|
pop esi
|
|
|
|
jmp .draw866
|
2015-10-11 14:44:21 +02:00
|
|
|
|
2015-10-29 15:43:15 +01:00
|
|
|
.draw866toUni:
|
|
|
|
dec dword [esp]
|
|
|
|
js .done
|
2015-11-19 12:48:55 +01:00
|
|
|
movzx eax, byte [esi]
|
2015-10-29 15:43:15 +01:00
|
|
|
test eax, eax
|
|
|
|
jz .done
|
|
|
|
call ansi2uni_char
|
|
|
|
shl eax, 4
|
|
|
|
lea ebx, [eax+fontUni]
|
|
|
|
inc esi
|
|
|
|
pushd esi edi 16
|
|
|
|
mov esi, [esp+12+fontMultiplier]
|
|
|
|
call drawChar
|
|
|
|
imul esi, 8*4
|
|
|
|
pop edi
|
|
|
|
pop edi
|
|
|
|
add edi, esi
|
|
|
|
pop esi
|
|
|
|
jmp .draw866toUni
|
|
|
|
|
2015-08-03 14:38:30 +02:00
|
|
|
.done:
|
|
|
|
mov ecx, edi
|
|
|
|
pop eax eax eax esi edx ebx ebp ebp ebp
|
|
|
|
mov edi, [esp]
|
|
|
|
test edi, edi
|
|
|
|
jnz @f
|
|
|
|
pop eax
|
|
|
|
ret
|
2015-10-11 14:44:21 +02:00
|
|
|
@@: ; redraw from buffer to screen
|
2015-08-03 14:38:30 +02:00
|
|
|
push eax
|
|
|
|
sub ecx, edi
|
|
|
|
shr ecx, 2
|
|
|
|
add edx, ecx
|
|
|
|
inc ecx
|
|
|
|
push ecx
|
|
|
|
push edi
|
|
|
|
.drawPicture:
|
|
|
|
mov eax, -1
|
|
|
|
repz scasd
|
|
|
|
jcxz @f
|
|
|
|
mov eax, edx
|
|
|
|
sub eax, ecx
|
|
|
|
push ecx
|
|
|
|
mov ecx, [edi-4]
|
|
|
|
xchg esi, edi
|
2012-03-12 19:26:37 +01:00
|
|
|
call __sys_putpixel
|
2015-08-03 14:38:30 +02:00
|
|
|
xchg esi, edi
|
2011-10-14 23:38:50 +02:00
|
|
|
pop ecx
|
2015-08-03 14:38:30 +02:00
|
|
|
jmp .drawPicture
|
|
|
|
@@:
|
|
|
|
pop edi
|
|
|
|
mov ecx, [esp]
|
|
|
|
add edi, [esp+4]
|
2011-10-14 23:38:50 +02:00
|
|
|
inc ebx
|
2015-08-03 14:38:30 +02:00
|
|
|
push edi
|
|
|
|
dec ebp
|
|
|
|
jnz .drawPicture
|
|
|
|
add esp, 12
|
|
|
|
call kernel_free
|
|
|
|
ret
|
2012-04-02 00:29:11 +02:00
|
|
|
|
2015-10-11 14:44:21 +02:00
|
|
|
; scaling/smoothing algorithm
|
2015-08-03 14:38:30 +02:00
|
|
|
drawChar:
|
2015-11-19 12:48:55 +01:00
|
|
|
; ebp = font color
|
|
|
|
; esi = font multiplier
|
|
|
|
; edi -> buffer
|
|
|
|
; ebx -> char data
|
2015-08-03 14:38:30 +02:00
|
|
|
mov dl, [ebx]
|
|
|
|
.raw:
|
|
|
|
bsf eax, edx
|
|
|
|
jz .nextRaw
|
|
|
|
imul eax, esi
|
|
|
|
shl eax, 2
|
|
|
|
push edi
|
|
|
|
add edi, eax
|
|
|
|
mov ecx, esi
|
|
|
|
dec esi
|
|
|
|
jnz .square
|
|
|
|
mov [edi], ebp
|
|
|
|
inc esi
|
|
|
|
cmp [fontSmoothing], 0
|
|
|
|
jz .nextPixel
|
2015-10-15 17:16:30 +02:00
|
|
|
.checkLeftSM: ; smoothing
|
2015-08-03 14:38:30 +02:00
|
|
|
bsf eax, edx
|
|
|
|
dec eax
|
2015-10-15 17:16:30 +02:00
|
|
|
js .checkRightSM
|
2015-08-03 14:38:30 +02:00
|
|
|
bt [ebx], eax
|
2015-10-15 17:16:30 +02:00
|
|
|
jc .checkRightSM
|
2015-08-03 14:38:30 +02:00
|
|
|
dec eax
|
2015-10-15 17:16:30 +02:00
|
|
|
js .checkLeftDownSM
|
2015-08-03 14:38:30 +02:00
|
|
|
bt [ebx], eax
|
2015-10-15 17:16:30 +02:00
|
|
|
jc .checkRightSM
|
|
|
|
.checkLeftDownSM:
|
2015-08-03 14:38:30 +02:00
|
|
|
inc eax
|
|
|
|
bt [ebx+1], eax
|
2015-10-15 17:16:30 +02:00
|
|
|
jnc .checkLeftUpSM
|
2015-08-03 14:38:30 +02:00
|
|
|
inc eax
|
|
|
|
bt [ebx+1], eax
|
|
|
|
jnc @f
|
|
|
|
bt [ebx-1], eax
|
2015-10-15 17:16:30 +02:00
|
|
|
jc .checkRightSM
|
2015-08-03 14:38:30 +02:00
|
|
|
dec eax
|
|
|
|
dec eax
|
|
|
|
js @f
|
|
|
|
bt [ebx+1], eax
|
|
|
|
jnc @f
|
|
|
|
inc eax
|
2015-10-15 17:16:30 +02:00
|
|
|
.checkLeftUpSM:
|
2015-08-03 14:38:30 +02:00
|
|
|
bt [ebx-1], eax
|
2015-10-15 17:16:30 +02:00
|
|
|
jnc .checkRightSM
|
2015-08-03 14:38:30 +02:00
|
|
|
inc eax
|
|
|
|
bt [ebx-1], eax
|
|
|
|
jnc @f
|
|
|
|
bt [ebx+1], eax
|
2015-10-15 17:16:30 +02:00
|
|
|
jc .checkRightSM
|
2015-08-03 14:38:30 +02:00
|
|
|
dec eax
|
|
|
|
dec eax
|
|
|
|
js @f
|
|
|
|
bt [ebx-1], eax
|
2015-10-15 17:16:30 +02:00
|
|
|
jc .checkRightSM
|
2015-08-03 14:38:30 +02:00
|
|
|
@@:
|
|
|
|
mov ecx, [esp+20+deltaToScreen]
|
|
|
|
mov eax, [edi-4]
|
|
|
|
test ecx, ecx
|
2012-04-02 00:29:11 +02:00
|
|
|
jz @f
|
2015-08-03 14:38:30 +02:00
|
|
|
pusha
|
|
|
|
lea ebx, [edi+ecx-4]
|
|
|
|
shr ebx, 2
|
|
|
|
call syscall_getpixel
|
|
|
|
popa
|
2012-04-02 00:29:11 +02:00
|
|
|
@@:
|
2015-10-11 14:44:21 +02:00
|
|
|
push ebx edx
|
|
|
|
mov ebx, ebp
|
|
|
|
xor ecx, ecx
|
2015-10-15 17:16:30 +02:00
|
|
|
cmp [fontSmoothing], 1
|
|
|
|
jnz .subpixelLeft
|
|
|
|
call antiAliasing
|
|
|
|
jmp @f
|
|
|
|
.subpixelLeft:
|
2015-10-11 14:44:21 +02:00
|
|
|
mov cl, bl
|
|
|
|
lea edx, [ecx*8+ecx]
|
|
|
|
lea edx, [ecx*2+edx]
|
|
|
|
mov cl, al
|
|
|
|
lea ecx, [ecx*4+ecx]
|
|
|
|
add edx, ecx
|
|
|
|
shr edx, 4
|
|
|
|
mov al, dl
|
|
|
|
|
|
|
|
xor ecx, ecx
|
|
|
|
mov cl, ah
|
|
|
|
lea edx, [ecx*8+ecx]
|
|
|
|
lea edx, [ecx*2+edx]
|
|
|
|
mov cl, bh
|
|
|
|
lea ecx, [ecx*4+ecx]
|
|
|
|
add edx, ecx
|
|
|
|
shr edx, 4
|
|
|
|
mov ah, dl
|
|
|
|
|
|
|
|
rol eax, 16
|
|
|
|
rol ebx, 16
|
|
|
|
xor ecx, ecx
|
|
|
|
mov cl, al
|
|
|
|
mov edx, ecx
|
|
|
|
shl ecx, 3
|
|
|
|
sub ecx, edx
|
|
|
|
mov dl, bl
|
|
|
|
add ecx, edx
|
|
|
|
shr ecx, 3
|
|
|
|
mov al, cl
|
|
|
|
rol eax, 16
|
2015-10-15 17:16:30 +02:00
|
|
|
@@:
|
2015-08-03 14:38:30 +02:00
|
|
|
mov [edi-4], eax
|
2015-10-11 14:44:21 +02:00
|
|
|
pop edx ebx
|
2015-10-15 17:16:30 +02:00
|
|
|
.checkRightSM:
|
2015-08-03 14:38:30 +02:00
|
|
|
bsf eax, edx
|
|
|
|
inc eax
|
|
|
|
bt [ebx], eax
|
|
|
|
jc .nextPixel
|
|
|
|
inc eax
|
|
|
|
bt [ebx], eax
|
|
|
|
jc .nextPixel
|
|
|
|
dec eax
|
2015-10-15 17:16:30 +02:00
|
|
|
.checkRightDownSM:
|
2015-08-03 14:38:30 +02:00
|
|
|
bt [ebx+1], eax
|
2015-10-15 17:16:30 +02:00
|
|
|
jnc .checkRightUpSM
|
2015-08-03 14:38:30 +02:00
|
|
|
dec eax
|
|
|
|
bt [ebx+1], eax
|
|
|
|
jnc @f
|
|
|
|
bt [ebx-1], eax
|
|
|
|
jc .nextPixel
|
|
|
|
inc eax
|
|
|
|
inc eax
|
|
|
|
bt [ebx+1], eax
|
|
|
|
jnc @f
|
|
|
|
dec eax
|
2015-10-15 17:16:30 +02:00
|
|
|
.checkRightUpSM:
|
2015-08-03 14:38:30 +02:00
|
|
|
bt [ebx-1], eax
|
|
|
|
jnc .nextPixel
|
|
|
|
dec eax
|
|
|
|
bt [ebx-1], eax
|
|
|
|
jnc @f
|
|
|
|
bt [ebx+1], eax
|
|
|
|
jc .nextPixel
|
|
|
|
inc eax
|
|
|
|
inc eax
|
|
|
|
bt [ebx-1], eax
|
|
|
|
jc .nextPixel
|
|
|
|
@@:
|
|
|
|
mov ecx, [esp+20+deltaToScreen]
|
|
|
|
mov eax, [edi+4]
|
|
|
|
test ecx, ecx
|
2012-04-02 00:29:11 +02:00
|
|
|
jz @f
|
2015-08-03 14:38:30 +02:00
|
|
|
pusha
|
|
|
|
lea ebx, [edi+ecx+4]
|
|
|
|
shr ebx, 2
|
|
|
|
call syscall_getpixel
|
|
|
|
popa
|
2012-04-02 00:29:11 +02:00
|
|
|
@@:
|
2015-10-11 14:44:21 +02:00
|
|
|
push ebx edx
|
|
|
|
mov ebx, ebp
|
|
|
|
xor ecx, ecx
|
2015-10-15 17:16:30 +02:00
|
|
|
cmp [fontSmoothing], 1
|
|
|
|
jnz .subpixelRight
|
|
|
|
call antiAliasing
|
|
|
|
jmp @f
|
|
|
|
.subpixelRight:
|
2015-10-11 14:44:21 +02:00
|
|
|
mov cl, al
|
|
|
|
mov edx, ecx
|
|
|
|
shl ecx, 3
|
|
|
|
sub ecx, edx
|
|
|
|
mov dl, bl
|
|
|
|
add ecx, edx
|
|
|
|
shr ecx, 3
|
2015-08-03 14:38:30 +02:00
|
|
|
mov al, cl
|
2015-10-11 14:44:21 +02:00
|
|
|
|
|
|
|
xor ecx, ecx
|
|
|
|
mov cl, ah
|
|
|
|
lea edx, [ecx*8+ecx]
|
|
|
|
lea edx, [ecx*2+edx]
|
|
|
|
mov cl, bh
|
|
|
|
lea ecx, [ecx*4+ecx]
|
|
|
|
add edx, ecx
|
|
|
|
shr edx, 4
|
|
|
|
mov ah, dl
|
|
|
|
|
|
|
|
rol ebx, 16
|
|
|
|
rol eax, 16
|
|
|
|
xor ecx, ecx
|
|
|
|
mov cl, bl
|
|
|
|
lea edx, [ecx*8+ecx]
|
|
|
|
lea edx, [ecx*2+edx]
|
|
|
|
mov cl, al
|
|
|
|
lea ecx, [ecx*4+ecx]
|
|
|
|
add edx, ecx
|
|
|
|
shr edx, 4
|
|
|
|
mov al, dl
|
|
|
|
rol eax, 16
|
2015-10-15 17:16:30 +02:00
|
|
|
@@:
|
2015-08-03 14:38:30 +02:00
|
|
|
mov [edi+4], eax
|
2015-10-11 14:44:21 +02:00
|
|
|
pop edx ebx
|
2015-08-03 14:38:30 +02:00
|
|
|
jmp .nextPixel
|
2015-10-11 14:44:21 +02:00
|
|
|
|
|
|
|
.square: ; scaling
|
2015-08-03 14:38:30 +02:00
|
|
|
mov eax, esi
|
|
|
|
@@:
|
|
|
|
mov [edi+eax*4], ebp
|
|
|
|
dec eax
|
|
|
|
jns @b
|
|
|
|
add edi, [esp+20+widthX]
|
|
|
|
dec ecx
|
|
|
|
jnz .square
|
|
|
|
inc esi
|
|
|
|
mov edi, [esp]
|
|
|
|
.checkLeft:
|
|
|
|
bsf eax, edx
|
|
|
|
dec eax
|
|
|
|
js .checkRight
|
|
|
|
bt [ebx], eax
|
|
|
|
jc .checkRight
|
|
|
|
.checkLeftDown:
|
|
|
|
bt [ebx+1], eax
|
|
|
|
jnc .checkLeftUp
|
|
|
|
mov ecx, eax
|
2011-10-14 23:38:50 +02:00
|
|
|
inc eax
|
2015-08-03 14:38:30 +02:00
|
|
|
bt [ebx+1], eax
|
|
|
|
jc @f
|
|
|
|
bt [ebx-1], eax
|
|
|
|
jnc .downRightLow
|
|
|
|
bt [ebx-2], eax
|
|
|
|
jc .downRightLow
|
|
|
|
dec eax
|
|
|
|
bt [ebx-1], eax
|
|
|
|
jc .downRightLow
|
|
|
|
dec eax
|
|
|
|
js .downRightHigh
|
|
|
|
bt [ebx-2], eax
|
|
|
|
jc .downRightLow
|
|
|
|
jmp .downRightHigh
|
2015-10-11 14:44:21 +02:00
|
|
|
|
2015-08-03 14:38:30 +02:00
|
|
|
@@:
|
|
|
|
bt [ebx-1], eax
|
|
|
|
jc .checkLeftUp
|
|
|
|
dec eax
|
|
|
|
dec eax
|
|
|
|
js .downRightLow
|
|
|
|
bt [ebx+1], eax
|
|
|
|
jc .checkLeftUp
|
|
|
|
.downRightLow:
|
|
|
|
imul ecx, esi
|
|
|
|
shl ecx, 2
|
|
|
|
add edi, ecx
|
2011-10-14 23:38:50 +02:00
|
|
|
dec esi
|
2015-08-03 14:38:30 +02:00
|
|
|
mov eax, [esp+20+widthX]
|
|
|
|
imul eax, esi
|
|
|
|
add edi, eax
|
|
|
|
add edi, 4
|
|
|
|
mov ecx, esi
|
|
|
|
dec ecx
|
|
|
|
.drawDownRight:
|
|
|
|
mov eax, ecx
|
|
|
|
@@:
|
|
|
|
mov [edi+eax*4], ebp
|
|
|
|
dec eax
|
|
|
|
jns @b
|
|
|
|
sub edi, [esp+20+widthX]
|
|
|
|
add edi, 4
|
|
|
|
dec ecx
|
|
|
|
jns .drawDownRight
|
|
|
|
inc esi
|
|
|
|
mov edi, [esp]
|
|
|
|
jmp .checkLeftUp
|
2015-10-11 14:44:21 +02:00
|
|
|
|
2015-08-03 14:38:30 +02:00
|
|
|
.downRightHigh:
|
|
|
|
imul ecx, esi
|
|
|
|
shl ecx, 2
|
|
|
|
add edi, ecx
|
|
|
|
dec esi
|
|
|
|
mov eax, [esp+20+widthX]
|
|
|
|
imul eax, esi
|
|
|
|
add edi, eax
|
|
|
|
add edi, 4
|
|
|
|
mov ecx, esi
|
|
|
|
dec ecx
|
|
|
|
.drawDownRightHigh:
|
|
|
|
mov eax, ecx
|
|
|
|
@@:
|
|
|
|
mov [edi+eax*4], ebp
|
|
|
|
dec eax
|
|
|
|
jns @b
|
|
|
|
sub edi, [esp+20+widthX]
|
|
|
|
mov eax, ecx
|
|
|
|
@@:
|
|
|
|
mov [edi+eax*4], ebp
|
|
|
|
dec eax
|
|
|
|
jns @b
|
|
|
|
sub edi, [esp+20+widthX]
|
|
|
|
add edi, 4
|
|
|
|
dec ecx
|
|
|
|
jns .drawDownRightHigh
|
|
|
|
inc esi
|
|
|
|
mov edi, [esp]
|
|
|
|
.checkLeftUp:
|
|
|
|
bsf eax, edx
|
|
|
|
dec eax
|
|
|
|
bt [ebx-1], eax
|
|
|
|
jnc .checkRight
|
|
|
|
mov ecx, eax
|
|
|
|
inc eax
|
|
|
|
bt [ebx-1], eax
|
|
|
|
jc @f
|
|
|
|
bt [ebx+1], eax
|
|
|
|
jnc .upRightLow
|
|
|
|
bt [ebx+2], eax
|
|
|
|
jc .upRightLow
|
|
|
|
dec eax
|
|
|
|
bt [ebx+1], eax
|
|
|
|
jc .upRightLow
|
|
|
|
dec eax
|
|
|
|
js .upRightHigh
|
|
|
|
bt [ebx+2], eax
|
|
|
|
jc .upRightLow
|
|
|
|
jmp .upRightHigh
|
2015-10-11 14:44:21 +02:00
|
|
|
|
2015-08-03 14:38:30 +02:00
|
|
|
@@:
|
|
|
|
bt [ebx+1], eax
|
|
|
|
jc .checkRight
|
|
|
|
dec eax
|
|
|
|
dec eax
|
|
|
|
js .upRightLow
|
|
|
|
bt [ebx-1], eax
|
|
|
|
jc .checkRight
|
|
|
|
.upRightLow:
|
|
|
|
imul ecx, esi
|
|
|
|
shl ecx, 2
|
|
|
|
add edi, ecx
|
|
|
|
add edi, 4
|
|
|
|
mov ecx, esi
|
|
|
|
dec ecx
|
|
|
|
dec ecx
|
|
|
|
.drawUpRight:
|
|
|
|
mov eax, ecx
|
|
|
|
@@:
|
|
|
|
mov [edi+eax*4], ebp
|
|
|
|
dec eax
|
|
|
|
jns @b
|
|
|
|
add edi, [esp+20+widthX]
|
|
|
|
add edi, 4
|
|
|
|
dec ecx
|
|
|
|
jns .drawUpRight
|
|
|
|
mov edi, [esp]
|
|
|
|
jmp .checkRight
|
2015-10-11 14:44:21 +02:00
|
|
|
|
2015-08-03 14:38:30 +02:00
|
|
|
.upRightHigh:
|
|
|
|
imul ecx, esi
|
|
|
|
shl ecx, 2
|
|
|
|
add edi, ecx
|
|
|
|
add edi, 4
|
|
|
|
mov ecx, esi
|
|
|
|
dec ecx
|
|
|
|
dec ecx
|
|
|
|
.drawUpRightHigh:
|
|
|
|
mov eax, ecx
|
|
|
|
@@:
|
|
|
|
mov [edi+eax*4], ebp
|
|
|
|
dec eax
|
|
|
|
jns @b
|
|
|
|
add edi, [esp+20+widthX]
|
|
|
|
mov eax, ecx
|
|
|
|
@@:
|
|
|
|
mov [edi+eax*4], ebp
|
|
|
|
dec eax
|
|
|
|
jns @b
|
|
|
|
add edi, [esp+20+widthX]
|
|
|
|
add edi, 4
|
|
|
|
dec ecx
|
|
|
|
jns .drawUpRightHigh
|
|
|
|
mov edi, [esp]
|
|
|
|
.checkRight:
|
|
|
|
bsf eax, edx
|
|
|
|
inc eax
|
|
|
|
bt [ebx], eax
|
|
|
|
jc .nextPixel
|
|
|
|
.checkRightDown:
|
|
|
|
bt [ebx+1], eax
|
|
|
|
jnc .checkRightUp
|
|
|
|
mov ecx, eax
|
|
|
|
dec eax
|
|
|
|
bt [ebx+1], eax
|
|
|
|
jc @f
|
|
|
|
bt [ebx-1], eax
|
|
|
|
jnc .downLeftLow
|
|
|
|
bt [ebx-2], eax
|
|
|
|
jc .downLeftLow
|
|
|
|
inc eax
|
|
|
|
bt [ebx-1], eax
|
|
|
|
jc .downLeftLow
|
|
|
|
inc eax
|
|
|
|
bt [ebx-2], eax
|
|
|
|
jc .downLeftLow
|
|
|
|
jmp .downLeftHigh
|
2015-10-11 14:44:21 +02:00
|
|
|
|
2015-08-03 14:38:30 +02:00
|
|
|
@@:
|
|
|
|
bt [ebx-1], eax
|
|
|
|
jc .checkRightUp
|
|
|
|
inc eax
|
|
|
|
inc eax
|
|
|
|
bt [ebx+1], eax
|
|
|
|
jc .checkRightUp
|
|
|
|
.downLeftLow:
|
|
|
|
imul ecx, esi
|
|
|
|
shl ecx, 2
|
|
|
|
add edi, ecx
|
|
|
|
dec esi
|
|
|
|
mov eax, [esp+20+widthX]
|
|
|
|
imul eax, esi
|
|
|
|
add edi, eax
|
|
|
|
mov ecx, esi
|
|
|
|
dec ecx
|
|
|
|
.drawDownLeft:
|
|
|
|
mov eax, ecx
|
|
|
|
@@:
|
|
|
|
mov [edi+eax*4], ebp
|
|
|
|
dec eax
|
|
|
|
jns @b
|
|
|
|
sub edi, [esp+20+widthX]
|
|
|
|
dec ecx
|
|
|
|
jns .drawDownLeft
|
|
|
|
inc esi
|
|
|
|
mov edi, [esp]
|
|
|
|
jmp .checkRightUp
|
2015-10-11 14:44:21 +02:00
|
|
|
|
2015-08-03 14:38:30 +02:00
|
|
|
.downLeftHigh:
|
|
|
|
imul ecx, esi
|
|
|
|
shl ecx, 2
|
|
|
|
add edi, ecx
|
|
|
|
dec esi
|
|
|
|
mov eax, [esp+20+widthX]
|
|
|
|
imul eax, esi
|
|
|
|
add edi, eax
|
|
|
|
mov ecx, esi
|
|
|
|
dec ecx
|
|
|
|
.drawDownLeftHigh:
|
|
|
|
mov eax, ecx
|
|
|
|
@@:
|
|
|
|
mov [edi+eax*4], ebp
|
|
|
|
dec eax
|
|
|
|
jns @b
|
|
|
|
sub edi, [esp+20+widthX]
|
|
|
|
mov eax, ecx
|
|
|
|
@@:
|
|
|
|
mov [edi+eax*4], ebp
|
|
|
|
dec eax
|
|
|
|
jns @b
|
|
|
|
sub edi, [esp+20+widthX]
|
|
|
|
dec ecx
|
|
|
|
jns .drawDownLeftHigh
|
|
|
|
inc esi
|
|
|
|
mov edi, [esp]
|
|
|
|
.checkRightUp:
|
|
|
|
bsf eax, edx
|
|
|
|
inc eax
|
|
|
|
bt [ebx-1], eax
|
|
|
|
jnc .nextPixel
|
|
|
|
mov ecx, eax
|
|
|
|
dec eax
|
|
|
|
bt [ebx-1], eax
|
|
|
|
jc @f
|
|
|
|
bt [ebx+1], eax
|
|
|
|
jnc .upLeftLow
|
|
|
|
bt [ebx+2], eax
|
|
|
|
jc .upLeftLow
|
|
|
|
inc eax
|
|
|
|
bt [ebx+1], eax
|
|
|
|
jc .upLeftLow
|
|
|
|
inc eax
|
|
|
|
bt [ebx+2], eax
|
|
|
|
jc .upLeftLow
|
|
|
|
jmp .upLeftHigh
|
2015-10-11 14:44:21 +02:00
|
|
|
|
2015-08-03 14:38:30 +02:00
|
|
|
@@:
|
|
|
|
bt [ebx+1], eax
|
|
|
|
jc .nextPixel
|
|
|
|
inc eax
|
|
|
|
inc eax
|
|
|
|
bt [ebx-1], eax
|
|
|
|
jc .nextPixel
|
|
|
|
.upLeftLow:
|
|
|
|
imul ecx, esi
|
|
|
|
shl ecx, 2
|
|
|
|
add edi, ecx
|
|
|
|
mov ecx, esi
|
|
|
|
dec ecx
|
|
|
|
dec ecx
|
|
|
|
.drawUpLeft:
|
|
|
|
mov eax, ecx
|
|
|
|
@@:
|
|
|
|
mov [edi+eax*4], ebp
|
|
|
|
dec eax
|
|
|
|
jns @b
|
|
|
|
add edi, [esp+20+widthX]
|
|
|
|
dec ecx
|
|
|
|
jns .drawUpLeft
|
|
|
|
jmp .nextPixel
|
2015-10-11 14:44:21 +02:00
|
|
|
|
2015-08-03 14:38:30 +02:00
|
|
|
.upLeftHigh:
|
|
|
|
imul ecx, esi
|
|
|
|
shl ecx, 2
|
|
|
|
add edi, ecx
|
|
|
|
mov ecx, esi
|
|
|
|
dec ecx
|
|
|
|
dec ecx
|
|
|
|
.drawUpLeftHigh:
|
|
|
|
mov eax, ecx
|
|
|
|
@@:
|
|
|
|
mov [edi+eax*4], ebp
|
|
|
|
dec eax
|
|
|
|
jns @b
|
|
|
|
add edi, [esp+20+widthX]
|
|
|
|
mov eax, ecx
|
|
|
|
@@:
|
|
|
|
mov [edi+eax*4], ebp
|
|
|
|
dec eax
|
|
|
|
jns @b
|
|
|
|
add edi, [esp+20+widthX]
|
|
|
|
dec ecx
|
|
|
|
jns .drawUpLeftHigh
|
|
|
|
.nextPixel:
|
|
|
|
bsf eax, edx
|
|
|
|
btr edx, eax
|
|
|
|
pop edi
|
|
|
|
jmp .raw
|
2015-10-11 14:44:21 +02:00
|
|
|
|
2015-08-03 14:38:30 +02:00
|
|
|
.nextRaw:
|
2011-10-14 23:38:50 +02:00
|
|
|
inc ebx
|
2015-08-03 14:38:30 +02:00
|
|
|
mov eax, [esp+16+widthX]
|
|
|
|
imul eax, esi
|
|
|
|
add edi, eax
|
|
|
|
dec dword [esp+4]
|
|
|
|
jnz drawChar
|
2012-04-02 00:29:11 +02:00
|
|
|
ret
|
2015-08-03 14:38:30 +02:00
|
|
|
|
2015-10-15 17:16:30 +02:00
|
|
|
antiAliasing:
|
|
|
|
mov bp, 3
|
|
|
|
@@:
|
|
|
|
mov cl, al
|
|
|
|
mov dl, bl
|
|
|
|
lea ecx, [ecx*2+ecx]
|
|
|
|
add ecx, edx
|
|
|
|
shr ecx, 2
|
|
|
|
mov al, cl
|
|
|
|
ror eax, 8
|
|
|
|
ror ebx, 8
|
|
|
|
dec bp
|
|
|
|
jnz @b
|
|
|
|
ror eax, 8
|
|
|
|
ror ebx, 8
|
|
|
|
mov ebp, ebx
|
|
|
|
ret
|
|
|
|
|
2015-10-29 15:43:15 +01:00
|
|
|
fontSmoothing db 2 ; = 0, 1 or 2
|
|
|
|
fontSize db 0 ; user mode setting
|
2015-08-03 14:38:30 +02:00
|
|
|
font1:
|
2013-03-26 03:12:02 +01:00
|
|
|
if lang eq sp
|
|
|
|
file 'char_sp.mt'
|
2013-09-21 22:26:44 +02:00
|
|
|
else if lang eq et
|
|
|
|
file 'char_et.mt'
|
2013-03-26 03:12:02 +01:00
|
|
|
else
|
2012-04-21 00:22:57 +02:00
|
|
|
file 'char.mt'
|
2013-03-26 03:12:02 +01:00
|
|
|
end if
|
2015-08-03 14:38:30 +02:00
|
|
|
fontUni:
|
|
|
|
file 'charUni.mt'
|