GAL: Add antialiasing options to Cairo

Cairo supports antialiasing when rendering but can be slow when set to
sub-pixel mode.  This bumps the minimum version of Cairo to 1.12
(available in 14.04 LTS as well as mingw) to support three antialias
settings (fast, good, best) that offer speed/appearance tradeoffs.

This can provide a higher-quality eeschema render as it works on a
per-element basis as opposed to the OpenGL per-screen antialias.
This commit is contained in:
Seth Hillbrand 2018-01-04 05:13:00 -07:00
parent b743c39ed8
commit e8333633fe
15 changed files with 333 additions and 832 deletions

View File

@ -604,7 +604,7 @@ endif()
# #
# Find Cairo library, required # Find Cairo library, required
# #
find_package( Cairo 1.8.8 REQUIRED ) find_package( Cairo 1.12 REQUIRED )
find_package( Pixman 0.30 REQUIRED ) find_package( Pixman 0.30 REQUIRED )
# #

View File

@ -60,6 +60,9 @@ bool PANEL_COMMON_SETTINGS::TransferDataToWindow()
commonSettings->Read( GAL_ANTIALIASING_MODE_KEY, &antialiasingMode, 0 ); commonSettings->Read( GAL_ANTIALIASING_MODE_KEY, &antialiasingMode, 0 );
m_antialiasing->SetSelection( antialiasingMode ); m_antialiasing->SetSelection( antialiasingMode );
commonSettings->Read( CAIRO_ANTIALIASING_MODE_KEY, &antialiasingMode, 0 );
m_antialiasingFallback->SetSelection( antialiasingMode );
int scale_fourths; int scale_fourths;
commonSettings->Read( ICON_SCALE_KEY, &scale_fourths ); commonSettings->Read( ICON_SCALE_KEY, &scale_fourths );
@ -106,6 +109,8 @@ bool PANEL_COMMON_SETTINGS::TransferDataFromWindow()
commonSettings->Write( GAL_ANTIALIASING_MODE_KEY, m_antialiasing->GetSelection() ); commonSettings->Write( GAL_ANTIALIASING_MODE_KEY, m_antialiasing->GetSelection() );
commonSettings->Write( CAIRO_ANTIALIASING_MODE_KEY, m_antialiasingFallback->GetSelection() );
const int scale_fourths = m_scaleAuto->GetValue() ? -1 : m_scaleSlider->GetValue() / 25; const int scale_fourths = m_scaleAuto->GetValue() ? -1 : m_scaleSlider->GetValue() / 25;
commonSettings->Write( ICON_SCALE_KEY, scale_fourths ); commonSettings->Write( ICON_SCALE_KEY, scale_fourths );

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 11 2018) // C++ code generated with wxFormBuilder (version Nov 23 2018)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -9,186 +9,197 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style ) PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
{ {
wxBoxSizer* bPanelSizer; wxBoxSizer* bPanelSizer;
bPanelSizer = new wxBoxSizer( wxVERTICAL ); bPanelSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bLeftSizer; wxBoxSizer* bLeftSizer;
bLeftSizer = new wxBoxSizer( wxVERTICAL ); bLeftSizer = new wxBoxSizer( wxVERTICAL );
wxGridBagSizer* gbSizer1; wxGridBagSizer* gbSizer1;
gbSizer1 = new wxGridBagSizer( 3, 0 ); gbSizer1 = new wxGridBagSizer( 3, 0 );
gbSizer1->SetFlexibleDirection( wxBOTH ); gbSizer1->SetFlexibleDirection( wxBOTH );
gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
gbSizer1->SetEmptyCellSize( wxSize( -1,2 ) ); gbSizer1->SetEmptyCellSize( wxSize( -1,2 ) );
m_staticTextautosave = new wxStaticText( this, wxID_ANY, _("&Auto save:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextautosave = new wxStaticText( this, wxID_ANY, _("&Auto save:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextautosave->Wrap( -1 ); m_staticTextautosave->Wrap( -1 );
gbSizer1->Add( m_staticTextautosave, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); gbSizer1->Add( m_staticTextautosave, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
wxBoxSizer* bSizer6; wxBoxSizer* bSizer6;
bSizer6 = new wxBoxSizer( wxHORIZONTAL ); bSizer6 = new wxBoxSizer( wxHORIZONTAL );
m_SaveTime = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 10, 0 ); m_SaveTime = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 10, 0 );
m_SaveTime->SetToolTip( _("Delay after the first change to create a backup file of the board on disk.\nIf set to 0, auto backup is disabled") ); m_SaveTime->SetToolTip( _("Delay after the first change to create a backup file of the board on disk.\nIf set to 0, auto backup is disabled") );
bSizer6->Add( m_SaveTime, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); bSizer6->Add( m_SaveTime, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
wxStaticText* minutesLabel; wxStaticText* minutesLabel;
minutesLabel = new wxStaticText( this, wxID_ANY, _("minutes"), wxDefaultPosition, wxDefaultSize, 0 ); minutesLabel = new wxStaticText( this, wxID_ANY, _("minutes"), wxDefaultPosition, wxDefaultSize, 0 );
minutesLabel->Wrap( -1 ); minutesLabel->Wrap( -1 );
bSizer6->Add( minutesLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); bSizer6->Add( minutesLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
gbSizer1->Add( bSizer6, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 ); gbSizer1->Add( bSizer6, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_staticTextFileHistorySize = new wxStaticText( this, wxID_ANY, _("File history size:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextFileHistorySize = new wxStaticText( this, wxID_ANY, _("File history size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextFileHistorySize->Wrap( -1 ); m_staticTextFileHistorySize->Wrap( -1 );
gbSizer1->Add( m_staticTextFileHistorySize, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); gbSizer1->Add( m_staticTextFileHistorySize, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_fileHistorySize = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 100, 0 ); m_fileHistorySize = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 100, 0 );
gbSizer1->Add( m_fileHistorySize, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); gbSizer1->Add( m_fileHistorySize, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
wxStaticText* antialiasingLabel; wxStaticText* antialiasingLabel;
antialiasingLabel = new wxStaticText( this, wxID_ANY, _("Graphics acceleration:"), wxDefaultPosition, wxDefaultSize, 0 ); antialiasingLabel = new wxStaticText( this, wxID_ANY, _("Graphics (Accelerated):"), wxDefaultPosition, wxDefaultSize, 0 );
antialiasingLabel->Wrap( -1 ); antialiasingLabel->Wrap( -1 );
gbSizer1->Add( antialiasingLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); gbSizer1->Add( antialiasingLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
wxString m_antialiasingChoices[] = { _("No Antialiasing"), _("Subpixel Antialiasing (High Quality)"), _("Subpixel Antialiasing (Ultra Quality)"), _("Supersampling (2x)"), _("Supersampling (4x)") }; wxString m_antialiasingChoices[] = { _("No Antialiasing"), _("Subpixel Antialiasing (High Quality)"), _("Subpixel Antialiasing (Ultra Quality)"), _("Supersampling (2x)"), _("Supersampling (4x)") };
int m_antialiasingNChoices = sizeof( m_antialiasingChoices ) / sizeof( wxString ); int m_antialiasingNChoices = sizeof( m_antialiasingChoices ) / sizeof( wxString );
m_antialiasing = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_antialiasingNChoices, m_antialiasingChoices, 0 ); m_antialiasing = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_antialiasingNChoices, m_antialiasingChoices, 0 );
m_antialiasing->SetSelection( 0 ); m_antialiasing->SetSelection( 0 );
gbSizer1->Add( m_antialiasing, wxGBPosition( 3, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); gbSizer1->Add( m_antialiasing, wxGBPosition( 3, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
wxStaticText* antialiasingLabel1;
antialiasingLabel1 = new wxStaticText( this, wxID_ANY, _("Graphics (Fallback):"), wxDefaultPosition, wxDefaultSize, 0 );
antialiasingLabel1->Wrap( -1 );
gbSizer1->Add( antialiasingLabel1, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
wxString m_antialiasingFallbackChoices[] = { _("No Antialiasing"), _("Fast Antialiasing"), _("Balanced Antialiasing"), _("High Quality Antialiasing") };
int m_antialiasingFallbackNChoices = sizeof( m_antialiasingFallbackChoices ) / sizeof( wxString );
m_antialiasingFallback = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_antialiasingFallbackNChoices, m_antialiasingFallbackChoices, 0 );
m_antialiasingFallback->SetSelection( 0 );
gbSizer1->Add( m_antialiasingFallback, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
gbSizer1->AddGrowableCol( 1 ); gbSizer1->AddGrowableCol( 1 );
bLeftSizer->Add( gbSizer1, 1, wxEXPAND|wxALL, 5 ); bLeftSizer->Add( gbSizer1, 1, wxEXPAND|wxALL, 5 );
bLeftSizer->Add( 0, 0, 0, wxEXPAND|wxTOP, 3 ); bLeftSizer->Add( 0, 0, 0, wxEXPAND|wxTOP, 3 );
wxStaticBoxSizer* sizerHelperApps; wxStaticBoxSizer* sizerHelperApps;
sizerHelperApps = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Helper Applications") ), wxVERTICAL ); sizerHelperApps = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Helper Applications") ), wxVERTICAL );
wxGridBagSizer* gridHelperApps; wxGridBagSizer* gridHelperApps;
gridHelperApps = new wxGridBagSizer( 0, 0 ); gridHelperApps = new wxGridBagSizer( 0, 0 );
gridHelperApps->SetFlexibleDirection( wxBOTH ); gridHelperApps->SetFlexibleDirection( wxBOTH );
gridHelperApps->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); gridHelperApps->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
gridHelperApps->SetEmptyCellSize( wxSize( -1,5 ) ); gridHelperApps->SetEmptyCellSize( wxSize( -1,5 ) );
wxStaticText* textEditorLabel; wxStaticText* textEditorLabel;
textEditorLabel = new wxStaticText( sizerHelperApps->GetStaticBox(), wxID_ANY, _("Text editor:"), wxDefaultPosition, wxDefaultSize, 0 ); textEditorLabel = new wxStaticText( sizerHelperApps->GetStaticBox(), wxID_ANY, _("Text editor:"), wxDefaultPosition, wxDefaultSize, 0 );
textEditorLabel->Wrap( -1 ); textEditorLabel->Wrap( -1 );
gridHelperApps->Add( textEditorLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 4 ); gridHelperApps->Add( textEditorLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 4 );
m_textEditorPath = new wxTextCtrl( sizerHelperApps->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_textEditorPath = new wxTextCtrl( sizerHelperApps->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_textEditorPath->SetMinSize( wxSize( 360,-1 ) ); m_textEditorPath->SetMinSize( wxSize( 360,-1 ) );
gridHelperApps->Add( m_textEditorPath, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); gridHelperApps->Add( m_textEditorPath, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_textEditorBtn = new wxBitmapButton( sizerHelperApps->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_textEditorBtn = new wxBitmapButton( sizerHelperApps->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_textEditorBtn->SetMinSize( wxSize( 29,29 ) ); m_textEditorBtn->SetMinSize( wxSize( 29,29 ) );
gridHelperApps->Add( m_textEditorBtn, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); gridHelperApps->Add( m_textEditorBtn, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_defaultPDFViewer = new wxRadioButton( sizerHelperApps->GetStaticBox(), wxID_ANY, _("System default PDF viewer"), wxDefaultPosition, wxDefaultSize, 0 ); m_defaultPDFViewer = new wxRadioButton( sizerHelperApps->GetStaticBox(), wxID_ANY, _("System default PDF viewer"), wxDefaultPosition, wxDefaultSize, 0 );
gridHelperApps->Add( m_defaultPDFViewer, wxGBPosition( 2, 0 ), wxGBSpan( 1, 3 ), wxTOP|wxRIGHT|wxLEFT, 4 ); gridHelperApps->Add( m_defaultPDFViewer, wxGBPosition( 2, 0 ), wxGBSpan( 1, 3 ), wxTOP|wxRIGHT|wxLEFT, 4 );
m_otherPDFViewer = new wxRadioButton( sizerHelperApps->GetStaticBox(), wxID_ANY, _("Other:"), wxDefaultPosition, wxDefaultSize, 0 ); m_otherPDFViewer = new wxRadioButton( sizerHelperApps->GetStaticBox(), wxID_ANY, _("Other:"), wxDefaultPosition, wxDefaultSize, 0 );
gridHelperApps->Add( m_otherPDFViewer, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 4 ); gridHelperApps->Add( m_otherPDFViewer, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 4 );
m_PDFViewerPath = new wxTextCtrl( sizerHelperApps->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_PDFViewerPath = new wxTextCtrl( sizerHelperApps->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_PDFViewerPath->SetMinSize( wxSize( 360,-1 ) ); m_PDFViewerPath->SetMinSize( wxSize( 360,-1 ) );
gridHelperApps->Add( m_PDFViewerPath, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); gridHelperApps->Add( m_PDFViewerPath, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_pdfViewerBtn = new wxBitmapButton( sizerHelperApps->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_pdfViewerBtn = new wxBitmapButton( sizerHelperApps->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_pdfViewerBtn->SetMinSize( wxSize( 29,29 ) ); m_pdfViewerBtn->SetMinSize( wxSize( 29,29 ) );
gridHelperApps->Add( m_pdfViewerBtn, wxGBPosition( 3, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); gridHelperApps->Add( m_pdfViewerBtn, wxGBPosition( 3, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
gridHelperApps->AddGrowableCol( 1 ); gridHelperApps->AddGrowableCol( 1 );
sizerHelperApps->Add( gridHelperApps, 0, wxEXPAND, 5 ); sizerHelperApps->Add( gridHelperApps, 0, wxEXPAND, 5 );
bLeftSizer->Add( sizerHelperApps, 0, wxEXPAND|wxALL, 5 ); bLeftSizer->Add( sizerHelperApps, 0, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbSizerIconsOpts; wxStaticBoxSizer* sbSizerIconsOpts;
sbSizerIconsOpts = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User Interface") ), wxVERTICAL ); sbSizerIconsOpts = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User Interface") ), wxVERTICAL );
wxFlexGridSizer* fgSizer11; wxFlexGridSizer* fgSizer11;
fgSizer11 = new wxFlexGridSizer( 0, 3, 0, 0 ); fgSizer11 = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizer11->AddGrowableCol( 1 ); fgSizer11->AddGrowableCol( 1 );
fgSizer11->SetFlexibleDirection( wxBOTH ); fgSizer11->SetFlexibleDirection( wxBOTH );
fgSizer11->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgSizer11->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTexticonscale = new wxStaticText( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Icon scale:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTexticonscale = new wxStaticText( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Icon scale:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTexticonscale->Wrap( -1 ); m_staticTexticonscale->Wrap( -1 );
fgSizer11->Add( m_staticTexticonscale, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 4 ); fgSizer11->Add( m_staticTexticonscale, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 4 );
wxBoxSizer* bSizer4; wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxHORIZONTAL ); bSizer4 = new wxBoxSizer( wxHORIZONTAL );
m_scaleSlider = new STEPPED_SLIDER( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, 50, 50, 275, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS ); m_scaleSlider = new STEPPED_SLIDER( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, 50, 50, 275, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS );
m_scaleSlider->SetMinSize( wxSize( 240,-1 ) ); m_scaleSlider->SetMinSize( wxSize( 240,-1 ) );
bSizer4->Add( m_scaleSlider, 1, wxBOTTOM|wxEXPAND, 4 ); bSizer4->Add( m_scaleSlider, 1, wxBOTTOM|wxEXPAND, 4 );
m_staticTextPerCent = new wxStaticText( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextPerCent = new wxStaticText( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextPerCent->Wrap( -1 ); m_staticTextPerCent->Wrap( -1 );
bSizer4->Add( m_staticTextPerCent, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2 ); bSizer4->Add( m_staticTextPerCent, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2 );
fgSizer11->Add( bSizer4, 1, wxEXPAND, 5 ); fgSizer11->Add( bSizer4, 1, wxEXPAND, 5 );
m_scaleAuto = new wxCheckBox( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Automatic"), wxDefaultPosition, wxDefaultSize, 0 ); m_scaleAuto = new wxCheckBox( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Automatic"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_scaleAuto, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 25 ); fgSizer11->Add( m_scaleAuto, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 25 );
fgSizer11->Add( 0, 0, 0, wxEXPAND, 5 ); fgSizer11->Add( 0, 0, 0, wxEXPAND, 5 );
sbSizerIconsOpts->Add( fgSizer11, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5 ); sbSizerIconsOpts->Add( fgSizer11, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5 );
m_checkBoxIconsInMenus = new wxCheckBox( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Show icons in menus"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkBoxIconsInMenus = new wxCheckBox( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Show icons in menus"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerIconsOpts->Add( m_checkBoxIconsInMenus, 0, wxALL, 4 ); sbSizerIconsOpts->Add( m_checkBoxIconsInMenus, 0, wxALL, 4 );
bLeftSizer->Add( sbSizerIconsOpts, 0, wxEXPAND|wxALL, 5 ); bLeftSizer->Add( sbSizerIconsOpts, 0, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbSizer51; wxStaticBoxSizer* sbSizer51;
sbSizer51 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pan and Zoom") ), wxVERTICAL ); sbSizer51 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pan and Zoom") ), wxVERTICAL );
m_ZoomCenterOpt = new wxCheckBox( sbSizer51->GetStaticBox(), wxID_ANY, _("Ce&nter and warp cursor on zoom"), wxDefaultPosition, wxDefaultSize, 0 ); m_ZoomCenterOpt = new wxCheckBox( sbSizer51->GetStaticBox(), wxID_ANY, _("Ce&nter and warp cursor on zoom"), wxDefaultPosition, wxDefaultSize, 0 );
m_ZoomCenterOpt->SetToolTip( _("Center the cursor on screen when zooming.") ); m_ZoomCenterOpt->SetToolTip( _("Center the cursor on screen when zooming.") );
sbSizer51->Add( m_ZoomCenterOpt, 0, wxTOP|wxRIGHT|wxLEFT, 4 ); sbSizer51->Add( m_ZoomCenterOpt, 0, wxTOP|wxRIGHT|wxLEFT, 4 );
m_MousewheelPANOpt = new wxCheckBox( sbSizer51->GetStaticBox(), wxID_ANY, _("Use touchpad to pan"), wxDefaultPosition, wxDefaultSize, 0 ); m_MousewheelPANOpt = new wxCheckBox( sbSizer51->GetStaticBox(), wxID_ANY, _("Use touchpad to pan"), wxDefaultPosition, wxDefaultSize, 0 );
m_MousewheelPANOpt->SetToolTip( _("Enable touchpad-friendly controls (pan with scroll action, zoom with Ctrl+scroll).") ); m_MousewheelPANOpt->SetToolTip( _("Enable touchpad-friendly controls (pan with scroll action, zoom with Ctrl+scroll).") );
sbSizer51->Add( m_MousewheelPANOpt, 0, wxALL, 4 ); sbSizer51->Add( m_MousewheelPANOpt, 0, wxALL, 4 );
m_AutoPANOpt = new wxCheckBox( sbSizer51->GetStaticBox(), wxID_AUTOPAN, _("&Pan while moving object"), wxDefaultPosition, wxDefaultSize, 0 ); m_AutoPANOpt = new wxCheckBox( sbSizer51->GetStaticBox(), wxID_AUTOPAN, _("&Pan while moving object"), wxDefaultPosition, wxDefaultSize, 0 );
m_AutoPANOpt->SetToolTip( _("When drawing a track or moving an item, pan when approaching the edge of the display.") ); m_AutoPANOpt->SetToolTip( _("When drawing a track or moving an item, pan when approaching the edge of the display.") );
sbSizer51->Add( m_AutoPANOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 ); sbSizer51->Add( m_AutoPANOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
bLeftSizer->Add( sbSizer51, 0, wxEXPAND|wxALL, 5 ); bLeftSizer->Add( sbSizer51, 0, wxEXPAND|wxALL, 5 );
bPanelSizer->Add( bLeftSizer, 0, 0, 5 ); bPanelSizer->Add( bLeftSizer, 0, 0, 5 );
this->SetSizer( bPanelSizer ); this->SetSizer( bPanelSizer );
this->Layout(); this->Layout();
bPanelSizer->Fit( this ); bPanelSizer->Fit( this );
// Connect Events // Connect Events
m_textEditorBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnTextEditorClick ), NULL, this ); m_textEditorBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnTextEditorClick ), NULL, this );
m_PDFViewerPath->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_COMMON_SETTINGS_BASE::onUpdateUIPdfPath ), NULL, this ); m_PDFViewerPath->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_COMMON_SETTINGS_BASE::onUpdateUIPdfPath ), NULL, this );
@ -223,5 +234,5 @@ PANEL_COMMON_SETTINGS_BASE::~PANEL_COMMON_SETTINGS_BASE()
m_scaleSlider->Disconnect( wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this ); m_scaleSlider->Disconnect( wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Disconnect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this ); m_scaleSlider->Disconnect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this );
m_scaleAuto->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleAuto ), NULL, this ); m_scaleAuto->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleAuto ), NULL, this );
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,11 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 11 2018) // C++ code generated with wxFormBuilder (version Nov 23 2018)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __PANEL_COMMON_SETTINGS_BASE_H__ #pragma once
#define __PANEL_COMMON_SETTINGS_BASE_H__
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
@ -39,21 +38,22 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class PANEL_COMMON_SETTINGS_BASE /// Class PANEL_COMMON_SETTINGS_BASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class PANEL_COMMON_SETTINGS_BASE : public wxPanel class PANEL_COMMON_SETTINGS_BASE : public wxPanel
{ {
private: private:
protected: protected:
enum enum
{ {
wxID_AUTOPAN = 1000 wxID_AUTOPAN = 1000
}; };
wxStaticText* m_staticTextautosave; wxStaticText* m_staticTextautosave;
wxSpinCtrl* m_SaveTime; wxSpinCtrl* m_SaveTime;
wxStaticText* m_staticTextFileHistorySize; wxStaticText* m_staticTextFileHistorySize;
wxSpinCtrl* m_fileHistorySize; wxSpinCtrl* m_fileHistorySize;
wxChoice* m_antialiasing; wxChoice* m_antialiasing;
wxChoice* m_antialiasingFallback;
wxTextCtrl* m_textEditorPath; wxTextCtrl* m_textEditorPath;
wxBitmapButton* m_textEditorBtn; wxBitmapButton* m_textEditorBtn;
wxRadioButton* m_defaultPDFViewer; wxRadioButton* m_defaultPDFViewer;
@ -68,20 +68,19 @@ class PANEL_COMMON_SETTINGS_BASE : public wxPanel
wxCheckBox* m_ZoomCenterOpt; wxCheckBox* m_ZoomCenterOpt;
wxCheckBox* m_MousewheelPANOpt; wxCheckBox* m_MousewheelPANOpt;
wxCheckBox* m_AutoPANOpt; wxCheckBox* m_AutoPANOpt;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnTextEditorClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnTextEditorClick( wxCommandEvent& event ) { event.Skip(); }
virtual void onUpdateUIPdfPath( wxUpdateUIEvent& event ) { event.Skip(); } virtual void onUpdateUIPdfPath( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnPDFViewerClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnPDFViewerClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnScaleSlider( wxScrollEvent& event ) { event.Skip(); } virtual void OnScaleSlider( wxScrollEvent& event ) { event.Skip(); }
virtual void OnScaleAuto( wxCommandEvent& event ) { event.Skip(); } virtual void OnScaleAuto( wxCommandEvent& event ) { event.Skip(); }
public: public:
PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_COMMON_SETTINGS_BASE(); ~PANEL_COMMON_SETTINGS_BASE();
}; };
#endif //__PANEL_COMMON_SETTINGS_BASE_H__

View File

@ -34,7 +34,8 @@
using namespace KIGFX; using namespace KIGFX;
CAIRO_COMPOSITOR::CAIRO_COMPOSITOR( cairo_t** aMainContext ) : CAIRO_COMPOSITOR::CAIRO_COMPOSITOR( cairo_t** aMainContext ) :
m_current( 0 ), m_currentContext( aMainContext ), m_mainContext( *aMainContext ) m_current( 0 ), m_currentContext( aMainContext ), m_mainContext( *aMainContext ),
m_currentAntialiasingMode( CAIRO_ANTIALIAS_NONE )
{ {
// Do not have uninitialized members: // Do not have uninitialized members:
cairo_matrix_init_identity( &m_matrix ); cairo_matrix_init_identity( &m_matrix );
@ -55,6 +56,28 @@ void CAIRO_COMPOSITOR::Initialize()
} }
void CAIRO_COMPOSITOR::SetAntialiasingMode( CAIRO_ANTIALIASING_MODE aMode )
{
switch( aMode )
{
case CAIRO_ANTIALIASING_MODE::FAST:
m_currentAntialiasingMode = CAIRO_ANTIALIAS_FAST;
break;
case CAIRO_ANTIALIASING_MODE::GOOD:
m_currentAntialiasingMode = CAIRO_ANTIALIAS_GOOD;
break;
case CAIRO_ANTIALIASING_MODE::BEST:
m_currentAntialiasingMode = CAIRO_ANTIALIAS_BEST;
break;
default:
m_currentAntialiasingMode = CAIRO_ANTIALIAS_NONE;
}
clean();
}
void CAIRO_COMPOSITOR::Resize( unsigned int aWidth, unsigned int aHeight ) void CAIRO_COMPOSITOR::Resize( unsigned int aWidth, unsigned int aHeight )
{ {
clean(); clean();
@ -86,7 +109,7 @@ unsigned int CAIRO_COMPOSITOR::CreateBuffer()
#endif /* __WXDEBUG__ */ #endif /* __WXDEBUG__ */
// Set default settings for the buffer // Set default settings for the buffer
cairo_set_antialias( context, CAIRO_ANTIALIAS_NONE ); cairo_set_antialias( context, m_currentAntialiasingMode );
cairo_set_line_join( context, CAIRO_LINE_JOIN_ROUND ); cairo_set_line_join( context, CAIRO_LINE_JOIN_ROUND );
cairo_set_line_cap( context, CAIRO_LINE_CAP_ROUND ); cairo_set_line_cap( context, CAIRO_LINE_CAP_ROUND );

View File

@ -739,6 +739,7 @@ void CAIRO_GAL_BASE::EnableDepthTest( bool aEnabled )
void CAIRO_GAL_BASE::resetContext() void CAIRO_GAL_BASE::resetContext()
{ {
cairo_set_antialias( context, CAIRO_ANTIALIAS_NONE ); cairo_set_antialias( context, CAIRO_ANTIALIAS_NONE );
ClearScreen(); ClearScreen();
@ -1227,6 +1228,7 @@ void CAIRO_GAL::setCompositor()
// Recreate the compositor with the new Cairo context // Recreate the compositor with the new Cairo context
compositor.reset( new CAIRO_COMPOSITOR( &currentContext ) ); compositor.reset( new CAIRO_COMPOSITOR( &currentContext ) );
compositor->Resize( screenSize.x, screenSize.y ); compositor->Resize( screenSize.x, screenSize.y );
compositor->SetAntialiasingMode( options.cairo_antialiasing_mode );
// Prepare buffers // Prepare buffers
mainBuffer = compositor->CreateBuffer(); mainBuffer = compositor->CreateBuffer();
@ -1254,6 +1256,16 @@ bool CAIRO_GAL::updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions )
{ {
bool refresh = false; bool refresh = false;
if( validCompositor && aOptions.cairo_antialiasing_mode != compositor->GetAntialiasingMode() )
{
compositor->SetAntialiasingMode( options.cairo_antialiasing_mode );
validCompositor = false;
deinitSurface();
refresh = true;
}
if( super::updatedGalDisplayOptions( aOptions ) ) if( super::updatedGalDisplayOptions( aOptions ) )
{ {
Refresh(); Refresh();

View File

@ -49,6 +49,7 @@ static const UTIL::CFG_MAP<KIGFX::GRID_STYLE> gridStyleConfigVals =
GAL_DISPLAY_OPTIONS::GAL_DISPLAY_OPTIONS() GAL_DISPLAY_OPTIONS::GAL_DISPLAY_OPTIONS()
: gl_antialiasing_mode( OPENGL_ANTIALIASING_MODE::NONE ), : gl_antialiasing_mode( OPENGL_ANTIALIASING_MODE::NONE ),
cairo_antialiasing_mode( CAIRO_ANTIALIASING_MODE::NONE ),
m_gridStyle( GRID_STYLE::DOTS ), m_gridStyle( GRID_STYLE::DOTS ),
m_gridLineWidth( 0.5 ), m_gridLineWidth( 0.5 ),
m_gridMinSpacing( 10.0 ), m_gridMinSpacing( 10.0 ),

View File

@ -302,6 +302,10 @@ void EDA_DRAW_FRAME::CommonSettingsChanged()
int tmp; int tmp;
settings->Read( GAL_ANTIALIASING_MODE_KEY, &tmp, (int) KIGFX::OPENGL_ANTIALIASING_MODE::NONE ); settings->Read( GAL_ANTIALIASING_MODE_KEY, &tmp, (int) KIGFX::OPENGL_ANTIALIASING_MODE::NONE );
m_galDisplayOptions.gl_antialiasing_mode = (KIGFX::OPENGL_ANTIALIASING_MODE) tmp; m_galDisplayOptions.gl_antialiasing_mode = (KIGFX::OPENGL_ANTIALIASING_MODE) tmp;
settings->Read( CAIRO_ANTIALIASING_MODE_KEY, &tmp, (int) KIGFX::CAIRO_ANTIALIASING_MODE::NONE );
m_galDisplayOptions.cairo_antialiasing_mode = (KIGFX::CAIRO_ANTIALIASING_MODE) tmp;
m_galDisplayOptions.NotifyChanged(); m_galDisplayOptions.NotifyChanged();
} }
@ -849,6 +853,10 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg )
int temp; int temp;
cmnCfg->Read( GAL_ANTIALIASING_MODE_KEY, &temp, (int) KIGFX::OPENGL_ANTIALIASING_MODE::NONE ); cmnCfg->Read( GAL_ANTIALIASING_MODE_KEY, &temp, (int) KIGFX::OPENGL_ANTIALIASING_MODE::NONE );
m_galDisplayOptions.gl_antialiasing_mode = (KIGFX::OPENGL_ANTIALIASING_MODE) temp; m_galDisplayOptions.gl_antialiasing_mode = (KIGFX::OPENGL_ANTIALIASING_MODE) temp;
cmnCfg->Read( CAIRO_ANTIALIASING_MODE_KEY, &temp, (int) KIGFX::CAIRO_ANTIALIASING_MODE::NONE );
m_galDisplayOptions.cairo_antialiasing_mode = (KIGFX::CAIRO_ANTIALIASING_MODE) temp;
m_galDisplayOptions.NotifyChanged(); m_galDisplayOptions.NotifyChanged();
} }

View File

@ -304,6 +304,10 @@ void EDA_DRAW_FRAME::CommonSettingsChanged()
int tmp; int tmp;
settings->Read( GAL_ANTIALIASING_MODE_KEY, &tmp, (int) KIGFX::OPENGL_ANTIALIASING_MODE::NONE ); settings->Read( GAL_ANTIALIASING_MODE_KEY, &tmp, (int) KIGFX::OPENGL_ANTIALIASING_MODE::NONE );
m_galDisplayOptions.gl_antialiasing_mode = (KIGFX::OPENGL_ANTIALIASING_MODE) tmp; m_galDisplayOptions.gl_antialiasing_mode = (KIGFX::OPENGL_ANTIALIASING_MODE) tmp;
settings->Read( CAIRO_ANTIALIASING_MODE_KEY, &tmp, (int) KIGFX::CAIRO_ANTIALIASING_MODE::NONE );
m_galDisplayOptions.cairo_antialiasing_mode = (KIGFX::CAIRO_ANTIALIASING_MODE) tmp;
m_galDisplayOptions.NotifyChanged(); m_galDisplayOptions.NotifyChanged();
} }
@ -868,6 +872,10 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg )
int temp; int temp;
cmnCfg->Read( GAL_ANTIALIASING_MODE_KEY, &temp, (int) KIGFX::OPENGL_ANTIALIASING_MODE::NONE ); cmnCfg->Read( GAL_ANTIALIASING_MODE_KEY, &temp, (int) KIGFX::OPENGL_ANTIALIASING_MODE::NONE );
m_galDisplayOptions.gl_antialiasing_mode = (KIGFX::OPENGL_ANTIALIASING_MODE) temp; m_galDisplayOptions.gl_antialiasing_mode = (KIGFX::OPENGL_ANTIALIASING_MODE) temp;
cmnCfg->Read( CAIRO_ANTIALIASING_MODE_KEY, &temp, (int) KIGFX::CAIRO_ANTIALIASING_MODE::NONE );
m_galDisplayOptions.cairo_antialiasing_mode = (KIGFX::CAIRO_ANTIALIASING_MODE) temp;
m_galDisplayOptions.NotifyChanged(); m_galDisplayOptions.NotifyChanged();
} }

View File

@ -553,7 +553,8 @@ void PGM_BASE::loadCommonSettings()
m_common_settings->Write( USE_ICONS_IN_MENUS_KEY, defaultUseIconsInMenus ); m_common_settings->Write( USE_ICONS_IN_MENUS_KEY, defaultUseIconsInMenus );
if( !m_common_settings->HasEntry( ICON_SCALE_KEY ) if( !m_common_settings->HasEntry( ICON_SCALE_KEY )
|| !m_common_settings->HasEntry( GAL_ANTIALIASING_MODE_KEY ) ) || !m_common_settings->HasEntry( GAL_ANTIALIASING_MODE_KEY )
|| !m_common_settings->HasEntry( CAIRO_ANTIALIASING_MODE_KEY ) )
{ {
// 5.0 and earlier saved common settings in each app, and saved hardware antialiasing // 5.0 and earlier saved common settings in each app, and saved hardware antialiasing
// options only in pcbnew (which was the only canvas to support them). Since there's // options only in pcbnew (which was the only canvas to support them). Since there's
@ -588,6 +589,14 @@ void PGM_BASE::loadCommonSettings()
&temp, (int) KIGFX::OPENGL_ANTIALIASING_MODE::NONE ); &temp, (int) KIGFX::OPENGL_ANTIALIASING_MODE::NONE );
m_common_settings->Write( GAL_ANTIALIASING_MODE_KEY, temp ); m_common_settings->Write( GAL_ANTIALIASING_MODE_KEY, temp );
} }
if( !m_common_settings->HasEntry( CAIRO_ANTIALIASING_MODE_KEY ) )
{
int temp;
pcbnewConfig->Read( pcbFrameKey + GAL_DISPLAY_OPTIONS_KEY + CAIRO_ANTIALIASING_MODE_KEY,
&temp, (int) KIGFX::CAIRO_ANTIALIASING_MODE::NONE );
m_common_settings->Write( CAIRO_ANTIALIASING_MODE_KEY, temp );
}
} }
m_editor_name = m_common_settings->Read( "Editor" ); m_editor_name = m_common_settings->Read( "Editor" );

View File

@ -32,6 +32,7 @@
#define CAIRO_COMPOSITOR_H_ #define CAIRO_COMPOSITOR_H_
#include <gal/compositor.h> #include <gal/compositor.h>
#include <gal/gal_display_options.h>
#include <cairo.h> #include <cairo.h>
#include <boost/smart_ptr/shared_array.hpp> #include <boost/smart_ptr/shared_array.hpp>
#include <deque> #include <deque>
@ -74,6 +75,22 @@ public:
/// @copydoc COMPOSITOR::Present() /// @copydoc COMPOSITOR::Present()
virtual void Present() override; virtual void Present() override;
void SetAntialiasingMode( CAIRO_ANTIALIASING_MODE aMode ); // clears all buffers
CAIRO_ANTIALIASING_MODE GetAntialiasingMode() const
{
switch( m_currentAntialiasingMode )
{
case CAIRO_ANTIALIAS_FAST:
return CAIRO_ANTIALIASING_MODE::FAST;
case CAIRO_ANTIALIAS_GOOD:
return CAIRO_ANTIALIASING_MODE::GOOD;
case CAIRO_ANTIALIAS_BEST:
return CAIRO_ANTIALIASING_MODE::BEST;
default:
return CAIRO_ANTIALIASING_MODE::NONE;
}
}
/** /**
* Function SetMainContext() * Function SetMainContext()
* Sets a context to be treated as the main context (ie. as a target of buffers rendering and * Sets a context to be treated as the main context (ie. as a target of buffers rendering and
@ -116,6 +133,8 @@ protected:
unsigned int m_stride; ///< Stride to use given the desired format and width unsigned int m_stride; ///< Stride to use given the desired format and width
unsigned int m_bufferSize; ///< Amount of memory needed to store a buffer unsigned int m_bufferSize; ///< Amount of memory needed to store a buffer
cairo_antialias_t m_currentAntialiasingMode;
/** /**
* Function clean() * Function clean()
* performs freeing of resources. * performs freeing of resources.

View File

@ -50,6 +50,14 @@ namespace KIGFX
SUPERSAMPLING_X4, SUPERSAMPLING_X4,
}; };
enum class CAIRO_ANTIALIASING_MODE
{
NONE,
FAST,
GOOD,
BEST,
};
class GAL_DISPLAY_OPTIONS; class GAL_DISPLAY_OPTIONS;
class GAL_DISPLAY_OPTIONS_OBSERVER class GAL_DISPLAY_OPTIONS_OBSERVER
@ -73,6 +81,8 @@ namespace KIGFX
OPENGL_ANTIALIASING_MODE gl_antialiasing_mode; OPENGL_ANTIALIASING_MODE gl_antialiasing_mode;
CAIRO_ANTIALIASING_MODE cairo_antialiasing_mode;
///> The grid style to draw the grid in ///> The grid style to draw the grid in
KIGFX::GRID_STYLE m_gridStyle; KIGFX::GRID_STYLE m_gridStyle;

View File

@ -52,6 +52,7 @@
#define FILE_HISTORY_SIZE_KEY wxT( "FileHistorySize" ) #define FILE_HISTORY_SIZE_KEY wxT( "FileHistorySize" )
#define GAL_DISPLAY_OPTIONS_KEY wxT( "GalDisplayOptions" ) #define GAL_DISPLAY_OPTIONS_KEY wxT( "GalDisplayOptions" )
#define GAL_ANTIALIASING_MODE_KEY wxT( "OpenGLAntialiasingMode" ) #define GAL_ANTIALIASING_MODE_KEY wxT( "OpenGLAntialiasingMode" )
#define CAIRO_ANTIALIASING_MODE_KEY wxT( "CairoAntialiasingMode" )
///@} ///@}

View File

@ -390,6 +390,9 @@ FOOTPRINT_PREVIEW_PANEL* FOOTPRINT_PREVIEW_PANEL::New( KIWAY* aKiway, wxWindow*
commonCfg->Read( GAL_ANTIALIASING_MODE_KEY, &itemp, (int) KIGFX::OPENGL_ANTIALIASING_MODE::NONE ); commonCfg->Read( GAL_ANTIALIASING_MODE_KEY, &itemp, (int) KIGFX::OPENGL_ANTIALIASING_MODE::NONE );
gal_opts.gl_antialiasing_mode = (KIGFX::OPENGL_ANTIALIASING_MODE) itemp; gal_opts.gl_antialiasing_mode = (KIGFX::OPENGL_ANTIALIASING_MODE) itemp;
commonCfg->Read( CAIRO_ANTIALIASING_MODE_KEY, &itemp, (int) KIGFX::CAIRO_ANTIALIASING_MODE::NONE );
gal_opts.cairo_antialiasing_mode = (KIGFX::CAIRO_ANTIALIASING_MODE) itemp;
} }
#ifdef __WXMAC__ #ifdef __WXMAC__