diff --git a/common/draw_panel_gal.cpp b/common/draw_panel_gal.cpp index 4e6ea02fdd..0b0413595d 100644 --- a/common/draw_panel_gal.cpp +++ b/common/draw_panel_gal.cpp @@ -181,9 +181,17 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) ) m_gal->SetClearColor( settings->GetBackgroundColor() ); m_gal->SetCursorColor( settings->GetLayerColor( LAYER_CURSOR ) ); + // TODO: find why ClearScreen() must be called here in opengl mode + // and only if m_view->IsDirty() in Cairo mode to avoid distaly artifacts + // when moving the mouse cursor + if( m_backend == GAL_TYPE_OPENGL ) + m_gal->ClearScreen(); + if( m_view->IsDirty() ) { - m_gal->ClearScreen(); + if( m_backend != GAL_TYPE_OPENGL ) // already called in opengl + m_gal->ClearScreen(); + m_view->ClearTargets(); // Grid has to be redrawn only when the NONCACHED target is redrawn diff --git a/common/gal/cairo/cairo_gal.cpp b/common/gal/cairo/cairo_gal.cpp index d9834b469c..06b0acbd71 100644 --- a/common/gal/cairo/cairo_gal.cpp +++ b/common/gal/cairo/cairo_gal.cpp @@ -241,11 +241,15 @@ void CAIRO_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double aS { SWAP( aStartAngle, >, aEndAngle ); - cairo_new_sub_path( currentContext ); - cairo_arc( currentContext, aCenterPoint.x, aCenterPoint.y, aRadius, aStartAngle, aEndAngle ); - - if( isFillEnabled ) + if( isFillEnabled ) // Draw the filled area of the shape, before drawing the outline itself { + double pen_size = GetLineWidth(); + auto fgcolor = GetStrokeColor(); + SetStrokeColor( GetFillColor() ); + + SetLineWidth( 0 ); + cairo_new_sub_path( currentContext ); + cairo_arc( currentContext, aCenterPoint.x, aCenterPoint.y, aRadius, aStartAngle, aEndAngle ); VECTOR2D startPoint( cos( aStartAngle ) * aRadius + aCenterPoint.x, sin( aStartAngle ) * aRadius + aCenterPoint.y ); VECTOR2D endPoint( cos( aEndAngle ) * aRadius + aCenterPoint.x, @@ -255,8 +259,13 @@ void CAIRO_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double aS cairo_line_to( currentContext, startPoint.x, startPoint.y ); cairo_line_to( currentContext, endPoint.x, endPoint.y ); cairo_close_path( currentContext ); + flushPath(); + SetLineWidth( pen_size ); + SetStrokeColor( fgcolor ); } + cairo_new_sub_path( currentContext ); + cairo_arc( currentContext, aCenterPoint.x, aCenterPoint.y, aRadius, aStartAngle, aEndAngle ); flushPath(); isElementAdded = true; diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index 875f8d00a6..fe579b8f4d 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -358,9 +358,6 @@ void SCH_PAINTER::draw( LIB_ARC *aArc, int aLayer ) VECTOR2D pos = mapCoords( aArc->GetPosition() ); m_gal->DrawArc( pos, aArc->GetRadius(), sa, ea); - /*m_gal->SetStrokeColor(COLOR4D(1.0,0,0,1.0)); - m_gal->DrawLine ( pos - VECTOR2D(20, 20), pos + VECTOR2D(20, 20)); - m_gal->DrawLine ( pos - VECTOR2D(-20, 20), pos + VECTOR2D(-20, 20));*/ } @@ -1215,9 +1212,20 @@ void SCH_PAINTER::draw( SCH_SHEET *aSheet, int aLayer ) VECTOR2D size = aSheet->GetSize(); m_gal->SetStrokeColor( m_schSettings.GetLayerColor( LAYER_SHEET ) ); - m_gal->SetFillColor ( COLOR4D(1.0, 1.0, 1.0, 0.5) ); + + if( aSheet->IsMoving() ) // Gives a filled background when moving for a better look + { + // Select a fill color working well with black and white background color, + // both in Opengl and Cairo + m_gal->SetFillColor ( COLOR4D(0.1, 0.5, 0.5, 0.3) ); + m_gal->SetIsFill ( true ); + } + else + { + // Could be modified later, when sheets can have their own fill color + m_gal->SetIsFill ( false ); + } m_gal->SetIsStroke ( true ); - m_gal->SetIsFill ( true ); m_gal->DrawRectangle( pos, pos + size ); auto nameAngle = 0.0; diff --git a/eeschema/widgets/symbol_preview_widget.cpp b/eeschema/widgets/symbol_preview_widget.cpp index 43741ef885..cd9a0d8b83 100644 --- a/eeschema/widgets/symbol_preview_widget.cpp +++ b/eeschema/widgets/symbol_preview_widget.cpp @@ -122,6 +122,9 @@ void SYMBOL_PREVIEW_WIDGET::DisplaySymbol( const LIB_ID& aSymbolID, int aUnit ) settings->m_ShowUnit = aUnit; + // For symbols having a De Morgan body style, use the first style + settings->m_ShowConvert = part->HasConversion() ? 1 : 0; + view->Add( alias ); m_previewItem = alias; @@ -167,6 +170,10 @@ void SYMBOL_PREVIEW_WIDGET::DisplayPart( LIB_PART* aPart, int aUnit ) if( aPart->IsMulti() && aUnit == 0 ) aUnit = 1; + // For symbols having a De Morgan body style, use the first style + auto settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() ); + settings->m_ShowConvert = aPart->HasConversion() ? 1 : 0; + view->Add( aPart ); m_previewItem = aPart; diff --git a/include/gal/graphics_abstraction_layer.h b/include/gal/graphics_abstraction_layer.h index b68c49a5a8..bdffc3d2e6 100644 --- a/include/gal/graphics_abstraction_layer.h +++ b/include/gal/graphics_abstraction_layer.h @@ -254,6 +254,16 @@ public: fillColor = aColor; } + /** + * @brief Get the fill color. + * + * @return the color for filling a outline. + */ + inline const COLOR4D& GetFillColor() const + { + return fillColor; + } + /** * @brief Set the stroke color. *