Don't draw PCB bitmaps on layers not visible in high-contrast mode.

This commit is contained in:
Alex Shvartzkop 2023-10-24 03:39:48 +03:00
parent 71d0c7f6af
commit e6cf5e5e01
1 changed files with 14 additions and 0 deletions

View File

@ -30,6 +30,7 @@
#include <pcb_draw_panel_gal.h>
#include <plotters/plotter.h>
#include <settings/color_settings.h>
#include <pcb_painter.h>
#include <bitmaps.h>
#include <base_units.h>
#include <common.h>
@ -42,6 +43,9 @@
#include <wx/mstream.h>
using KIGFX::PCB_PAINTER;
using KIGFX::PCB_RENDER_SETTINGS;
PCB_BITMAP::PCB_BITMAP( BOARD_ITEM* aParent, const VECTOR2I& pos, PCB_LAYER_ID aLayer ) :
BOARD_ITEM( aParent, PCB_BITMAP_T, aLayer )
@ -134,11 +138,21 @@ double PCB_BITMAP::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
{
constexpr double HIDE = std::numeric_limits<double>::max();
PCB_PAINTER* painter = static_cast<PCB_PAINTER*>( aView->GetPainter() );
PCB_RENDER_SETTINGS* renderSettings = painter->GetSettings();
// All bitmaps are drawn on LAYER_DRAW_BITMAPS, but their
// associated board layer controls their visibility.
if( !GetBoard()->IsLayerVisible( m_layer ) )
return HIDE;
if( renderSettings->GetHighContrast()
&& renderSettings->m_ContrastModeDisplay == HIGH_CONTRAST_MODE::HIDDEN
&& !renderSettings->GetLayerIsHighContrast( m_layer ) )
{
return HIDE;
}
return aView->IsLayerVisible( LAYER_DRAW_BITMAPS ) ? 0.0 : HIDE;
}