mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-05 08:33:53 +01:00
Works around "some" of the OSX drawing issues
This is related to a possible wx3 issue: http://trac.wxwidgets.org/ticket/17091 But, there's still quite a few more to resolve.
This commit is contained in:
@@ -230,6 +230,56 @@ class AudacityApp:public wxApp {
|
||||
|
||||
extern AudacityApp & wxGetApp();
|
||||
|
||||
|
||||
#if defined(__WXMAC__)
|
||||
inline void EnableAntialiasing(wxDC & dc)
|
||||
{
|
||||
dc.GetGraphicsContext()->EnableOffset(false);
|
||||
dc.GetGraphicsContext()->SetAntialiasMode(wxANTIALIAS_DEFAULT);
|
||||
}
|
||||
|
||||
inline void DisableAntialiasing(wxDC & dc)
|
||||
{
|
||||
dc.GetGraphicsContext()->EnableOffset(true);
|
||||
dc.GetGraphicsContext()->SetAntialiasMode(wxANTIALIAS_NONE);
|
||||
}
|
||||
|
||||
inline void DrawText(wxDC & dc, const wxString & text, wxCoord x, wxCoord y)
|
||||
{
|
||||
wxGraphicsContext *ctx = dc.GetGraphicsContext();
|
||||
wxAntialiasMode mode = ctx->GetAntialiasMode();
|
||||
if (mode == wxANTIALIAS_NONE)
|
||||
{
|
||||
dc.GetGraphicsContext()->SetAntialiasMode(wxANTIALIAS_DEFAULT);
|
||||
}
|
||||
|
||||
dc.DrawText(text, x, y);
|
||||
|
||||
if (mode == wxANTIALIAS_NONE)
|
||||
{
|
||||
dc.GetGraphicsContext()->SetAntialiasMode(wxANTIALIAS_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
inline void DrawText(wxDC *dc, const wxString & text, wxCoord x, wxCoord y)
|
||||
{
|
||||
DrawText(*dc, text, x, y);
|
||||
}
|
||||
|
||||
#else
|
||||
#define EnableAntialiasing(dc)
|
||||
#define DisableAntialiasing(dc)
|
||||
inline void DrawText(wxDC & dc, const wxString & text, wxCoord x, wxCoord y)
|
||||
{
|
||||
dc.DrawText(text, x, y);
|
||||
}
|
||||
|
||||
inline void DrawText(wxDC * dc, const wxString & text, wxCoord x, wxCoord y)
|
||||
{
|
||||
dc->DrawText(text, x, y);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define MAX_AUDIO (1. - 1./(1<<15))
|
||||
|
||||
Reference in New Issue
Block a user