Draw fp grid layer swatch in proper scaling on hidpi.

This commit is contained in:
Alex Shvartzkop 2024-05-23 05:07:31 +03:00
parent f74d1060d4
commit c2a80092d7
3 changed files with 5 additions and 3 deletions

View File

@ -354,7 +354,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow()
col_size = std::max( col_size, GetTextExtent( board->GetLayerName( layer ) ).x ); col_size = std::max( col_size, GetTextExtent( board->GetLayerName( layer ) ).x );
// Swatch and gaps: // Swatch and gaps:
col_size += 26; col_size += KiROUND( 14 * GetDPIScaleFactor() ) + 12;
} }
if( m_itemsGrid->IsColShown( col ) ) if( m_itemsGrid->IsColShown( col ) )

View File

@ -369,7 +369,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow()
col_size = std::max( col_size, GetTextExtent( board->GetLayerName( layer ) ).x ); col_size = std::max( col_size, GetTextExtent( board->GetLayerName( layer ) ).x );
// Swatch and gaps: // Swatch and gaps:
col_size += 26; col_size += KiROUND( 14 * GetDPIScaleFactor() ) + 12;
} }
if( m_itemsGrid->IsColShown( col ) ) if( m_itemsGrid->IsColShown( col ) )

View File

@ -72,7 +72,9 @@ void GRID_CELL_LAYER_RENDERER::Draw( wxGrid& aGrid, wxGridCellAttr& aAttr, wxDC&
} }
// draw the swatch // draw the swatch
wxBitmap bitmap( 14, 14 ); int size = KiROUND( 14 * aDC.GetContentScaleFactor() );
wxBitmap bitmap( size, size );
LAYER_SELECTOR::DrawColorSwatch( bitmap, LAYER_SELECTOR::DrawColorSwatch( bitmap,
cs->GetColor( ToLAYER_ID( LAYER_PCB_BACKGROUND ) ), cs->GetColor( ToLAYER_ID( LAYER_PCB_BACKGROUND ) ),
cs->GetColor( ToLAYER_ID( value ) ) ); cs->GetColor( ToLAYER_ID( value ) ) );