From 9f20c61fa7a5bab0eaeddc2ca0c82e526bb38655 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 15 Jul 2020 14:00:58 +0200 Subject: [PATCH] Remove creation on the fly of a wxPaintEvent instance (fix previous commit). --- common/gal/cairo/cairo_gal.cpp | 11 ++++------- common/gal/opengl/opengl_gal.cpp | 9 ++++----- include/gal/cairo/cairo_gal.h | 5 +++-- include/gal/opengl/opengl_gal.h | 5 +++-- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/common/gal/cairo/cairo_gal.cpp b/common/gal/cairo/cairo_gal.cpp index 50cf80820c..242b509a7d 100644 --- a/common/gal/cairo/cairo_gal.cpp +++ b/common/gal/cairo/cairo_gal.cpp @@ -40,8 +40,6 @@ #include -#include - using namespace KIGFX; @@ -1305,13 +1303,12 @@ void CAIRO_GAL::endDrawing() } -void CAIRO_GAL::PostPaint() +void CAIRO_GAL::PostPaint( wxPaintEvent& aEvent ) { // posts an event to m_paint_listener to ask for redraw the canvas. if( paintListener ) { - wxPaintEvent redrawReqEvent; - wxPostEvent( paintListener, redrawReqEvent ); + wxPostEvent( paintListener, aEvent ); } } @@ -1488,9 +1485,9 @@ void CAIRO_GAL::setCompositor() } -void CAIRO_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) ) +void CAIRO_GAL::onPaint( wxPaintEvent& aEvent ) { - PostPaint(); + PostPaint( aEvent ); } diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index 1ec6d2d3f9..c2167313fd 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -352,13 +352,12 @@ wxString OPENGL_GAL::CheckFeatures( GAL_DISPLAY_OPTIONS& aOptions ) } -void OPENGL_GAL::PostPaint() +void OPENGL_GAL::PostPaint( wxPaintEvent& aEvent ) { // posts an event to m_paint_listener to ask for redraw the canvas. if( paintListener ) { - wxPaintEvent redrawReqEvent; - wxPostEvent( paintListener, redrawReqEvent ); + wxPostEvent( paintListener, aEvent ); } } @@ -1954,9 +1953,9 @@ std::pair OPENGL_GAL::computeBitmapTextSize( const UTF8& aText } -void OPENGL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) ) +void OPENGL_GAL::onPaint( wxPaintEvent& aEvent ) { - PostPaint(); + PostPaint( aEvent ); } diff --git a/include/gal/cairo/cairo_gal.h b/include/gal/cairo/cairo_gal.h index af04a6e5ae..5bef086d40 100644 --- a/include/gal/cairo/cairo_gal.h +++ b/include/gal/cairo/cairo_gal.h @@ -386,9 +386,10 @@ public: /** * Function PostPaint * posts an event to m_paint_listener. A post is used so that the actual drawing - * function can use a device context type that is not specific to the wxEVT_PAINT event. + * function can use a device context type that is not specific to the wxEVT_PAINT event, + * just by changing the PostPaint code. */ - void PostPaint(); + void PostPaint( wxPaintEvent& aEvent ); void SetMouseListener( wxEvtHandler* aMouseListener ) { diff --git a/include/gal/opengl/opengl_gal.h b/include/gal/opengl/opengl_gal.h index 50f83aa538..407654423e 100644 --- a/include/gal/opengl/opengl_gal.h +++ b/include/gal/opengl/opengl_gal.h @@ -250,9 +250,10 @@ public: /** * @brief Function PostPaint * posts an event to m_paint_listener. A post is used so that the actual drawing - * function can use a device context type that is not specific to the wxEVT_PAINT event. + * function can use a device context type that is not specific to the wxEVT_PAINT event, + * just by changing the PostPaint code. */ - void PostPaint(); + void PostPaint( wxPaintEvent& aEvent ); void SetMouseListener( wxEvtHandler* aMouseListener ) {