From b863e024b9bcdc78a11e2acbc93cc2e1ef79ba2e Mon Sep 17 00:00:00 2001 From: Zufu Liu Date: Fri, 25 Jun 2021 19:47:51 +1000 Subject: Feature [feature-requests:#1400] Set buffering when technology set. --- doc/ScintillaDoc.html | 12 +++++++++--- doc/ScintillaHistory.html | 13 +++++++++++++ test/simpleTests.py | 26 ++++++++++++++++++++++++++ win32/ScintillaWin.cxx | 1 + 4 files changed, 49 insertions(+), 3 deletions(-) diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 9fbb50350..50409c0af 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -128,7 +128,7 @@

Scintilla Documentation

-

Last edited 17 June 2021 NH

+

Last edited 25 June 2021 NH

Scintilla 5 has moved the lexers from Scintilla into a new Lexilla project.
@@ -4511,8 +4511,14 @@ struct Sci_TextToFind { is retained after being presented which may prevent drawing failures on some cards and drivers. SC_TECHNOLOGY_DIRECTWRITEDC differs from SC_TECHNOLOGY_DIRECTWRITE by using DirectWrite to draw into a GDI DC. - Since Direct2D buffers drawing, Scintilla's buffering can be turned off with - SCI_SETBUFFEREDDRAW(0). +

+

+ On Win32, buffered drawing is set to a reasonable value for the technology: on for GDI and off for Direct2D + as Direct2D performs its own buffering. + This can be changed after setting technology with + SCI_SETBUFFEREDDRAW. +

+

When using DirectWrite, you can use SCI_SETFONTLOCALE to set an appropriate font locale to draw text with expected language-dependent glyphs. diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 634a7ff50..542fd4eb9 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -564,6 +564,19 @@

Releases

+

+ Release 5.1.1 +

+

Release 5.1.0

diff --git a/test/simpleTests.py b/test/simpleTests.py index 2d8b25e68..dca1e24c4 100644 --- a/test/simpleTests.py +++ b/test/simpleTests.py @@ -1854,6 +1854,32 @@ class TestModalSelection(unittest.TestCase): self.assertEquals(self.ed.GetSelectionNAnchor(0), 0) self.ed.ClearSelections() +class TestTechnology(unittest.TestCase): + """ These tests are just to ensure that the calls set and retrieve values. + They assume running on a Direct2D compatible version of Windows. + They do not check visual appearance. + """ + def setUp(self): + self.xite = Xite.xiteFrame + self.ed = self.xite.ed + self.ed.ClearAll() + self.ed.EmptyUndoBuffer() + + def tearDown(self): + self.ed.ClearAll() + self.ed.EmptyUndoBuffer() + + def testTechnologyAndBufferedDraw(self): + self.ed.Technology = self.ed.SC_TECHNOLOGY_DEFAULT + self.assertEquals(self.ed.GetTechnology(), self.ed.SC_TECHNOLOGY_DEFAULT) + if sys.platform == "win32": + self.ed.Technology = self.ed.SC_TECHNOLOGY_DIRECTWRITE + self.assertEquals(self.ed.GetTechnology(), self.ed.SC_TECHNOLOGY_DIRECTWRITE) + self.assertEquals(self.ed.BufferedDraw, False) + self.ed.Technology = self.ed.SC_TECHNOLOGY_DEFAULT + self.assertEquals(self.ed.GetTechnology(), self.ed.SC_TECHNOLOGY_DEFAULT) + self.assertEquals(self.ed.BufferedDraw, True) + class TestStyleAttributes(unittest.TestCase): """ These tests are just to ensure that the calls set and retrieve values. They do not check the visual appearance of the style attributes. diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 0af4a6d65..64ca03cfa 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -1832,6 +1832,7 @@ sptr_t ScintillaWin::SciMessage(Message iMessage, uptr_t wParam, sptr_t lParam) } DropRenderTarget(); technology = technologyNew; + view.bufferedDraw = technologyNew == Technology::Default; // Invalidate all cached information including layout. DropGraphics(); InvalidateStyleRedraw(); -- cgit v1.2.3