Set interpolation/anti-alias in plots
This doesn't do much for Linux, but the interpolation modes for MSW and Mac should clean up lines a bit in plotting Fixes https://gitlab.com/kicad/code/kicad/issues/10239
This commit is contained in:
parent
e28f6ecc00
commit
fcc4b202db
|
@ -31,6 +31,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <widgets/mathplot.h>
|
#include <widgets/mathplot.h>
|
||||||
|
#include <wx/graphics.h>
|
||||||
#include <wx/module.h>
|
#include <wx/module.h>
|
||||||
#include <wx/image.h>
|
#include <wx/image.h>
|
||||||
|
|
||||||
|
@ -1633,6 +1634,16 @@ mpWindow::mpWindow() : wxWindow(),
|
||||||
m_movingInfoLayer( nullptr ),
|
m_movingInfoLayer( nullptr ),
|
||||||
m_zooming( false )
|
m_zooming( false )
|
||||||
{
|
{
|
||||||
|
if( wxGraphicsContext *ctx = m_buff_dc.GetGraphicsContext() )
|
||||||
|
{
|
||||||
|
if( !ctx->SetInterpolationQuality( wxINTERPOLATION_BEST )
|
||||||
|
|| !ctx->SetInterpolationQuality( wxINTERPOLATION_GOOD ) )
|
||||||
|
{
|
||||||
|
ctx->SetInterpolationQuality( wxINTERPOLATION_FAST );
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->SetAntialiasMode( wxANTIALIAS_DEFAULT );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mpWindow::mpWindow( wxWindow* parent,
|
mpWindow::mpWindow( wxWindow* parent,
|
||||||
|
@ -1680,6 +1691,17 @@ mpWindow::mpWindow( wxWindow* parent,
|
||||||
// J.L.Blanco: Eliminates the "flick" with the double buffer.
|
// J.L.Blanco: Eliminates the "flick" with the double buffer.
|
||||||
SetBackgroundStyle( wxBG_STYLE_CUSTOM );
|
SetBackgroundStyle( wxBG_STYLE_CUSTOM );
|
||||||
|
|
||||||
|
if( wxGraphicsContext* ctx = m_buff_dc.GetGraphicsContext() )
|
||||||
|
{
|
||||||
|
if( !ctx->SetInterpolationQuality( wxINTERPOLATION_BEST )
|
||||||
|
|| !ctx->SetInterpolationQuality( wxINTERPOLATION_GOOD ) )
|
||||||
|
{
|
||||||
|
ctx->SetInterpolationQuality( wxINTERPOLATION_FAST );
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->SetAntialiasMode( wxANTIALIAS_DEFAULT );
|
||||||
|
}
|
||||||
|
|
||||||
UpdateAll();
|
UpdateAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2345,6 +2367,18 @@ void mpWindow::OnPaint( wxPaintEvent& WXUNUSED( event ) )
|
||||||
|
|
||||||
// Draw background:
|
// Draw background:
|
||||||
// trgDc->SetDeviceOrigin(0,0);
|
// trgDc->SetDeviceOrigin(0,0);
|
||||||
|
|
||||||
|
if( wxGraphicsContext* ctx = trgDc->GetGraphicsContext() )
|
||||||
|
{
|
||||||
|
if( !ctx->SetInterpolationQuality( wxINTERPOLATION_BEST )
|
||||||
|
|| !ctx->SetInterpolationQuality( wxINTERPOLATION_GOOD ) )
|
||||||
|
{
|
||||||
|
ctx->SetInterpolationQuality( wxINTERPOLATION_FAST );
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->SetAntialiasMode( wxANTIALIAS_DEFAULT );
|
||||||
|
}
|
||||||
|
|
||||||
trgDc->SetPen( *wxTRANSPARENT_PEN );
|
trgDc->SetPen( *wxTRANSPARENT_PEN );
|
||||||
wxBrush brush( GetBackgroundColour() );
|
wxBrush brush( GetBackgroundColour() );
|
||||||
trgDc->SetBrush( brush );
|
trgDc->SetBrush( brush );
|
||||||
|
|
Loading…
Reference in New Issue