← Back to team overview

kicad-developers team mailing list archive

EESchema XOR-Artefacts

 

Hi all,

I have taken an approach at the nasty artefacts in eeschema that occur when 
moving / deleting components or wires.

The reason for these artefacts is the same as in PCBnew: when stuff should 
disappear from one place (due to a move/delete), the screen is not redrawn, 
but the item is drawn using an XOR operator.

I have found a place where this can be fixed with very little extra code:

There is a function RedrawOneStruct() in eeschema/eeredraw.cpp, which gets 
called whenever a single item needs redrawing. Here, I simply issue a 
panel->Refresh(TRUE) whenever the DrawMode is g_XorMode. 

This causes a redraw of the complete screen on every move/delete etc, which 
may be optimized by calculating a bounding box of the area that needs 
redrawing. I haven't found a trivial way to do that currently, so I skipped 
it for now.

I have attached a patch with the change. It is only tested very superficially 
(it is a minor change anyways), the only problem that could occur is a 
performance problem.

So, can anyone with a slow computer and a large Schematic please test if the 
patch has acceptable performance? If there are no objections to the patch, 
can someone please commit it to the repository?

Best regards,
Jonas.
 --Boundary-00=_VGA1Hk1X1KijkMo Content-Type: text/x-diff;
charset="utf-8";
name="refresh_eeschema.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="refresh_eeschema.patch"

Index: eeschema/eeredraw.cpp
===================================================================
--- eeschema/eeredraw.cpp	(Revision 865)
+++ eeschema/eeredraw.cpp	(Arbeitskopie)
@@ -178,10 +178,13 @@
EDA_BaseStruct *Struct, int DrawMode, int Color)
{

-	if ( Struct == NULL ) return;
-	if (HighLightStruct == Struct) Color = HIGHLIGHT_COLOR;
-
-	Struct->Draw(panel, DC, wxPoint(0,0), DrawMode, Color);
+ if ( Struct == NULL ) return;
+ if (HighLightStruct == Struct) Color = HIGHLIGHT_COLOR;
+ // TODO: This should be made more efficient by calculating a dirty rectangle (bounding box)
+ if( DrawMode == g_XorMode){
+ panel->Refresh(TRUE);
+ }
+ Struct->Draw(panel, DC, wxPoint(0,0), DrawMode, Color);
}


 --Boundary-00=_VGA1Hk1X1KijkMo-- 




Follow ups