summaryrefslogtreecommitdiffstats
path: root/src/gui_w32.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-12-14 13:15:19 +0100
committerBram Moolenaar <Bram@vim.org>2017-12-14 13:15:19 +0100
commit7f88b65f6cde3d69386e461f61271a271b79b7e8 (patch)
treec01bfcc823cae66433a91285a579a6bd0e590ee0 /src/gui_w32.c
parenta6d4849c711379b773529afaed640455287ac934 (diff)
patch 8.0.1390: DirectX scrolling can be slow, vertical positioning is offv8.0.1390
Problem: DirectX scrolling can be slow, vertical positioning is off. Solution: Make scroll slightly faster when using "scrlines:1". Fix y position of displayed text. Fix DirectX with non-utf8 encoding. (Ken Takata, closes #2440)
Diffstat (limited to 'src/gui_w32.c')
-rw-r--r--src/gui_w32.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/gui_w32.c b/src/gui_w32.c
index 119bcd5790..3c745b4fe4 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -30,11 +30,14 @@
#endif
#if defined(FEAT_DIRECTX)
+# ifndef FEAT_MBYTE
+# error FEAT_MBYTE is required for FEAT_DIRECTX.
+# endif
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)
+# define IS_ENABLE_DIRECTX() (s_directx_enabled && s_dwc != NULL && enc_utf8)
static int directx_enabled(void);
static void directx_binddc(void);
#endif
@@ -47,7 +50,7 @@ static int gui_mswin_get_menu_height(int fix_window);
int
gui_mch_set_rendering_options(char_u *s)
{
-#ifdef FEAT_DIRECTX
+# ifdef FEAT_DIRECTX
char_u *p, *q;
int dx_enable = 0;
@@ -159,9 +162,9 @@ gui_mch_set_rendering_options(char_u *s)
s_directx_scrlines = dx_scrlines;
return OK;
-#else
+# else
return FAIL;
-#endif
+# endif
}
#endif
@@ -3140,7 +3143,8 @@ gui_mch_delete_lines(
{
if (s_directx_scrlines > 0 && s_directx_scrlines <= num_lines)
{
- RedrawWindow(s_textArea, &rc, NULL, RDW_INVALIDATE);
+ gui_redraw(rc.left, rc.top,
+ rc.right - rc.left + 1, rc.bottom - rc.top + 1);
use_redraw = 1;
}
else
@@ -3152,9 +3156,9 @@ gui_mch_delete_lines(
intel_gpu_workaround();
ScrollWindowEx(s_textArea, 0, -num_lines * gui.char_height,
&rc, &rc, NULL, NULL, get_scroll_flags());
+ UpdateWindow(s_textArea);
}
- UpdateWindow(s_textArea);
/* This seems to be required to avoid the cursor disappearing when
* scrolling such that the cursor ends up in the top-left character on
* the screen... But why? (Webb) */
@@ -3190,7 +3194,8 @@ gui_mch_insert_lines(
{
if (s_directx_scrlines > 0 && s_directx_scrlines <= num_lines)
{
- RedrawWindow(s_textArea, &rc, NULL, RDW_INVALIDATE);
+ gui_redraw(rc.left, rc.top,
+ rc.right - rc.left + 1, rc.bottom - rc.top + 1);
use_redraw = 1;
}
else
@@ -3204,10 +3209,9 @@ gui_mch_insert_lines(
* off-screen. How do we avoid it when it's not needed? */
ScrollWindowEx(s_textArea, 0, num_lines * gui.char_height,
&rc, &rc, NULL, NULL, get_scroll_flags());
+ UpdateWindow(s_textArea);
}
- UpdateWindow(s_textArea);
-
gui_clear_block(row, gui.scroll_region_left,
row + num_lines - 1, gui.scroll_region_right);
}
@@ -6401,13 +6405,13 @@ gui_mch_draw_string(
if (text[n] >= 0x80)
break;
-#if defined(FEAT_DIRECTX)
+# if defined(FEAT_DIRECTX)
/* Quick hack to enable DirectWrite. To use DirectWrite (antialias), it is
* required that unicode drawing routine, currently. So this forces it
* enabled. */
- if (enc_utf8 && IS_ENABLE_DIRECTX())
+ if (IS_ENABLE_DIRECTX())
n = 0; /* Keep n < len, to enter block for unicode. */
-#endif
+# endif
/* Check if the Unicode buffer exists and is big enough. Create it
* with the same length as the multi-byte string, the number of wide
@@ -6480,7 +6484,7 @@ gui_mch_draw_string(
i += utf_ptr2len_len(text + i, len - i);
++clen;
}
-#if defined(FEAT_DIRECTX)
+# if defined(FEAT_DIRECTX)
if (IS_ENABLE_DIRECTX())
{
/* Add one to "cells" for italics. */
@@ -6490,7 +6494,7 @@ gui_mch_draw_string(
foptions, pcliprect, unicodepdy);
}
else
-#endif
+# endif
ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row),
foptions, pcliprect, unicodebuf, wlen, unicodepdy);
len = cells; /* used for underlining */