Render symbols correctly with convert=0 in chooser

Fixes: lp:1705315
* https://bugs.launchpad.net/kicad/+bug/1705315
This commit is contained in:
Chris Pavlina 2017-07-19 11:43:18 -06:00
parent 04d299ae0e
commit c78a2ba4f8
1 changed files with 4 additions and 4 deletions

View File

@ -352,13 +352,13 @@ void DIALOG_CHOOSE_COMPONENT::RenderPreview( LIB_PART* aComponent, int aUnit )
if( !aComponent )
return;
if( aUnit <= 0 )
aUnit = 1;
int unit = aUnit > 0 ? aUnit : 1;
int convert = m_deMorganConvert > 0 ? m_deMorganConvert : 1;
dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
// Find joint bounding box for everything we are about to draw.
EDA_RECT bBox = aComponent->GetUnitBoundingBox( aUnit, m_deMorganConvert );
EDA_RECT bBox = aComponent->GetUnitBoundingBox( unit, convert );
const double xscale = (double) dc_size.x / bBox.GetWidth();
const double yscale = (double) dc_size.y / bBox.GetHeight();
const double scale = std::min( xscale, yscale ) * 0.85;
@ -369,5 +369,5 @@ void DIALOG_CHOOSE_COMPONENT::RenderPreview( LIB_PART* aComponent, int aUnit )
auto opts = PART_DRAW_OPTIONS::Default();
opts.draw_hidden_fields = false;
aComponent->Draw( nullptr, &dc, offset, aUnit, m_deMorganConvert, opts );
aComponent->Draw( nullptr, &dc, offset, unit, convert, opts );
}