diff --git a/common/bitmap.cpp b/common/bitmap.cpp index 1cf8ba4a4a..895f0ca44c 100644 --- a/common/bitmap.cpp +++ b/common/bitmap.cpp @@ -145,10 +145,13 @@ static int get_scale_factor( wxWindow* aWindow ) } -wxBitmap KiScaledBitmap( BITMAPS aBitmap, wxWindow* aWindow, int aHeight ) +wxBitmap KiScaledBitmap( BITMAPS aBitmap, wxWindow* aWindow, int aHeight, bool aQuantized ) { // Bitmap conversions are cached because they can be slow. - const int scale = get_scale_factor( aWindow ); + int scale = get_scale_factor( aWindow ); + + if( aQuantized ) + scale = KiROUND( (double) scale / 4.0 ) * 4; SCALED_BITMAP_ID id = { static_cast( aBitmap ), scale }; diff --git a/include/bitmaps/bitmap_types.h b/include/bitmaps/bitmap_types.h index 803f24f839..40211d22d3 100644 --- a/include/bitmaps/bitmap_types.h +++ b/include/bitmaps/bitmap_types.h @@ -75,8 +75,10 @@ void ClearScaledBitmapCache(); * @param aBitmap is from the BITMAPS enum in bitmaps_list.h * @param aWindow target window for scaling context * @param aHeight is the requested image height for the source bitmap, or -1 for any height + * @param aQuantized if true scaling will be rounded to integers (2X, 3X, etc.). */ -wxBitmap KiScaledBitmap( BITMAPS aBitmap, wxWindow* aWindow, int aHeight = -1 ); +wxBitmap KiScaledBitmap( BITMAPS aBitmap, wxWindow* aWindow, int aHeight = -1, + bool aQuantized = false ); /** * Overload of the above function that takes another wxBitmap as a parameter. diff --git a/kicad/dialogs/panel_kicad_launcher.cpp b/kicad/dialogs/panel_kicad_launcher.cpp index 6d3c970481..d215d81c46 100644 --- a/kicad/dialogs/panel_kicad_launcher.cpp +++ b/kicad/dialogs/panel_kicad_launcher.cpp @@ -104,41 +104,41 @@ void PANEL_KICAD_LAUNCHER::CreateLaunchers() }; addLauncher( KICAD_MANAGER_ACTIONS::editSchematic, - KiScaledBitmap( BITMAPS::icon_eeschema, this, 48 ), + KiScaledBitmap( BITMAPS::icon_eeschema, this, 48, true ), _( "Edit the project schematic" ) ); addLauncher( KICAD_MANAGER_ACTIONS::editSymbols, - KiScaledBitmap( BITMAPS::icon_libedit, this, 48 ), + KiScaledBitmap( BITMAPS::icon_libedit, this, 48, true ), _( "Edit global and/or project schematic symbol libraries" ) ); addLauncher( KICAD_MANAGER_ACTIONS::editPCB, - KiScaledBitmap( BITMAPS::icon_pcbnew, this, 48 ), + KiScaledBitmap( BITMAPS::icon_pcbnew, this, 48, true ), _( "Edit the project PCB design" ) ); addLauncher( KICAD_MANAGER_ACTIONS::editFootprints, - KiScaledBitmap( BITMAPS::icon_modedit, this, 48 ), + KiScaledBitmap( BITMAPS::icon_modedit, this, 48, true ), _( "Edit global and/or project PCB footprint libraries" ) ); addLauncher( KICAD_MANAGER_ACTIONS::viewGerbers, - KiScaledBitmap( BITMAPS::icon_gerbview, this, 48 ), + KiScaledBitmap( BITMAPS::icon_gerbview, this, 48, true ), _( "Preview Gerber files" ) ); addLauncher( KICAD_MANAGER_ACTIONS::convertImage, - KiScaledBitmap( BITMAPS::icon_bitmap2component, this, 48 ), + KiScaledBitmap( BITMAPS::icon_bitmap2component, this, 48, true ), _( "Convert bitmap images to schematic symbols or PCB footprints" ) ); addLauncher( KICAD_MANAGER_ACTIONS::showCalculator, - KiScaledBitmap( BITMAPS::icon_pcbcalculator, this, 48 ), + KiScaledBitmap( BITMAPS::icon_pcbcalculator, this, 48, true ), _( "Show tools for calculating resistance, current capacity, etc." ) ); addLauncher( KICAD_MANAGER_ACTIONS::editDrawingSheet, - KiScaledBitmap( BITMAPS::icon_pagelayout_editor, this, 48 ), + KiScaledBitmap( BITMAPS::icon_pagelayout_editor, this, 48, true ), _( "Edit drawing sheet borders and title blocks for use in schematics and PCB " "designs" ) ); #ifdef PCM addLauncher( KICAD_MANAGER_ACTIONS::showPluginManager, - KiScaledBitmap( BITMAPS::icon_pcm, this, 48 ), + KiScaledBitmap( BITMAPS::icon_pcm, this, 48, true ), _( "Manage downloadable packages from KiCad and 3rd party repositories" ) ); #endif