diff options
author | Neil <nyamatongwe@gmail.com> | 2014-09-03 11:25:38 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2014-09-03 11:25:38 +1000 |
commit | b42a204c6cea47b0bee61c4015d44f59f4e8dba0 (patch) | |
tree | 24f43c9bbbeaeb3902eeadd6735e7443da1c6c63 | |
parent | 24e83c72f610bf71f5c928d52fc6eb5172bc22a3 (diff) | |
download | scintilla-mirror-b42a204c6cea47b0bee61c4015d44f59f4e8dba0.tar.gz |
Added SC_TECHNOLOGY_DIRECTWRITERETAIN mode.
-rw-r--r-- | doc/ScintillaDoc.html | 6 | ||||
-rw-r--r-- | doc/ScintillaHistory.html | 4 | ||||
-rw-r--r-- | include/Scintilla.h | 1 | ||||
-rw-r--r-- | include/Scintilla.iface | 1 | ||||
-rw-r--r-- | win32/ScintillaWin.cxx | 12 |
5 files changed, 19 insertions, 5 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index a4dd4cc9c..e58c5cc4d 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -3240,8 +3240,12 @@ struct Sci_TextToFind { <b id="SCI_GETTECHNOLOGY">SCI_GETTECHNOLOGY</b><br /> The technology property allows choosing between different drawing APIs and options. On most platforms, the only choice is <code>SC_TECHNOLOGY_DEFAULT</code> (0). - On Windows Vista or later, <code>SC_TECHNOLOGY_DIRECTWRITE</code> (1) + On Windows Vista or later, <code>SC_TECHNOLOGY_DIRECTWRITE</code> (1) or + <code>SC_TECHNOLOGY_DIRECTWRITERETAIN</code> (2) can be chosen to use the Direct2D and DirectWrite APIs for higher quality antialiased drawing. + <code>SC_TECHNOLOGY_DIRECTWRITERETAIN</code> differs from + <code>SC_TECHNOLOGY_DIRECTWRITE</code> by requesting that the frame + is retained after being presented which may prevent drawing failures on some cards and drivers. Since Direct2D buffers drawing, Scintilla's buffering can be turned off with <code>SCI_SETBUFFEREDDRAW(0)</code>.</p> diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 06f8f644f..150f9f61c 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -497,6 +497,10 @@ <a href="http://sourceforge.net/p/scintilla/bugs/1639/">Bug #1639</a>. </li> <li> + On Windows another DirectWrite mode SC_TECHNOLOGY_DIRECTWRITERETAIN added + which may avoid drawing failures on some cards and drivers. + </li> + <li> On Windows support the Visual Studio 2010+ clipboard format that indicates a line copy. <a href="http://sourceforge.net/p/scintilla/bugs/1636/">Bug #1636</a>. </li> diff --git a/include/Scintilla.h b/include/Scintilla.h index 949d42267..184bcacb7 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -888,6 +888,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_SCROLLTOEND 2629 #define SC_TECHNOLOGY_DEFAULT 0 #define SC_TECHNOLOGY_DIRECTWRITE 1 +#define SC_TECHNOLOGY_DIRECTWRITERETAIN 2 #define SCI_SETTECHNOLOGY 2630 #define SCI_GETTECHNOLOGY 2631 #define SCI_CREATELOADER 2632 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 75c2e643a..a30ed897f 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -2349,6 +2349,7 @@ fun void ScrollToEnd=2629(,) val SC_TECHNOLOGY_DEFAULT=0 val SC_TECHNOLOGY_DIRECTWRITE=1 +val SC_TECHNOLOGY_DIRECTWRITERETAIN=2 # Set the technology used. set void SetTechnology=2630(int technology,) diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 2ff660a09..86e274178 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -457,7 +457,8 @@ void ScintillaWin::EnsureRenderTarget() { D2D1_HWND_RENDER_TARGET_PROPERTIES dhrtp; dhrtp.hwnd = hw; dhrtp.pixelSize = size; - dhrtp.presentOptions = D2D1_PRESENT_OPTIONS_NONE; + dhrtp.presentOptions = (technology == SC_TECHNOLOGY_DIRECTWRITERETAIN) ? + D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS : D2D1_PRESENT_OPTIONS_NONE; D2D1_RENDER_TARGET_PROPERTIES drtp; drtp.type = D2D1_RENDER_TARGET_TYPE_DEFAULT; @@ -1402,9 +1403,11 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam return keysAlwaysUnicode; case SCI_SETTECHNOLOGY: - if ((wParam == SC_TECHNOLOGY_DEFAULT) || (wParam == SC_TECHNOLOGY_DIRECTWRITE)) { + if ((wParam == SC_TECHNOLOGY_DEFAULT) || + (wParam == SC_TECHNOLOGY_DIRECTWRITERETAIN) || + (wParam == SC_TECHNOLOGY_DIRECTWRITE)) { if (technology != static_cast<int>(wParam)) { - if (static_cast<int>(wParam) == SC_TECHNOLOGY_DIRECTWRITE) { + if (static_cast<int>(wParam) > SC_TECHNOLOGY_DEFAULT) { #if defined(USE_D2D) if (!LoadD2D()) // Failed to load Direct2D or DirectWrite so no effect @@ -2960,7 +2963,8 @@ sptr_t PASCAL ScintillaWin::CTWndProc( D2D1_HWND_RENDER_TARGET_PROPERTIES dhrtp; dhrtp.hwnd = hWnd; dhrtp.pixelSize = D2D1::SizeU(rc.right - rc.left, rc.bottom - rc.top); - dhrtp.presentOptions = D2D1_PRESENT_OPTIONS_NONE; + dhrtp.presentOptions = (sciThis->technology == SC_TECHNOLOGY_DIRECTWRITERETAIN) ? + D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS : D2D1_PRESENT_OPTIONS_NONE; D2D1_RENDER_TARGET_PROPERTIES drtp; drtp.type = D2D1_RENDER_TARGET_TYPE_DEFAULT; |