From b42a204c6cea47b0bee61c4015d44f59f4e8dba0 Mon Sep 17 00:00:00 2001
From: Neil
Date: Wed, 3 Sep 2014 11:25:38 +1000
Subject: Added SC_TECHNOLOGY_DIRECTWRITERETAIN mode.
---
doc/ScintillaDoc.html | 6 +++++-
doc/ScintillaHistory.html | 4 ++++
include/Scintilla.h | 1 +
include/Scintilla.iface | 1 +
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 {
SCI_GETTECHNOLOGY
The technology property allows choosing between different drawing APIs and options.
On most platforms, the only choice is SC_TECHNOLOGY_DEFAULT (0).
- On Windows Vista or later, SC_TECHNOLOGY_DIRECTWRITE (1)
+ On Windows Vista or later, SC_TECHNOLOGY_DIRECTWRITE (1) or
+ SC_TECHNOLOGY_DIRECTWRITERETAIN (2)
can be chosen to use the Direct2D and DirectWrite APIs for higher quality antialiased drawing.
+ SC_TECHNOLOGY_DIRECTWRITERETAIN differs from
+ SC_TECHNOLOGY_DIRECTWRITE 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
SCI_SETBUFFEREDDRAW(0).
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 @@
Bug #1639.
+ On Windows another DirectWrite mode SC_TECHNOLOGY_DIRECTWRITERETAIN added
+ which may avoid drawing failures on some cards and drivers.
+
+
On Windows support the Visual Studio 2010+ clipboard format that indicates a line copy.
Bug #1636.
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(wParam)) {
- if (static_cast(wParam) == SC_TECHNOLOGY_DIRECTWRITE) {
+ if (static_cast(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;
--
cgit v1.2.3