From de92aaab9a63f527f479132dafe0f45666ec9688 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Wed, 28 Jul 2021 13:52:07 -0400 Subject: [PATCH] GerbView code cleaning. --- gerbview/dcode.cpp | 12 +++++------ gerbview/dcode.h | 4 ++-- gerbview/gerbview_painter.h | 43 +++++++++++++++++++------------------ 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/gerbview/dcode.cpp b/gerbview/dcode.cpp index 17d39dfe66..90900fd4a5 100644 --- a/gerbview/dcode.cpp +++ b/gerbview/dcode.cpp @@ -146,15 +146,15 @@ int D_CODE::GetShapeDim( GERBER_DRAW_ITEM* aParent ) void D_CODE::DrawFlashedShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC, - COLOR4D aColor, const wxPoint& aShapePos, bool aFilledShape ) + const COLOR4D& aColor, const wxPoint& aShapePos, bool aFilledShape ) { int radius; switch( m_Shape ) { case APT_MACRO: - GetMacro()->DrawApertureMacroShape( aParent, aClipBox, aDC, aColor, - aShapePos, aFilledShape); + GetMacro()->DrawApertureMacroShape( aParent, aClipBox, aDC, aColor, aShapePos, + aFilledShape ); break; case APT_CIRCLE: @@ -218,14 +218,14 @@ void D_CODE::DrawFlashedShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wx if( m_Size.x > m_Size.y ) // horizontal oval { - int delta = (m_Size.x - m_Size.y) / 2; + int delta = ( m_Size.x - m_Size.y ) / 2; start.x -= delta; end.x += delta; radius = m_Size.y; // Width in fact } else // vertical oval { - int delta = (m_Size.y - m_Size.x) / 2; + int delta = ( m_Size.y - m_Size.x ) / 2; start.y -= delta; end.y += delta; radius = m_Size.x; // Width in fact @@ -264,7 +264,7 @@ void D_CODE::DrawFlashedShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wx void D_CODE::DrawFlashedPolygon( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC, - COLOR4D aColor, bool aFilled, const wxPoint& aPosition ) + const COLOR4D& aColor, bool aFilled, const wxPoint& aPosition ) { if( m_Polygon.OutlineCount() == 0 ) return; diff --git a/gerbview/dcode.h b/gerbview/dcode.h index e0ee74b221..836ab8f96f 100644 --- a/gerbview/dcode.h +++ b/gerbview/dcode.h @@ -144,7 +144,7 @@ public: * @param aFilledShape set to true to draw in filled mode, false to draw in sketch mode */ void DrawFlashedShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC, - COLOR4D aColor, const wxPoint& aShapePos, bool aFilledShape ); + const COLOR4D& aColor, const wxPoint& aShapePos, bool aFilledShape ); /** * A helper function used to draw the polygon stored in m_PolyCorners. @@ -161,7 +161,7 @@ public: * @param aPosition is the actual shape position. */ void DrawFlashedPolygon( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC, - COLOR4D aColor, bool aFilled, const wxPoint& aPosition ); + const COLOR4D& aColor, bool aFilled, const wxPoint& aPosition ); /** * Convert a shape to an equivalent polygon. diff --git a/gerbview/gerbview_painter.h b/gerbview/gerbview_painter.h index 755e534aef..293c922348 100644 --- a/gerbview/gerbview_painter.h +++ b/gerbview/gerbview_painter.h @@ -41,8 +41,7 @@ namespace KIGFX class GAL; /** - * GERBVIEW_RENDER_SETTINGS - * Stores GerbView specific render settings. + * Store GerbView specific render settings. */ class GERBVIEW_RENDER_SETTINGS : public RENDER_SETTINGS { @@ -54,8 +53,8 @@ public: void LoadColors( const COLOR_SETTINGS* aSettings ) override; /** - * Function LoadDisplayOptions - * Loads settings related to display options + * Load settings related to display options. + * * @param aOptions are settings that you want to use for displaying items. */ void LoadDisplayOptions( const GBR_DISPLAY_OPTIONS& aOptions ); @@ -64,8 +63,8 @@ public: virtual COLOR4D GetColor( const VIEW_ITEM* aItem, int aLayer ) const override; /** - * Function GetLayerColor - * Returns the color used to draw a layer. + * Return the color used to draw a layer. + * * @param aLayer is the layer number. */ inline const COLOR4D& GetLayerColor( int aLayer ) const @@ -74,8 +73,8 @@ public: } /** - * Function SetLayerColor - * Changes the color used to draw a layer. + * Change the color used to draw a layer. + * * @param aLayer is the layer number. * @param aColor is the new color. */ @@ -86,7 +85,10 @@ public: update(); // recompute other shades of the color } - const COLOR4D& GetBackgroundColor() override { return m_layerColors[ LAYER_GERBVIEW_BACKGROUND ]; } + const COLOR4D& GetBackgroundColor() override + { + return m_layerColors[ LAYER_GERBVIEW_BACKGROUND ]; + } void SetBackgroundColor( const COLOR4D& aColor ) override { @@ -165,8 +167,7 @@ protected: /** - * GERBVIEW_PAINTER - * Contains methods for drawing GerbView-specific items. + * Methods for drawing GerbView specific items. */ class GERBVIEW_PAINTER : public PAINTER { @@ -189,11 +190,12 @@ protected: void draw( /*const*/ GERBER_DRAW_ITEM* aVia, int aLayer ); /** - * Helper routine to draw a polygon - * @param aParent Pointer to the draw item for AB Position calculation - * @param aPolygon the polygon to draw - * @param aFilled If true, draw the polygon as filled, otherwise only outline - * @param aShift If true, draw the polygon relative to the parent item position + * Helper routine to draw a polygon. + * + * @param aParent Pointer to the draw item for AB Position calculation. + * @param aPolygon the polygon to draw. + * @param aFilled If true, draw the polygon as filled, otherwise only outline. + * @param aShift If true, draw the polygon relative to the parent item position. */ void drawPolygon( GERBER_DRAW_ITEM* aParent, const SHAPE_POLY_SET& aPolygon, bool aFilled, bool aShift = false ); @@ -205,11 +207,10 @@ protected: void drawApertureMacro( GERBER_DRAW_ITEM* aParent, bool aFilled ); /** - * Function getLineThickness() - * Get the thickness to draw for a line (e.g. 0 thickness lines - * get a minimum value). - * @param aActualThickness line own thickness - * @return the thickness to draw + * Get the thickness to draw for a line (e.g. 0 thickness lines get a minimum value). + * + * @param aActualThickness line own thickness. + * @return the thickness to draw. */ int getLineThickness( int aActualThickness ) const; };