From 4b4d9d97708337c7df66a69be91213621b25b05d Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 1 Aug 2015 12:20:23 +0200 Subject: [PATCH] Plot solder mask layer: fix incorrect margin of zones drawn on this layer (zone areas were slighly larger than the actual areas) Fix a few minor and very minor other issues: coverity warnings and compil warning. --- common/class_marker_base.cpp | 1 + include/geometry/shape_line_chain.h | 3 +-- pcbnew/class_text_mod.cpp | 6 +++--- pcbnew/plot_board_layers.cpp | 20 +++++++++++++------ pcbnew/xchgmod.cpp | 3 ++- ...ones_convert_to_polygons_aux_functions.cpp | 2 +- potrace/greymap.cpp | 3 ++- 7 files changed, 24 insertions(+), 14 deletions(-) diff --git a/common/class_marker_base.cpp b/common/class_marker_base.cpp index 280048a753..91e05a2ad7 100644 --- a/common/class_marker_base.cpp +++ b/common/class_marker_base.cpp @@ -90,6 +90,7 @@ void MARKER_BASE::init() MARKER_BASE::MARKER_BASE( const MARKER_BASE& aMarker ) { m_Pos = aMarker.m_Pos; + m_ErrorLevel = aMarker.m_ErrorLevel; m_MarkerType = aMarker.m_MarkerType; m_Color = aMarker.m_Color; m_ShapeBoundingBox = aMarker.m_ShapeBoundingBox; diff --git a/include/geometry/shape_line_chain.h b/include/geometry/shape_line_chain.h index 16b80f32b5..6b9632c94e 100644 --- a/include/geometry/shape_line_chain.h +++ b/include/geometry/shape_line_chain.h @@ -254,8 +254,7 @@ public: { if( aIndex < 0 ) aIndex += PointCount(); - - if( aIndex >= PointCount() ) + else if( aIndex >= PointCount() ) aIndex -= PointCount(); return m_points[aIndex]; diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index 0cc8389100..42653561b6 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -1,9 +1,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -108,7 +108,7 @@ void TEXTE_MODULE::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis ) // the mirror is around the Y axis or X axis if aMirrorAroundXAxis = true // the position is mirrored, but the text itself is not mirrored if( aMirrorAroundXAxis ) - MIRROR( m_Pos.x, aCentre.x ); + MIRROR( m_Pos.y, aCentre.y ); else MIRROR( m_Pos.x, aCentre.x ); NEGATE_AND_NORMALIZE_ANGLE_POS( m_Orient ); diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index ec06a9ffcd..f709bdd7fd 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -647,7 +647,9 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, BRDITEMS_PLOTTER itemplotter( aPlotter, aBoard, aPlotOpt ); itemplotter.SetLayerSet( aLayerMask ); - // Plot edge layer and graphic items + // Plot edge layer and graphic items + // They do not have a solder Mask margin, because they are only graphic items + // on this layer (like logos), not actually areas around pads. itemplotter.PlotBoardGraphicItems(); for( MODULE* module = aBoard->m_Modules; module; module = module->Next() ) @@ -677,8 +679,8 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, // This extra margin is used to merge too close shapes // (distance < aMinThickness), and will be removed when creating // the actual shapes - SHAPE_POLY_SET areas; // Contains shapes to plot - SHAPE_POLY_SET initialPolys; // Contains exact shapes to plot + SHAPE_POLY_SET areas; // Contains shapes to plot + SHAPE_POLY_SET initialPolys; // Contains exact shapes to plot /* calculates the coeff to compensate radius reduction of holes clearance * due to the segment approx ( 1 /cos( PI/circleToSegmentsCount ) @@ -736,7 +738,13 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, } } - // Add filled zone areas + // Add filled zone areas. +#if 0 // Set to 1 if a solder mask margin must be applied to zones on solder mask + int zone_margin = aBoard->GetDesignSettings().m_SolderMaskMargin; +#else + int zone_margin = 0; +#endif + for( int ii = 0; ii < aBoard->GetAreaCount(); ii++ ) { ZONE_CONTAINER* zone = aBoard->GetArea( ii ); @@ -745,9 +753,9 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, continue; zone->TransformOutlinesShapeWithClearanceToPolygon( areas, - inflate, true ); + inflate+zone_margin, false ); zone->TransformOutlinesShapeWithClearanceToPolygon( initialPolys, - 0, true ); + zone_margin, false ); } // To avoid a lot of code, use a ZONE_CONTAINER diff --git a/pcbnew/xchgmod.cpp b/pcbnew/xchgmod.cpp index 87963e789b..96c510ee29 100644 --- a/pcbnew/xchgmod.cpp +++ b/pcbnew/xchgmod.cpp @@ -95,7 +95,8 @@ void PCB_EDIT_FRAME::InstallExchangeModuleFrame( MODULE* Module ) { DIALOG_EXCHANGE_MODULE dialog( this, Module ); - dialog.ShowQuasiModal(); + int ret = dialog.ShowQuasiModal(); + (void) ret; // make coverity quiet. } diff --git a/pcbnew/zones_convert_to_polygons_aux_functions.cpp b/pcbnew/zones_convert_to_polygons_aux_functions.cpp index a2fb83260a..47e5cb5cde 100644 --- a/pcbnew/zones_convert_to_polygons_aux_functions.cpp +++ b/pcbnew/zones_convert_to_polygons_aux_functions.cpp @@ -56,7 +56,7 @@ void ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon( // add clearance to outline int clearance = aMinClearanceValue; - if( aUseNetClearance ) + if( aUseNetClearance && IsOnCopperLayer() ) { clearance = GetClearance(); if( aMinClearanceValue > clearance ) diff --git a/potrace/greymap.cpp b/potrace/greymap.cpp index acfe7e970d..203fa1a218 100644 --- a/potrace/greymap.cpp +++ b/potrace/greymap.cpp @@ -1097,7 +1097,8 @@ int gm_print( FILE* f, greymap_t* gm ) } } - fputc( "*#=- "[5 * d / t], f ); /* what a cute trick :) */ + if( t ) + fputc( "*#=- "[5 * d / t], f ); /* what a cute trick :) */ } fputc( '\n', f );