Skip to content

Instantly share code, notes, and snippets.

@k-takata
Created January 13, 2013 02:28
Show Gist options
  • Save k-takata/4521914 to your computer and use it in GitHub Desktop.
Save k-takata/4521914 to your computer and use it in GitHub Desktop.
additional patch for vim-kaoriya-vim-mq-ex / patch-direct_write.diff (Add 'if' for noantialias mode. Fix indents.)
diff --git a/src/gui_w32.c b/src/gui_w32.c
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -2480,12 +2480,12 @@
if (enc_utf8)
{
#if defined(USE_DIRECT_X)
- n = len - 1; /* always output the text as WCHAR */
-#else
- for (n = 0; n < len; ++n)
- if (text[n] >= 0x80)
- break;
+ /* if antialias, always output the text as WCHAR */
+ if (!p_antialias)
#endif
+ for (n = 0; n < len; ++n)
+ if (text[n] >= 0x80)
+ break;
}
/* Check if the Unicode buffer exists and is big enough. Create it
@@ -2547,16 +2547,16 @@
++clen;
}
#if defined(USE_DIRECT_X)
- if (p_antialias)
- {
- DWriteContext_DrawText2(s_dwc, s_hdc, unicodebuf, wlen,
- TEXT_X(col), TEXT_Y(row), FILL_X(cells), FILL_Y(1),
- gui.currFgColor, isBold, isItalic);
- }
- else
+ if (p_antialias)
+ {
+ DWriteContext_DrawText2(s_dwc, s_hdc, unicodebuf, wlen,
+ TEXT_X(col), TEXT_Y(row), FILL_X(cells), FILL_Y(1),
+ gui.currFgColor, isBold, isItalic);
+ }
+ else
#endif
- ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row),
- foptions, pcliprect, unicodebuf, wlen, unicodepdy);
+ ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row),
+ foptions, pcliprect, unicodebuf, wlen, unicodepdy);
len = cells; /* used for underlining */
}
else if ((enc_codepage > 0 && (int)GetACP() != enc_codepage) || enc_latin9)
diff --git a/src/gui_w48.c b/src/gui_w48.c
--- a/src/gui_w48.c
+++ b/src/gui_w48.c
@@ -2779,8 +2779,8 @@
out_flush(); /* make sure all output has been processed */
(void)BeginPaint(hwnd, &ps);
#if defined(USE_DIRECT_X)
- if (p_antialias)
- DWriteContext_BeginDraw(s_dwc);
+ if (p_antialias)
+ DWriteContext_BeginDraw(s_dwc);
#endif
#ifdef FEAT_MBYTE
@@ -2799,8 +2799,8 @@
if (!IsRectEmpty(&ps.rcPaint))
{
#if defined(USE_DIRECT_X)
- if (p_antialias)
- DWriteContext_BindDC(s_dwc, s_hdc, &ps.rcPaint);
+ if (p_antialias)
+ DWriteContext_BindDC(s_dwc, s_hdc, &ps.rcPaint);
#endif
gui_redraw(ps.rcPaint.left, ps.rcPaint.top,
ps.rcPaint.right - ps.rcPaint.left + 1,
@@ -2808,8 +2808,8 @@
}
#if defined(USE_DIRECT_X)
- if (p_antialias)
- DWriteContext_EndDraw(s_dwc);
+ if (p_antialias)
+ DWriteContext_EndDraw(s_dwc);
#endif
EndPaint(hwnd, &ps);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment