diff --git a/common/bitmap_base.cpp b/common/bitmap_base.cpp index 77f2b0d313..c837cfac4a 100644 --- a/common/bitmap_base.cpp +++ b/common/bitmap_base.cpp @@ -36,6 +36,7 @@ #include "bitmap_base.h" +#include #include diff --git a/common/page_layout/page_layout_graphic_items.cpp b/common/page_layout/page_layout_graphic_items.cpp index 4adf03b5d1..e14819c76d 100644 --- a/common/page_layout/page_layout_graphic_items.cpp +++ b/common/page_layout/page_layout_graphic_items.cpp @@ -118,13 +118,25 @@ inline void drawMarker( EDA_RECT* aClipBox, wxDC* aDC, */ void WS_DRAW_ITEM_LIST::Draw( EDA_RECT* aClipBox, wxDC* aDC ) { + + // Draw the bitmaps in the background + for( WS_DRAW_ITEM_BASE* item = GetFirst(); item; item = GetNext() ) + { + if( item->GetParent() && item->GetParent()->IsSelected() ) + continue; + + if( item->GetType() == WS_DRAW_ITEM_BASE::wsg_bitmap ) + item->DrawWsItem( aClipBox, aDC ); + + } // The not selected items are drawn first (most of items) for( WS_DRAW_ITEM_BASE* item = GetFirst(); item; item = GetNext() ) { if( item->GetParent() && item->GetParent()->IsSelected() ) continue; - item->DrawWsItem( aClipBox, aDC ); + if( item->GetType() != WS_DRAW_ITEM_BASE::wsg_bitmap ) + item->DrawWsItem( aClipBox, aDC ); } // The selected items are drawn after (usually 0 or 1) @@ -492,7 +504,6 @@ void WS_DRAW_ITEM_BITMAP::DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoi { GRSetDrawMode( aDC, ( aDrawMode == UNSPECIFIED_DRAWMODE ) ? GR_COPY : aDrawMode ); parent->m_ImageBitmap->DrawBitmap( aDC, m_pos + aOffset ); - GRSetDrawMode( aDC, GR_COPY ); } } diff --git a/eeschema/dialogs/dialog_print_using_printer.cpp b/eeschema/dialogs/dialog_print_using_printer.cpp index ed7028f809..792e17694a 100644 --- a/eeschema/dialogs/dialog_print_using_printer.cpp +++ b/eeschema/dialogs/dialog_print_using_printer.cpp @@ -443,13 +443,13 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen ) if( m_parent->GetPrintMonochrome() ) GRForceBlackPen( true ); - aScreen->Draw( panel, dc, (GR_DRAWMODE) 0 ); - if( printReference ) m_parent->DrawWorkSheet( dc, aScreen, GetDefaultLineThickness(), IU_PER_MILS, aScreen->GetFileName(), wxEmptyString, GetLayerColor( ( SCH_LAYER_ID )LAYER_WORKSHEET ) ); + + aScreen->Draw( panel, dc, (GR_DRAWMODE) 0 ); m_parent->SetDrawBgColor( bgColor ); aScreen->m_IsPrinting = false; panel->SetClipBox( oldClipBox ); diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index a79d398fad..53871fc37c 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -510,6 +510,8 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode * their SCH_SCREEN::Draw() draws nothing */ std::vector< SCH_ITEM* > junctions; + std::vector< SCH_ITEM* > bitmaps; + std::vector< SCH_ITEM* > other; // Ensure links are up to date, even if a library was reloaded for some reason: UpdateSymbolLinks(); @@ -521,12 +523,23 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode if( item->Type() == SCH_JUNCTION_T ) junctions.push_back( item ); + else if( item->Type() == SCH_BITMAP_T ) + bitmaps.push_back( item ); else // uncomment line below when there is a virtual EDA_ITEM::GetBoundingBox() // if( panel->GetClipBox().Intersects( item->GetBoundingBox() ) ) - item->Draw( aCanvas, aDC, wxPoint( 0, 0 ), aDrawMode, aColor ); + other.push_back( item ); } + // Bitmaps are drawn first to ensure they are in the background + // This is particularly important for the wxPostscriptDC (used in *nix printers) as + // the bitmap PS command clears the screen + for( auto item : bitmaps ) + item->Draw( aCanvas, aDC, wxPoint( 0, 0 ), aDrawMode, aColor ); + + for( auto item : other ) + item->Draw( aCanvas, aDC, wxPoint( 0, 0 ), aDrawMode, aColor ); + for( auto item : junctions ) item->Draw( aCanvas, aDC, wxPoint( 0, 0 ), aDrawMode, aColor ); }