3030#endif
3131
3232#if defined(FEAT_DIRECTX )
33+ # ifndef FEAT_MBYTE
34+ # error FEAT_MBYTE is required for FEAT_DIRECTX.
35+ # endif
3336static DWriteContext * s_dwc = NULL ;
3437static int s_directx_enabled = 0 ;
3538static int s_directx_load_attempted = 0 ;
3639static int s_directx_scrlines = 0 ;
37- # define IS_ENABLE_DIRECTX () (s_directx_enabled && s_dwc != NULL)
40+ # define IS_ENABLE_DIRECTX () (s_directx_enabled && s_dwc != NULL && enc_utf8 )
3841static int directx_enabled (void );
3942static void directx_binddc (void );
4043#endif
@@ -47,7 +50,7 @@ static int gui_mswin_get_menu_height(int fix_window);
4750 int
4851gui_mch_set_rendering_options (char_u * s )
4952{
50- #ifdef FEAT_DIRECTX
53+ # ifdef FEAT_DIRECTX
5154 char_u * p , * q ;
5255
5356 int dx_enable = 0 ;
@@ -159,9 +162,9 @@ gui_mch_set_rendering_options(char_u *s)
159162 s_directx_scrlines = dx_scrlines ;
160163
161164 return OK ;
162- #else
165+ # else
163166 return FAIL ;
164- #endif
167+ # endif
165168}
166169#endif
167170
@@ -3140,7 +3143,8 @@ gui_mch_delete_lines(
31403143 {
31413144 if (s_directx_scrlines > 0 && s_directx_scrlines <= num_lines )
31423145 {
3143- RedrawWindow (s_textArea , & rc , NULL , RDW_INVALIDATE );
3146+ gui_redraw (rc .left , rc .top ,
3147+ rc .right - rc .left + 1 , rc .bottom - rc .top + 1 );
31443148 use_redraw = 1 ;
31453149 }
31463150 else
@@ -3152,9 +3156,9 @@ gui_mch_delete_lines(
31523156 intel_gpu_workaround ();
31533157 ScrollWindowEx (s_textArea , 0 , - num_lines * gui .char_height ,
31543158 & rc , & rc , NULL , NULL , get_scroll_flags ());
3159+ UpdateWindow (s_textArea );
31553160 }
31563161
3157- UpdateWindow (s_textArea );
31583162 /* This seems to be required to avoid the cursor disappearing when
31593163 * scrolling such that the cursor ends up in the top-left character on
31603164 * the screen... But why? (Webb) */
@@ -3190,7 +3194,8 @@ gui_mch_insert_lines(
31903194 {
31913195 if (s_directx_scrlines > 0 && s_directx_scrlines <= num_lines )
31923196 {
3193- RedrawWindow (s_textArea , & rc , NULL , RDW_INVALIDATE );
3197+ gui_redraw (rc .left , rc .top ,
3198+ rc .right - rc .left + 1 , rc .bottom - rc .top + 1 );
31943199 use_redraw = 1 ;
31953200 }
31963201 else
@@ -3204,10 +3209,9 @@ gui_mch_insert_lines(
32043209 * off-screen. How do we avoid it when it's not needed? */
32053210 ScrollWindowEx (s_textArea , 0 , num_lines * gui .char_height ,
32063211 & rc , & rc , NULL , NULL , get_scroll_flags ());
3212+ UpdateWindow (s_textArea );
32073213 }
32083214
3209- UpdateWindow (s_textArea );
3210-
32113215 gui_clear_block (row , gui .scroll_region_left ,
32123216 row + num_lines - 1 , gui .scroll_region_right );
32133217}
@@ -6401,13 +6405,13 @@ gui_mch_draw_string(
64016405 if (text [n ] >= 0x80 )
64026406 break ;
64036407
6404- #if defined(FEAT_DIRECTX )
6408+ # if defined(FEAT_DIRECTX )
64056409 /* Quick hack to enable DirectWrite. To use DirectWrite (antialias), it is
64066410 * required that unicode drawing routine, currently. So this forces it
64076411 * enabled. */
6408- if (enc_utf8 && IS_ENABLE_DIRECTX ())
6412+ if (IS_ENABLE_DIRECTX ())
64096413 n = 0 ; /* Keep n < len, to enter block for unicode. */
6410- #endif
6414+ # endif
64116415
64126416 /* Check if the Unicode buffer exists and is big enough. Create it
64136417 * with the same length as the multi-byte string, the number of wide
@@ -6480,7 +6484,7 @@ gui_mch_draw_string(
64806484 i += utf_ptr2len_len (text + i , len - i );
64816485 ++ clen ;
64826486 }
6483- #if defined(FEAT_DIRECTX )
6487+ # if defined(FEAT_DIRECTX )
64846488 if (IS_ENABLE_DIRECTX ())
64856489 {
64866490 /* Add one to "cells" for italics. */
@@ -6490,7 +6494,7 @@ gui_mch_draw_string(
64906494 foptions , pcliprect , unicodepdy );
64916495 }
64926496 else
6493- #endif
6497+ # endif
64946498 ExtTextOutW (s_hdc , TEXT_X (col ), TEXT_Y (row ),
64956499 foptions , pcliprect , unicodebuf , wlen , unicodepdy );
64966500 len = cells ; /* used for underlining */
0 commit comments