7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-07 18:25:31 +00:00

Define MAX_LAYERS_FOR_VIEW to init GAL::Mxx_DEPTH and VIEW_MAX_LAYERS

These values MIN_DEPTH, MAX_DEPTH and VIEW_MAX_LAYERS are coupled, so to
avoid mismatch, it is better to derive these values from an unique value
This commit is contained in:
jean-pierre charras 2024-12-30 16:41:44 +01:00
parent b2acddc483
commit 2cd28009ef
3 changed files with 15 additions and 8 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
* Copyright (C) 2012-2017 Kicad Developers, see change_log.txt for contributors.
* Copyright (C) 2012-2024 Kicad Developers, see AUTHORS.txt for contributors.
*
* Graphics Abstraction Layer (GAL) - base class
*
@ -236,8 +236,13 @@ VECTOR2D GAL::GetGridPoint( const VECTOR2D& aPoint ) const
#endif
}
const int GAL::MIN_DEPTH = -2048;
const int GAL::MAX_DEPTH = 2047;
// MIN_DEPTH must be set to be - (VIEW::VIEW_MAX_LAYERS + abs(VIEW::TOP_LAYER_MODIFIER))
// MAX_DEPTH must be set to be VIEW::VIEW_MAX_LAYERS + abs(VIEW::TOP_LAYER_MODIFIER) -1
// VIEW_MAX_LAYERS and TOP_LAYER_MODIFIER are defined in view.h.
// TOP_LAYER_MODIFIER is set as -VIEW_MAX_LAYERS
// Currently KIGFX::VIEW::VIEW_MAX_LAYERS = MAX_LAYERS_FOR_VIEW
const int GAL::MIN_DEPTH = -2*MAX_LAYERS_FOR_VIEW;
const int GAL::MAX_DEPTH = 2*MAX_LAYERS_FOR_VIEW - 1;
const int GAL::GRID_DEPTH = MAX_DEPTH - 1;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
* Copyright (C) 2012 Kicad Developers, see change_log.txt for contributors.
* Copyright (C) 2024 Kicad Developers, see AUTHORS.txt for contributors.
*
* Macro definitions
*
@ -40,6 +40,9 @@ enum RENDER_TARGET
TARGET_TEMP, ///< Temporary target for drawing in separate layer
TARGETS_NUMBER ///< Number of available rendering targets
};
// Used in view.h to initialize VIEW_MAX_LAYERS and graphic_abstraction_layer.cpp
#define MAX_LAYERS_FOR_VIEW 1024
} // namespace KIGFX
#endif /* DEFINITIONS_H_ */

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013-2016 CERN
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
@ -37,7 +37,6 @@
#include <gal/definitions.h>
#include <view/view_overlay.h>
#include <view/view.h>
namespace KIGFX
{
@ -739,10 +738,10 @@ public:
std::unique_ptr<VIEW> DataReference() const;
///< Maximum number of layers that may be shown
static constexpr int VIEW_MAX_LAYERS = 1024;//512;
static constexpr int VIEW_MAX_LAYERS = MAX_LAYERS_FOR_VIEW;
///< Rendering order modifier for layers that are marked as top layers.
static constexpr int TOP_LAYER_MODIFIER = -VIEW_MAX_LAYERS;
static constexpr int TOP_LAYER_MODIFIER = -MAX_LAYERS_FOR_VIEW;
protected:
struct VIEW_LAYER