From f0e9f9f15a44fd008fcb5dc450935a906804246b Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Wed, 12 Jun 2024 23:04:22 +0300 Subject: [PATCH] Optimize PAD LoD calculation. --- pcbnew/pad.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pcbnew/pad.cpp b/pcbnew/pad.cpp index 64786c74b8..b427364116 100644 --- a/pcbnew/pad.cpp +++ b/pcbnew/pad.cpp @@ -1620,8 +1620,15 @@ double PAD::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const return ( double ) pcbIUScale.mmToIU( 5 ) / divisor; } - // Passed all tests; show. - return 0.0; + VECTOR2L padSize = + GetShape() != PAD_SHAPE::CUSTOM ? VECTOR2L( GetSize() ) : GetBoundingBox().GetSize(); + + int64_t minSide = std::min( padSize.x, padSize.y ); + + if( minSide > 0 ) + return std::min( (double) pcbIUScale.mmToIU( 0.2 ) / minSide, 3.5 ); + else + return 0; }