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