Rely on native double buffering by default in wxSTC

To avoid unnecessary buffering, turn off Scintilla buffered drawing
by default on platforms which have native double-buffering already.
This commit is contained in:
Artur Wieczorek
2017-10-16 19:26:55 +02:00
parent 2c69d27c0d
commit cb799483b7
2 changed files with 16 additions and 14 deletions

View File

@@ -52,9 +52,7 @@
#include "wx/file.h"
#endif
#ifdef __WXGTK__
#include "wx/dcbuffer.h"
#endif
#include "wx/dcbuffer.h"
#include "ScintillaWX.h"
@@ -226,6 +224,13 @@ bool wxStyledTextCtrl::Create(wxWindow *parent,
// STC doesn't support RTL languages at all
SetLayoutDirection(wxLayout_LeftToRight);
// Rely on native double buffering by default.
#if wxALWAYS_NATIVE_DOUBLE_BUFFER
SetBufferedDraw(false);
#else
SetBufferedDraw(true);
#endif
return true;
}
@@ -5164,11 +5169,7 @@ void wxStyledTextCtrl::StartStyling(int start, int unused)
// Event handlers
void wxStyledTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(evt)) {
#ifdef __WXGTK__
wxBufferedPaintDC dc(this);
#else
wxPaintDC dc(this);
#endif
m_swx->DoPaint(&dc, GetUpdateRegion().GetBox());
}

View File

@@ -52,9 +52,7 @@
#include "wx/file.h"
#endif
#ifdef __WXGTK__
#include "wx/dcbuffer.h"
#endif
#include "wx/dcbuffer.h"
#include "ScintillaWX.h"
@@ -226,6 +224,13 @@ bool wxStyledTextCtrl::Create(wxWindow *parent,
// STC doesn't support RTL languages at all
SetLayoutDirection(wxLayout_LeftToRight);
// Rely on native double buffering by default.
#if wxALWAYS_NATIVE_DOUBLE_BUFFER
SetBufferedDraw(false);
#else
SetBufferedDraw(true);
#endif
return true;
}
@@ -679,11 +684,7 @@ void wxStyledTextCtrl::StartStyling(int start, int unused)
// Event handlers
void wxStyledTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(evt)) {
#ifdef __WXGTK__
wxBufferedPaintDC dc(this);
#else
wxPaintDC dc(this);
#endif
m_swx->DoPaint(&dc, GetUpdateRegion().GetBox());
}