let $VIM_FILEPATH = expand("%:p")
let $VIM_FILENAME = expand("%:t")
let $VIM_FILEDIR = expand("%:p:h")
let $VIM_FILENOEXT = expand("%:t:r")
let $VIM_FILEEXT = "." . expand("%:e")
let $VIM_CWD = expand("%:p:h:h")
let $VIM_RELDIR = expand("%:h")
let $VIM_RELNAME = expand("%:p:.")
let $VIM_CWORD = expand("<cword>")
let $VIM_VERSION = ''.v:version
let $VIM_MODE = ''. a:mode
let $VIM_GUI = '0'
let $VIM_SCRIPT = g:vimmake_path
let $VIM_SVRNAME = v:servername
if has("gui_running")
let $VIM_GUI = '1'
endif
" make tabline in terminal mode
function! Vim_NeatTabLine()
let s = ''
for i in range(tabpagenr('$'))
" select the highlighting
if i + 1 == tabpagenr()
let s .= '%#TabLineSel#'
else
let s .= '%#TabLine#'
endif
" set the tab page number (for mouse clicks)
let s .= '%' . (i + 1) . 'T'
" the label is made by MyTabLabel()
let s .= ' %{Vim_NeatTabLabel(' . (i + 1) . ')} '
endfor
" after the last tab fill with TabLineFill and reset tab page nr
let s .= '%#TabLineFill#%T'
" right-align the label to close the current tab page
if tabpagenr('$') > 1
let s .= '%=%#TabLine#%999XX'
endif
return s
endfunc
" get a single tab name
function! Vim_NeatBuffer(bufnr, fullname)
let l:name = bufname(a:bufnr)
if getbufvar(a:bufnr, '&modifiable')
if l:name == ''
return '[No Name]'
else
if a:fullname
return fnamemodify(l:name, ':p')
else
return fnamemodify(l:name, ':t')
endif
endif
else
let l:buftype = getbufvar(a:bufnr, '&buftype')
if l:buftype == 'quickfix'
return '[Quickfix]'
elseif l:name != ''
if a:fullname
return '-'.fnamemodify(l:name, ':p')
else
return '-'.fnamemodify(l:name, ':t')
endif
else
endif
return '[No Name]'
endif
endfunc
" get a single tab label
function! Vim_NeatTabLabel(n)
let l:buflist = tabpagebuflist(a:n)
let l:winnr = tabpagewinnr(a:n)
let l:bufnr = l:buflist[l:winnr - 1]
return Vim_NeatBuffer(l:bufnr, 0)
endfunc
" get a single tab label in gui
function! Vim_NeatGuiTabLabel()
let l:num = v:lnum
let l:buflist = tabpagebuflist(l:num)
let l:winnr = tabpagewinnr(l:num)
let l:bufnr = l:buflist[l:winnr - 1]
return Vim_NeatBuffer(l:bufnr, 0)
endfunc
" setup new tabline, just like %M%t in macvim
set tabline=%!Vim_NeatTabLine()
set guitablabel=%{Vim_NeatGuiTabLabel()}
在 GUI 模式下,还可以配置标签的 TIPS,鼠标移动到标签上,会自动显示该 TIPS:
" get a label tips
function! Vim_NeatGuiTabTip()
let tip = ''
let bufnrlist = tabpagebuflist(v:lnum)
for bufnr in bufnrlist
" separate buffer entries
if tip != ''
let tip .= " \n"
endif
" Add name of buffer
let name = Vim_NeatBuffer(bufnr, 1)
let tip .= name
" add modified/modifiable flags
if getbufvar(bufnr, "&modified")
let tip .= ' [+]'
endif
if getbufvar(bufnr, "&modifiable")==0
let tip .= ' [-]'
endif
endfor
return tip
endfunc
set guitabtooltip=%{Vim_NeatGuiTabTip()}
Full window (800×600) blitting (both opacity and transparent), compare to GDI/SDL/DirectDraw:
32 Bits Blit
Opacity
Transparent
BasicBitmap C++
fps=2325
fps=1368
BasicBitmap AVX/SSE2
fps=2904
fps=2531
GDI
fps=2333
fps=1167
SDL
fps=2671
fps=1015
DirectDraw
fps=2695
fps=2090
Note: use BltFast with DirectDrawSurface7 in System Memory to perform Opacity & Transparent blit. BitBlt and TransparentBlt(msimg32.dll) are used in the GDI testing case.
16 Bits Blit
Opacity
Transparent
BasicBitmap C++
fps=4494
fps=1253
BasicBitmap AVX/SSE2
fps=9852
fps=2909
DirectDraw BltFast
fps=5889
fps=861
Blitting performance in SDL & GDI are slower than DirectDraw, just compare to ddraw as well.
8 Bits Blit
Opacity
Transparent
BasicBitmap C++
fps=11142
fps=1503
BasicBitmap AVX/SSE2
fps=18181
fps=5449
DirectDraw BltFast
fps=14705
fps=4832
DirectDrawSurface in Video Memory takes the benefit of hardware acceleration which is definitely faster than BasicBitmap. If you really need hardware acceleration, use OpenGL/DX as well.
BasicBitmap is a software implementation which aims to achieve the best performance in all other software implementations: like GDI/GDI+, SDL/DirectDraw in System Memory, for examples.
So just compare to DirectDrawSurface in System Memory. Use it in the condition that you only need a lightweight software solution: GUI/Cross Platform/hardware unavailable/image processing/video compositing, etc.
混色性能比较
SRC OVER
FPS
BasicBitmap C++
594
BasicBitmap SSE2
1731
GDI (msimg32.dll)
1137
note: 800×600 full window src-over blending vs GDI’s AlphaBlend function (in msimg32.dll).