← Back to team overview

kicad-developers team mailing list archive

Re: EESchema XOR-Artefacts

 

Hi,

I just found out that I was missing something: When zoomed out far enough, 
there were still artifacts while moving. I tracked it down to the 
ShowWhileMoving() function and added a call to refresh there also, see the 
attached patch.

As far as performance, I tested the patch on a schematic sheet with about 500 
components (74xx04) + wires, it worked reasonably fast (on my Core2 E6600). 
With more than 6000 components (which is very unreasonable, because you'd 
have to "stack" components on the schematic to fit them all), when redrawing 
takes more than a second, speed drops, but eeschema is still usable.

So, again, this is definitely not the most efficient approach, but it 
completely removed artifacts in my tests. I think this is a good thing which 
is worth paying the extra overhead of redrawing - even if we can not or don't 
want to add code to find dirty rects in eeschema.

What do you think?

Best regards,
Jonas

--Boundary-00=_NXC1HZSM/bVzUKh Content-Type: text/x-diff;
charset="utf-8";
name="refresh_eeschema2.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="refresh_eeschema2.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);
}


Index: eeschema/getpart.cpp
===================================================================
--- eeschema/getpart.cpp	(Revision 865)
+++ eeschema/getpart.cpp	(Arbeitskopie)
@@ -260,11 +260,14 @@
panel->m_Parent->GetScreen()->GetCurItem();

/* Effacement du composant */
- if( erase )
+ if( erase ){
DrawStructsInGhost( panel, DC, DrawLibItem, 0, 0 );
+ //TODO: Improve this (only refresh dirty rect)
+ panel->Refresh(TRUE);
+ }

-	move_vector.x = panel->m_Parent->GetScreen()->m_Curseur.x - DrawLibItem->m_Pos.x;
-	move_vector.y = panel->m_Parent->GetScreen()->m_Curseur.y - DrawLibItem->m_Pos.y;
+ move_vector.x = panel->m_Parent->GetScreen()->m_Curseur.x - DrawLibItem->m_Pos.x;
+ move_vector.y = panel->m_Parent->GetScreen()->m_Curseur.y - DrawLibItem->m_Pos.y;
MoveOneStruct( DrawLibItem, move_vector );

DrawStructsInGhost( panel, DC, DrawLibItem, 0, 0 );
 --Boundary-00=_NXC1HZSM/bVzUKh-- 




Follow ups

References