Bitmaps: respect source DPI
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/13565
This commit is contained in:
parent
f81642bbb3
commit
369c0efade
|
@ -137,6 +137,17 @@ bool BITMAP_BASE::ReadImageFile( const wxString& aFullFilename )
|
|||
m_originalImage = new wxImage( *m_image );
|
||||
rebuildBitmap();
|
||||
|
||||
// Todo: eventually we need to support dpi / scaling in both dimensions
|
||||
int dpiX = m_originalImage->GetOptionInt( wxIMAGE_OPTION_RESOLUTIONX );
|
||||
|
||||
if( dpiX > 1 )
|
||||
{
|
||||
if( m_originalImage->GetOptionInt( wxIMAGE_OPTION_RESOLUTIONUNIT ) == wxIMAGE_RESOLUTION_CM )
|
||||
m_ppi = KiROUND( dpiX * 2.54 );
|
||||
else
|
||||
m_ppi = dpiX;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,13 @@ SCH_BITMAP& SCH_BITMAP::operator=( const SCH_ITEM& aItem )
|
|||
|
||||
bool SCH_BITMAP::ReadImageFile( const wxString& aFullFilename )
|
||||
{
|
||||
return m_image->ReadImageFile( aFullFilename );
|
||||
if( m_image->ReadImageFile( aFullFilename ) )
|
||||
{
|
||||
m_image->SetPixelSizeIu( 254000.0 / m_image->GetPPI() );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -84,7 +84,13 @@ PCB_BITMAP& PCB_BITMAP::operator=( const BOARD_ITEM& aItem )
|
|||
|
||||
bool PCB_BITMAP::ReadImageFile( const wxString& aFullFilename )
|
||||
{
|
||||
return m_image->ReadImageFile( aFullFilename );
|
||||
if( m_image->ReadImageFile( aFullFilename ) )
|
||||
{
|
||||
m_image->SetPixelSizeIu( (float) pcbIUScale.MilsToIU( 1000 ) / m_image->GetPPI() );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue