From c78a2ba4f8685a6c9235458e24bcfe917f5eab4e Mon Sep 17 00:00:00 2001 From: Chris Pavlina Date: Wed, 19 Jul 2017 11:43:18 -0600 Subject: [PATCH] Render symbols correctly with convert=0 in chooser Fixes: lp:1705315 * https://bugs.launchpad.net/kicad/+bug/1705315 --- eeschema/dialogs/dialog_choose_component.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eeschema/dialogs/dialog_choose_component.cpp b/eeschema/dialogs/dialog_choose_component.cpp index ea989c70e3..0299bb6d19 100644 --- a/eeschema/dialogs/dialog_choose_component.cpp +++ b/eeschema/dialogs/dialog_choose_component.cpp @@ -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 ); }