forked from KolibriOS/kolibrios
Font smoothing options
git-svn-id: svn://kolibrios.org@5847 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
f8bce77141
commit
fbdb5951a3
@ -249,44 +249,44 @@ drawChar:
|
|||||||
inc esi
|
inc esi
|
||||||
cmp [fontSmoothing], 0
|
cmp [fontSmoothing], 0
|
||||||
jz .nextPixel
|
jz .nextPixel
|
||||||
.checkLeftSubP: ; subpixel smoothing
|
.checkLeftSM: ; smoothing
|
||||||
bsf eax, edx
|
bsf eax, edx
|
||||||
dec eax
|
dec eax
|
||||||
js .checkRightSubP
|
js .checkRightSM
|
||||||
bt [ebx], eax
|
bt [ebx], eax
|
||||||
jc .checkRightSubP
|
jc .checkRightSM
|
||||||
dec eax
|
dec eax
|
||||||
js .checkLeftDownSubP
|
js .checkLeftDownSM
|
||||||
bt [ebx], eax
|
bt [ebx], eax
|
||||||
jc .checkRightSubP
|
jc .checkRightSM
|
||||||
.checkLeftDownSubP:
|
.checkLeftDownSM:
|
||||||
inc eax
|
inc eax
|
||||||
bt [ebx+1], eax
|
bt [ebx+1], eax
|
||||||
jnc .checkLeftUpSubP
|
jnc .checkLeftUpSM
|
||||||
inc eax
|
inc eax
|
||||||
bt [ebx+1], eax
|
bt [ebx+1], eax
|
||||||
jnc @f
|
jnc @f
|
||||||
bt [ebx-1], eax
|
bt [ebx-1], eax
|
||||||
jc .checkRightSubP
|
jc .checkRightSM
|
||||||
dec eax
|
dec eax
|
||||||
dec eax
|
dec eax
|
||||||
js @f
|
js @f
|
||||||
bt [ebx+1], eax
|
bt [ebx+1], eax
|
||||||
jnc @f
|
jnc @f
|
||||||
inc eax
|
inc eax
|
||||||
.checkLeftUpSubP:
|
.checkLeftUpSM:
|
||||||
bt [ebx-1], eax
|
bt [ebx-1], eax
|
||||||
jnc .checkRightSubP
|
jnc .checkRightSM
|
||||||
inc eax
|
inc eax
|
||||||
bt [ebx-1], eax
|
bt [ebx-1], eax
|
||||||
jnc @f
|
jnc @f
|
||||||
bt [ebx+1], eax
|
bt [ebx+1], eax
|
||||||
jc .checkRightSubP
|
jc .checkRightSM
|
||||||
dec eax
|
dec eax
|
||||||
dec eax
|
dec eax
|
||||||
js @f
|
js @f
|
||||||
bt [ebx-1], eax
|
bt [ebx-1], eax
|
||||||
jc .checkRightSubP
|
jc .checkRightSM
|
||||||
@@:
|
@@:
|
||||||
mov ecx, [esp+20+deltaToScreen]
|
mov ecx, [esp+20+deltaToScreen]
|
||||||
mov eax, [edi-4]
|
mov eax, [edi-4]
|
||||||
@ -301,6 +301,11 @@ drawChar:
|
|||||||
push ebx edx
|
push ebx edx
|
||||||
mov ebx, ebp
|
mov ebx, ebp
|
||||||
xor ecx, ecx
|
xor ecx, ecx
|
||||||
|
cmp [fontSmoothing], 1
|
||||||
|
jnz .subpixelLeft
|
||||||
|
call antiAliasing
|
||||||
|
jmp @f
|
||||||
|
.subpixelLeft:
|
||||||
mov cl, bl
|
mov cl, bl
|
||||||
lea edx, [ecx*8+ecx]
|
lea edx, [ecx*8+ecx]
|
||||||
lea edx, [ecx*2+edx]
|
lea edx, [ecx*2+edx]
|
||||||
@ -332,9 +337,10 @@ drawChar:
|
|||||||
shr ecx, 3
|
shr ecx, 3
|
||||||
mov al, cl
|
mov al, cl
|
||||||
rol eax, 16
|
rol eax, 16
|
||||||
|
@@:
|
||||||
mov [edi-4], eax
|
mov [edi-4], eax
|
||||||
pop edx ebx
|
pop edx ebx
|
||||||
.checkRightSubP:
|
.checkRightSM:
|
||||||
bsf eax, edx
|
bsf eax, edx
|
||||||
inc eax
|
inc eax
|
||||||
bt [ebx], eax
|
bt [ebx], eax
|
||||||
@ -343,9 +349,9 @@ drawChar:
|
|||||||
bt [ebx], eax
|
bt [ebx], eax
|
||||||
jc .nextPixel
|
jc .nextPixel
|
||||||
dec eax
|
dec eax
|
||||||
.checkRightDownSubP:
|
.checkRightDownSM:
|
||||||
bt [ebx+1], eax
|
bt [ebx+1], eax
|
||||||
jnc .checkRightUpSubP
|
jnc .checkRightUpSM
|
||||||
dec eax
|
dec eax
|
||||||
bt [ebx+1], eax
|
bt [ebx+1], eax
|
||||||
jnc @f
|
jnc @f
|
||||||
@ -356,7 +362,7 @@ drawChar:
|
|||||||
bt [ebx+1], eax
|
bt [ebx+1], eax
|
||||||
jnc @f
|
jnc @f
|
||||||
dec eax
|
dec eax
|
||||||
.checkRightUpSubP:
|
.checkRightUpSM:
|
||||||
bt [ebx-1], eax
|
bt [ebx-1], eax
|
||||||
jnc .nextPixel
|
jnc .nextPixel
|
||||||
dec eax
|
dec eax
|
||||||
@ -382,6 +388,11 @@ drawChar:
|
|||||||
push ebx edx
|
push ebx edx
|
||||||
mov ebx, ebp
|
mov ebx, ebp
|
||||||
xor ecx, ecx
|
xor ecx, ecx
|
||||||
|
cmp [fontSmoothing], 1
|
||||||
|
jnz .subpixelRight
|
||||||
|
call antiAliasing
|
||||||
|
jmp @f
|
||||||
|
.subpixelRight:
|
||||||
mov cl, al
|
mov cl, al
|
||||||
mov edx, ecx
|
mov edx, ecx
|
||||||
shl ecx, 3
|
shl ecx, 3
|
||||||
@ -413,6 +424,7 @@ drawChar:
|
|||||||
shr edx, 4
|
shr edx, 4
|
||||||
mov al, dl
|
mov al, dl
|
||||||
rol eax, 16
|
rol eax, 16
|
||||||
|
@@:
|
||||||
mov [edi+4], eax
|
mov [edi+4], eax
|
||||||
pop edx ebx
|
pop edx ebx
|
||||||
jmp .nextPixel
|
jmp .nextPixel
|
||||||
@ -756,7 +768,25 @@ drawChar:
|
|||||||
jnz drawChar
|
jnz drawChar
|
||||||
ret
|
ret
|
||||||
|
|
||||||
fontSmoothing db 1
|
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
|
||||||
|
|
||||||
|
fontSmoothing db 2
|
||||||
font1:
|
font1:
|
||||||
if lang eq sp
|
if lang eq sp
|
||||||
file 'char_sp.mt'
|
file 'char_sp.mt'
|
||||||
|
@ -30,11 +30,8 @@ uglobal
|
|||||||
draw_limits RECT
|
draw_limits RECT
|
||||||
endg
|
endg
|
||||||
|
|
||||||
align 4
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
syscall_draw_window: ;///// system function 0 /////////////////////////////////
|
syscall_draw_window: ;///// system function 0 /////////////////////////////////
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
;? <description>.
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
mov eax, edx
|
mov eax, edx
|
||||||
shr eax, 24
|
shr eax, 24
|
||||||
@ -49,34 +46,28 @@ syscall_draw_window: ;///// system function 0 /////////////////////////////////
|
|||||||
or al, al
|
or al, al
|
||||||
jnz @f
|
jnz @f
|
||||||
|
|
||||||
; type I - original style
|
; type I - original style
|
||||||
call drawwindow_I
|
call drawwindow_I
|
||||||
jmp window._.draw_window_caption.2
|
jmp window._.draw_window_caption.2
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
|
||||||
@@:
|
@@:
|
||||||
dec al
|
dec al
|
||||||
jnz @f
|
jnz @f
|
||||||
|
|
||||||
; type II - only reserve area, no draw
|
; type II - only reserve area, no draw
|
||||||
; call sys_window_mouse
|
|
||||||
; call [draw_pointer]
|
|
||||||
call __sys_draw_pointer
|
call __sys_draw_pointer
|
||||||
jmp .exit
|
jmp .exit
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
|
||||||
@@:
|
@@:
|
||||||
dec al
|
dec al
|
||||||
jnz @f
|
jnz @f
|
||||||
|
|
||||||
; type III - new style
|
; type III - new style
|
||||||
call drawwindow_III
|
call drawwindow_III
|
||||||
jmp window._.draw_window_caption.2
|
jmp window._.draw_window_caption.2
|
||||||
|
|
||||||
; type IV & V - skinned window (resizable & not)
|
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
|
||||||
@@:
|
@@:
|
||||||
|
; type IV & V - skinned window (resizable & not)
|
||||||
mov eax, [TASK_COUNT]
|
mov eax, [TASK_COUNT]
|
||||||
movzx eax, word[WIN_POS + eax * 2]
|
movzx eax, word[WIN_POS + eax * 2]
|
||||||
cmp eax, [CURRENT_TASK]
|
cmp eax, [CURRENT_TASK]
|
||||||
@ -86,12 +77,9 @@ align 4
|
|||||||
call drawwindow_IV
|
call drawwindow_IV
|
||||||
jmp window._.draw_window_caption.2
|
jmp window._.draw_window_caption.2
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
|
||||||
.exit:
|
.exit:
|
||||||
ret
|
ret
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
align 4
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
syscall_display_settings: ;///// system function 48 ///////////////////////////
|
syscall_display_settings: ;///// system function 48 ///////////////////////////
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
;; Redraw screen:
|
;; Redraw screen:
|
||||||
@ -135,77 +123,64 @@ syscall_display_settings: ;///// system function 48 ///////////////////////////
|
|||||||
;< ecx = pointer to FileInfoBlock struct
|
;< ecx = pointer to FileInfoBlock struct
|
||||||
;> eax = FS error code
|
;> eax = FS error code
|
||||||
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
;; Set font smoothing:
|
;; Get font smoothing:
|
||||||
;< ebx = 9
|
;< ebx = 9
|
||||||
;< ecx = 0 (off) or !0 (on)
|
;> eax = 0 — off, 1 — on, 2 — subpixel
|
||||||
|
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
;; Set font smoothing:
|
||||||
|
;< ebx = 10
|
||||||
|
;< ecx = 0 — off, 1 — on, 2 — subpixel
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
cmp ebx, .sizeof.ftable / 4
|
cmp ebx, .sizeof.ftable / 4
|
||||||
ja @f
|
ja @f
|
||||||
jmp [.ftable + ebx * 4]
|
jmp [.ftable + ebx * 4]
|
||||||
;--------------------------------------
|
|
||||||
align 4
|
|
||||||
@@:
|
|
||||||
ret
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
align 4
|
|
||||||
syscall_display_settings.00:
|
syscall_display_settings.00:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
inc ebx
|
inc ebx
|
||||||
cmp [windowtypechanged], ebx
|
cmp [windowtypechanged], ebx
|
||||||
jne .exit
|
jne @f
|
||||||
mov [windowtypechanged], eax
|
mov [windowtypechanged], eax
|
||||||
|
|
||||||
jmp syscall_display_settings._.redraw_whole_screen
|
jmp syscall_display_settings._.redraw_whole_screen
|
||||||
;--------------------------------------
|
|
||||||
align 4
|
|
||||||
.exit:
|
|
||||||
ret
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
align 4
|
|
||||||
syscall_display_settings.01:
|
syscall_display_settings.01:
|
||||||
and ecx, 1
|
and ecx, 1
|
||||||
cmp ecx, [buttontype]
|
cmp ecx, [buttontype]
|
||||||
je .exit
|
je @f
|
||||||
mov [buttontype], ecx
|
mov [buttontype], ecx
|
||||||
mov [windowtypechanged], ebx
|
mov [windowtypechanged], ebx
|
||||||
;--------------------------------------
|
@@:
|
||||||
align 4
|
|
||||||
.exit:
|
|
||||||
ret
|
ret
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
align 4
|
|
||||||
syscall_display_settings.02:
|
syscall_display_settings.02:
|
||||||
dec ebx
|
dec ebx
|
||||||
mov esi, ecx
|
mov esi, ecx
|
||||||
cmp edx, 192
|
cmp edx, 192
|
||||||
jnae @f
|
jnae @f
|
||||||
mov edx, 192 ; max size
|
mov edx, 192 ; max size
|
||||||
@@:
|
@@:
|
||||||
mov edi, common_colours
|
mov edi, common_colours
|
||||||
mov ecx, edx
|
mov ecx, edx
|
||||||
rep movsb
|
rep movsb
|
||||||
mov [windowtypechanged], ebx
|
mov [windowtypechanged], ebx
|
||||||
ret
|
ret
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
align 4
|
|
||||||
syscall_display_settings.03:
|
syscall_display_settings.03:
|
||||||
mov edi, ecx
|
mov edi, ecx
|
||||||
cmp edx, 192
|
cmp edx, 192
|
||||||
jnae @f
|
jnae @f
|
||||||
mov edx, 192 ; max size
|
mov edx, 192 ; max size
|
||||||
@@:
|
@@:
|
||||||
mov esi, common_colours
|
mov esi, common_colours
|
||||||
mov ecx, edx
|
mov ecx, edx
|
||||||
rep movsb
|
rep movsb
|
||||||
ret
|
ret
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
align 4
|
|
||||||
syscall_display_settings.04:
|
syscall_display_settings.04:
|
||||||
mov eax, [_skinh]
|
mov eax, [_skinh]
|
||||||
mov [esp + 32], eax
|
mov [esp + 32], eax
|
||||||
ret
|
ret
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
align 4
|
|
||||||
syscall_display_settings.05:
|
syscall_display_settings.05:
|
||||||
mov eax, [screen_workarea.left - 2]
|
mov eax, [screen_workarea.left - 2]
|
||||||
mov ax, word[screen_workarea.right]
|
mov ax, word[screen_workarea.right]
|
||||||
@ -215,10 +190,8 @@ syscall_display_settings.05:
|
|||||||
mov [esp + 20], eax
|
mov [esp + 20], eax
|
||||||
ret
|
ret
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
align 4
|
|
||||||
syscall_display_settings.06:
|
syscall_display_settings.06:
|
||||||
xor esi, esi
|
xor esi, esi
|
||||||
|
|
||||||
mov edi, [_display.width]
|
mov edi, [_display.width]
|
||||||
dec edi
|
dec edi
|
||||||
mov eax, ecx
|
mov eax, ecx
|
||||||
@ -230,19 +203,13 @@ syscall_display_settings.06:
|
|||||||
or eax, eax
|
or eax, eax
|
||||||
jge @f
|
jge @f
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
;--------------------------------------
|
|
||||||
align 4
|
|
||||||
@@:
|
@@:
|
||||||
mov [screen_workarea.left], eax
|
mov [screen_workarea.left], eax
|
||||||
cmp ebx, edi
|
cmp ebx, edi
|
||||||
jle @f
|
jle @f
|
||||||
mov ebx, edi
|
mov ebx, edi
|
||||||
;--------------------------------------
|
|
||||||
align 4
|
|
||||||
@@:
|
@@:
|
||||||
mov [screen_workarea.right], ebx
|
mov [screen_workarea.right], ebx
|
||||||
;--------------------------------------
|
|
||||||
align 4
|
|
||||||
.check_horizontal:
|
.check_horizontal:
|
||||||
mov edi, [_display.height]
|
mov edi, [_display.height]
|
||||||
dec edi
|
dec edi
|
||||||
@ -255,59 +222,48 @@ align 4
|
|||||||
or eax, eax
|
or eax, eax
|
||||||
jge @f
|
jge @f
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
;--------------------------------------
|
|
||||||
align 4
|
|
||||||
@@:
|
@@:
|
||||||
mov [screen_workarea.top], eax
|
mov [screen_workarea.top], eax
|
||||||
cmp ebx, edi
|
cmp ebx, edi
|
||||||
jle @f
|
jle @f
|
||||||
mov ebx, edi
|
mov ebx, edi
|
||||||
;--------------------------------------
|
|
||||||
align 4
|
|
||||||
@@:
|
@@:
|
||||||
mov [screen_workarea.bottom], ebx
|
mov [screen_workarea.bottom], ebx
|
||||||
;--------------------------------------
|
|
||||||
align 4
|
|
||||||
.check_if_redraw_needed:
|
.check_if_redraw_needed:
|
||||||
or esi, esi
|
or esi, esi
|
||||||
jz .exit
|
jz @f
|
||||||
|
|
||||||
call repos_windows
|
call repos_windows
|
||||||
jmp syscall_display_settings._.calculate_whole_screen
|
jmp syscall_display_settings._.calculate_whole_screen
|
||||||
;--------------------------------------
|
|
||||||
align 4
|
|
||||||
.exit:
|
|
||||||
ret
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
align 4
|
|
||||||
syscall_display_settings.07:
|
syscall_display_settings.07:
|
||||||
mov eax, [_skinmargins + 0]
|
mov eax, [_skinmargins + 0]
|
||||||
mov [esp + 32], eax
|
mov [esp + 32], eax
|
||||||
mov eax, [_skinmargins + 4]
|
mov eax, [_skinmargins + 4]
|
||||||
mov [esp + 20], eax
|
mov [esp + 20], eax
|
||||||
|
@@:
|
||||||
ret
|
ret
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
align 4
|
|
||||||
syscall_display_settings.08:
|
syscall_display_settings.08:
|
||||||
mov ebx, ecx
|
mov ebx, ecx
|
||||||
call read_skin_file
|
call read_skin_file
|
||||||
mov [esp + 32], eax
|
mov [esp + 32], eax
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz .exit
|
jnz @b
|
||||||
|
|
||||||
call syscall_display_settings._.calculate_whole_screen
|
call syscall_display_settings._.calculate_whole_screen
|
||||||
jmp syscall_display_settings._.redraw_whole_screen
|
jmp syscall_display_settings._.redraw_whole_screen
|
||||||
;--------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
align 4
|
syscall_display_settings.09:
|
||||||
.exit:
|
xor eax, eax
|
||||||
|
mov al, [fontSmoothing]
|
||||||
|
mov [esp + 32], eax
|
||||||
ret
|
ret
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
align 4
|
syscall_display_settings.10:
|
||||||
syscall_display_settings.09:
|
|
||||||
mov [fontSmoothing], cl
|
mov [fontSmoothing], cl
|
||||||
ret
|
ret
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
align 4
|
|
||||||
syscall_display_settings._.calculate_whole_screen:
|
syscall_display_settings._.calculate_whole_screen:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
xor ebx, ebx
|
xor ebx, ebx
|
||||||
@ -317,7 +273,6 @@ syscall_display_settings._.calculate_whole_screen:
|
|||||||
dec edx
|
dec edx
|
||||||
jmp calculatescreen
|
jmp calculatescreen
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
align 4
|
|
||||||
syscall_display_settings._.redraw_whole_screen:
|
syscall_display_settings._.redraw_whole_screen:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [draw_limits.left], eax
|
mov [draw_limits.left], eax
|
||||||
@ -331,8 +286,6 @@ syscall_display_settings._.redraw_whole_screen:
|
|||||||
mov eax, window_data
|
mov eax, window_data
|
||||||
jmp redrawscreen
|
jmp redrawscreen
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
align 4
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
syscall_set_window_shape: ;///// system function 50 ///////////////////////////
|
syscall_set_window_shape: ;///// system function 50 ///////////////////////////
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
;; Set window shape address:
|
;; Set window shape address:
|
||||||
@ -1447,7 +1400,7 @@ sys_window_moving_handler: ;///////////////////////////////////////////////////
|
|||||||
|
|
||||||
iglobal
|
iglobal
|
||||||
FuncTable syscall_display_settings, ftable, \
|
FuncTable syscall_display_settings, ftable, \
|
||||||
00, 01, 02, 03, 04, 05, 06, 07, 08, 09
|
00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
window_topleft dd \
|
window_topleft dd \
|
||||||
|
Loading…
Reference in New Issue
Block a user