From f68dad69cc08f164c28087fc4084c4905ec31a46 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Thu, 8 Sep 2016 19:15:27 +0200 Subject: [PATCH] Implement Flush() method for Cairo graphics context wxCairoContext implementation for wxMSW and wxQT use internally helper surface so there is a need to flush it on demand. --- docs/changes.txt | 1 + src/generic/graphicc.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/docs/changes.txt b/docs/changes.txt index 49d00182b4..eb3a83dd5d 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -102,6 +102,7 @@ All (GUI): - Fix wxGCDC::Clear() for rotated graphics context. - Fix wxGCDC::GetClippingBox() for transformed wxDC (MSW, GTK+). - Add support for affine transformation matrix in wxGCDC. +- Add wxGraphicsContext::Flush() for Cairo renderer. wxGTK: diff --git a/src/generic/graphicc.cpp b/src/generic/graphicc.cpp index ef7e830af5..8c7acc3525 100644 --- a/src/generic/graphicc.cpp +++ b/src/generic/graphicc.cpp @@ -494,6 +494,7 @@ public: virtual void DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) wxOVERRIDE; virtual void PushState() wxOVERRIDE; virtual void PopState() wxOVERRIDE; + virtual void Flush() wxOVERRIDE; virtual void GetTextExtent( const wxString &str, wxDouble *width, wxDouble *height, wxDouble *descent, wxDouble *externalLeading ) const wxOVERRIDE; @@ -2476,6 +2477,22 @@ void wxCairoContext::PopState() cairo_restore(m_context); } +void wxCairoContext::Flush() +{ +#ifdef __WXMSW__ + if ( m_mswSurface ) + { + cairo_surface_flush(m_mswSurface); + } +#endif +#ifdef __WXQT__ + if ( m_qtSurface ) + { + cairo_surface_flush(m_qtSurface); + } +#endif +} + void wxCairoContext::DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) { wxGraphicsBitmap bitmap = GetRenderer()->CreateBitmap(bmp);