Use wxAutoBufferedPaintDC to reduce flicker with wxMSW

This commit is contained in:
New Pagodi 2017-12-24 18:24:05 -06:00
parent ca1b76ba49
commit d3fd17db04

View File

@ -1,5 +1,6 @@
#include "gestures.h"
#include "wx/dcgraph.h"
#include "wx/dcbuffer.h"
#include "../image/horse.xpm"
@ -40,6 +41,7 @@ MyGesturePanel::MyGesturePanel(MyGestureFrame *parent)
: wxPanel(parent, wxID_ANY),
m_bitmap(horse_xpm)
{
SetBackgroundStyle(wxBG_STYLE_PAINT);
Bind(wxEVT_PAINT, &MyGesturePanel::OnPaint, this);
if ( !EnableTouchEvents(wxTOUCH_ALL_GESTURES) )
@ -75,12 +77,10 @@ void MyGestureFrame::OnGesture(wxGestureEvent& event)
void MyGesturePanel::OnPaint(wxPaintEvent& WXUNUSED(event))
{
wxPaintDC paintDC(this);
wxAutoBufferedPaintDC paintDC(this);
paintDC.Clear();
wxGCDC dc(paintDC);
dc.Clear();
dc.SetTransformMatrix(m_affineMatrix);
dc.DrawBitmap(m_bitmap, wxRound(m_translateDistance.m_x), wxRound(m_translateDistance.m_y));
}