diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-01-31 20:51:47 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-01-31 20:51:47 +0100 |
commit | a338adcf222b6a24e26ea5ae6a2ad27f914acb38 (patch) | |
tree | 0ffe28d0a3a60c2c1444a991514505c448d4335b /src/gui_w32.c | |
parent | 37badc898b8d167e11553b6d05908ffd35928a6e (diff) | |
download | vim-git-a338adcf222b6a24e26ea5ae6a2ad27f914acb38.tar.gz |
patch 8.0.1449: slow redrawing with DirectXv8.0.1449
Problem: Slow redrawing with DirectX.
Solution: Avoid calling gui_mch_flush() unnecessarily, especially when
updating the cursor. (Ken Takata, closes #2560)
Diffstat (limited to 'src/gui_w32.c')
-rw-r--r-- | src/gui_w32.c | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/src/gui_w32.c b/src/gui_w32.c index 3c745b4fe..074954a6c 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -36,7 +36,6 @@ static DWriteContext *s_dwc = NULL; static int s_directx_enabled = 0; static int s_directx_load_attempted = 0; -static int s_directx_scrlines = 0; # define IS_ENABLE_DIRECTX() (s_directx_enabled && s_dwc != NULL && enc_utf8) static int directx_enabled(void); static void directx_binddc(void); @@ -61,7 +60,6 @@ gui_mch_set_rendering_options(char_u *s) int dx_geom = 0; int dx_renmode = 0; int dx_taamode = 0; - int dx_scrlines = 0; /* parse string as rendering options. */ for (p = s; p != NULL && *p != NUL; ) @@ -124,7 +122,7 @@ gui_mch_set_rendering_options(char_u *s) } else if (STRCMP(name, "scrlines") == 0) { - dx_scrlines = atoi((char *)value); + /* Deprecated. Simply ignore it. */ } else return FAIL; @@ -159,7 +157,6 @@ gui_mch_set_rendering_options(char_u *s) } } s_directx_enabled = dx_enable; - s_directx_scrlines = dx_scrlines; return OK; # else @@ -3129,9 +3126,6 @@ gui_mch_delete_lines( int num_lines) { RECT rc; -#if defined(FEAT_DIRECTX) - int use_redraw = 0; -#endif rc.left = FILL_X(gui.scroll_region_left); rc.right = FILL_X(gui.scroll_region_right + 1); @@ -3141,16 +3135,10 @@ gui_mch_delete_lines( #if defined(FEAT_DIRECTX) if (IS_ENABLE_DIRECTX()) { - if (s_directx_scrlines > 0 && s_directx_scrlines <= num_lines) - { - gui_redraw(rc.left, rc.top, - rc.right - rc.left + 1, rc.bottom - rc.top + 1); - use_redraw = 1; - } - else - DWriteContext_Flush(s_dwc); + DWriteContext_Scroll(s_dwc, 0, -num_lines * gui.char_height, &rc); + DWriteContext_Flush(s_dwc); } - if (!use_redraw) + else #endif { intel_gpu_workaround(); @@ -3180,9 +3168,6 @@ gui_mch_insert_lines( int num_lines) { RECT rc; -#if defined(FEAT_DIRECTX) - int use_redraw = 0; -#endif rc.left = FILL_X(gui.scroll_region_left); rc.right = FILL_X(gui.scroll_region_right + 1); @@ -3192,16 +3177,10 @@ gui_mch_insert_lines( #if defined(FEAT_DIRECTX) if (IS_ENABLE_DIRECTX()) { - if (s_directx_scrlines > 0 && s_directx_scrlines <= num_lines) - { - gui_redraw(rc.left, rc.top, - rc.right - rc.left + 1, rc.bottom - rc.top + 1); - use_redraw = 1; - } - else - DWriteContext_Flush(s_dwc); + DWriteContext_Scroll(s_dwc, 0, num_lines * gui.char_height, &rc); + DWriteContext_Flush(s_dwc); } - if (!use_redraw) + else #endif { intel_gpu_workaround(); @@ -4024,7 +4003,10 @@ _OnScroll( * position, but don't actually scroll by setting "dont_scroll". */ dont_scroll = !allow_scrollbar; + mch_disable_flush(); gui_drag_scrollbar(sb, val, dragging); + mch_enable_flush(); + gui_may_flush(); s_busy_processing = FALSE; dont_scroll = dont_scroll_save; @@ -4651,6 +4633,7 @@ _OnMouseWheel( if (mouse_scroll_lines == 0) init_mouse_wheel(); + mch_disable_flush(); if (mouse_scroll_lines > 0 && mouse_scroll_lines < (size > 2 ? size - 2 : 1)) { @@ -4659,6 +4642,8 @@ _OnMouseWheel( } else _OnScroll(hwnd, hwndCtl, zDelta >= 0 ? SB_PAGEUP : SB_PAGEDOWN, 0); + mch_enable_flush(); + gui_may_flush(); } #ifdef USE_SYSMENU_FONT |