Nonscalable Vectorized Fonts: the Parser!

git-svn-id: svn://kolibrios.org@2470 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Artem Jerdev (art_zh) 2012-03-15 23:11:54 +00:00
parent ce1fd77493
commit ce9ffe8571
2 changed files with 38 additions and 36 deletions

View File

@ -212,9 +212,8 @@ diff16 "parse_tick : ",0,$
; edi = color 0x0RRGGBB ; edi = color 0x0RRGGBB
; ebp = font's header ; ebp = font's header
pushad pushad
xor ecx, ecx
mov dx, word[edx] mov dx, word[edx]
mov cl, dl movzx ecx, dl
test dl, 0xE0 ; ticks #32..255 test dl, 0xE0 ; ticks #32..255
jz .lntick.short jz .lntick.short
cmp dl, 0xE0 cmp dl, 0xE0
@ -224,73 +223,76 @@ diff16 "parse_tick : ",0,$
.gptick: .gptick:
push edx push edx
mov cl, dh mov cl, dh
shr cl, 3 ; orig.# shr cl, 3 ; number of origin
mov edx, [ebp+8] ; orig. table mov edx, [ebp+8] ; orig. table
mov ch, byte[edx+ecx] ; orig. coords mov ch, byte[edx+ecx] ; orig. coords
pop edx pop edx
mov cl, dh mov cl, dh
and cl, 7 ; three rotation bits and cl, 7 ; three rotation bits
and edx, 0xFF ; dl = gptick# movzx edx, dl ; dl = gptick#
sub dl, 32 sub dl, 32
cmp dl, (sdsh_data.v5-sdsh_data.v1) cmp dl, (sdsh_data.v5-sdsh_data.v1)
jae .gptick.2 jae .gptick.2
.gptick.1: .gptick.1:
mov esi, sdsh_data.tick_table ; 1-byte tickgroups .v1-v4:
add esi, edx ; 1-byte tickgroups .v1-v4: lea esi, [sdsh_data.v1+edx]
inc dh inc dh
sub dl, 2 ; .v1 : 2 ticks only (#32, 33) sub dl, 2 ; .v1 : 2 ticks only (#32, 33)
jae @f jae .gptick.1v2v4
mov dl, dh mov dl, dh
mov dh, ch
jmp .draw
.gptick.1v2v4:
; 1-byte tickgroups .v2-v4 : 8 ticks each
inc dh
shr dl, 3
jmp .gptick.done jmp .gptick.done
@@: inc dh
shr dl, 3 ; tickgroups .v2-v4 : 8 ticks each
add dl, dh
jmp .gptick.done
.gptick.2: .gptick.2:
; 2-byte tickgroups .v5-v8: 8 ticks each
sub dl, (sdsh_data.v5-sdsh_data.v1) sub dl, (sdsh_data.v5-sdsh_data.v1)
cmp dl, (sdsh_data.v9-sdsh_data.v5) cmp dl, (sdsh_data.v9-sdsh_data.v5)
jae .gptick.3 jae .gptick.3
mov esi, sdsh_data.v5 lea esi, [sdsh_data.v5 + edx*2]
lea esi, [esi+edx*2] ; 2-byte tickgroups .v5-v8: 8 ticks each
mov dh, 5 mov dh, 5
shr dl, 3 shr dl, 3
add dl, dh
jmp .gptick.done jmp .gptick.done
.gptick.3: .gptick.3:
; 3-byte tickgroups .v9-12: 4 ticks each
sub dl, (sdsh_data.v9-sdsh_data.v5) sub dl, (sdsh_data.v9-sdsh_data.v5)
cmp dl, (sdsh_data.v13-sdsh_data.v9) cmp dl, (sdsh_data.v13-sdsh_data.v9)
jae .gptick.4 jae .gptick.4
mov esi, sdsh_data.v9 lea esi, [sdsh_data.v9 + edx*2 + edx]
lea esi,[esi+edx*2]
add esi, edx ; 3-byte tickgroups .v9-12: 4 ticks each
mov dh, 9 mov dh, 9
shr dl, 2 shr dl, 2
add dl, dh
jmp .gptick.done jmp .gptick.done
.gptick.4: .gptick.4:
; 4-byte tickgroups .v13-16: 4 ticks each
sub dl, (sdsh_data.v13-sdsh_data.v9) sub dl, (sdsh_data.v13-sdsh_data.v9)
cmp dl, 16 cmp dl, 16
jae .exit jae .exit
mov esi, sdsh_data.v13 lea esi, [sdsh_data.v13 + edx*4]
lea esi,[esi+edx*4] ; 4-byte tickgroups .v13-16: 4 ticks each
mov dh, 13 mov dh, 13
shr dl, 2 shr dl, 2
add dl, dh
.gptick.done: .gptick.done:
add dl, dh
mov dh, ch ; dh = orig.XY; dl = numvert mov dh, ch ; dh = orig.XY; dl = numvert
jmp .draw ; cl = rotation jmp .draw ; cl = rotation; esi-> tickfield
.cstick: .cstick:
and cl, 4 and cl, 4
shr cl, 2 ; only one rotational bit shr cl, 2 ; only one rotational bit
and dl, 3 and dl, 3
inc dl
dec dl
jz .cstick.0 jz .cstick.0
dec dl dec dl
jnz @f jnz @f
mov dl, 6 mov dl, 6
jz .cstick.1 jz .cstick.1 ; 8-pix square outline
@@: dec dl @@: dec dl
jz .cstick.2 jz .cstick.2
.cstick.3: .cstick.3:
@ -298,20 +300,20 @@ diff16 "parse_tick : ",0,$
mov dl, 10 mov dl, 10
jmp .draw jmp .draw
.cstick.2: .cstick.2:
mov dl, 7 mov dl, 7 ; 9-pix filled square
.cstick.1: .cstick.1:
mov esi, sdsh_data.cs2 ; the square mov esi, sdsh_data.cs2 ; the square tickfield
jmp .draw jmp .draw
.cstick.0: .cstick.0:
mov esi, sdsh_data.cs0 ; 4pix-square mov esi, sdsh_data.cs0 ; 4pix-square
mov dl, 3 mov dl, 2
jmp .draw jmp .draw
.ritick: .ritick:
test dl, 1 test dl, 1
jnz .ritick.1 jnz .ritick.1
.ritick.0: .ritick.0:
mov cl, dh ; y movzx ecx, dh ; y
and cl, 0x0F and cl, 0x0F
sub ebx, ecx sub ebx, ecx
mov cl, dh mov cl, dh
@ -321,8 +323,7 @@ diff16 "parse_tick : ",0,$
jmp .exit jmp .exit
.ritick.1: .ritick.1:
mov esi, sdsh_data.ri1 ; 8pix-ring mov esi, sdsh_data.ri1 ; 8pix-ring
mov dl, 4 mov dl, 6
xor cl, cl
jmp .draw jmp .draw
.lntick.short: .lntick.short:
@ -338,10 +339,11 @@ diff16 "parse_tick : ",0,$
and cl, 0x18 ; two (lower) rotation bits and cl, 0x18 ; two (lower) rotation bits
shr cl, 3 shr cl, 3
mov esi, sdsh_data.blank mov esi, sdsh_data.blank
.draw: .draw:
; cl = rot; dl = numvert; dh = orig.xy ; cl = rot; dl = numvert; dh = orig.xy
push ecx push ecx
mov cl, dh ; y movzx ecx, dh ; y
and cl, 0x0F and cl, 0x0F
sub ebx, ecx sub ebx, ecx
mov cl, dh mov cl, dh

View File

@ -40,11 +40,11 @@ end if
align 4 align 4
; ---- special tickfields ---- ; ---- special tickfields ----
.blank db 0, 0, 0, 0 ; for straight lines .blank db 0, 0, 0, 0 ; for straight lines
.cs2 db 11001100b, 111100b .cs2 db 11001100b, 111100b
.cs3 db 00010100b, 01000101b, 0001b .cs3 db 00010100b, 01000101b, 0001b
.cs0 db 111111b ; 4-pix square .cs0 db 1111b ; 4-pix square
.ri1 db 01010101b ; 8-pix ring (rot-invariant) .ri1 db 01010101b, 0101b ; 8-pix ring (rot-invariant)
align 16 align 16
.info: .info: