From c7a71b44e5882660ed8de3fbf2467bda168d0361 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 26 Feb 2021 17:18:31 +0000 Subject: [PATCH] Zones must be entirely inside for insideCourtyard. This is a huge performance win as otherwise we're doing *lots* of shape collisions with ground planes. Fixes https://gitlab.com/kicad/code/kicad/issues/7720 --- pcbnew/pcb_expr_evaluator.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pcbnew/pcb_expr_evaluator.cpp b/pcbnew/pcb_expr_evaluator.cpp index b15e89c0e4..edcdca37a5 100644 --- a/pcbnew/pcb_expr_evaluator.cpp +++ b/pcbnew/pcb_expr_evaluator.cpp @@ -177,8 +177,17 @@ static void insideCourtyard( LIBEVAL::CONTEXT* aCtx, void* self ) else footprintCourtyard = footprint->GetPolyCourtyardFront(); - if( !footprint->GetBoundingBox().Intersects( itemBBox ) ) - return false; + if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T ) + { + // A zone must be entirely inside the courtyard to be considered + if( !footprint->GetBoundingBox().Contains( itemBBox ) ) + return false; + } + else + { + if( !footprint->GetBoundingBox().Intersects( itemBBox ) ) + return false; + } if( !shape ) shape = item->GetEffectiveShape( context->GetLayer() );