speedup enhancement and little cleanup
This commit is contained in:
parent
6dfcf0b6d4
commit
27e9eedd9d
|
@ -69,10 +69,13 @@ static int xcliplo = 0,
|
||||||
ycliplo = 0,
|
ycliplo = 0,
|
||||||
xcliphi = 2000,
|
xcliphi = 2000,
|
||||||
ycliphi = 2000;
|
ycliphi = 2000;
|
||||||
static int lastcolor = -1;
|
|
||||||
static int lastwidth = -1;
|
static int s_DC_lastcolor = -1;
|
||||||
static int s_Last_Pen_Style = -1;
|
static int s_DC_lastwidth = -1;
|
||||||
static wxDC* lastDC = NULL;
|
static int s_DC_lastpenstyle = -1;
|
||||||
|
static int s_DC_lastbrushcolor = -1;
|
||||||
|
static int s_DC_lastbrushfill = -1;
|
||||||
|
static wxDC* s_DC_lastDC = NULL;
|
||||||
|
|
||||||
|
|
||||||
/* Local functions: */
|
/* Local functions: */
|
||||||
|
@ -520,9 +523,10 @@ static void WinClipAndDrawLine( EDA_Rect* ClipBox, wxDC* DC,
|
||||||
*/
|
*/
|
||||||
void GRResetPenAndBrush( wxDC* DC )
|
void GRResetPenAndBrush( wxDC* DC )
|
||||||
{
|
{
|
||||||
lastcolor = -1;
|
|
||||||
GRSetBrush( DC, BLACK ); // Force no fill
|
GRSetBrush( DC, BLACK ); // Force no fill
|
||||||
lastDC = NULL;
|
s_DC_lastbrushcolor = -1;
|
||||||
|
s_DC_lastcolor = -1;
|
||||||
|
s_DC_lastDC = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -540,10 +544,10 @@ void GRSetColorPen( wxDC* DC, int Color, int width, int style )
|
||||||
Color = BLACK;
|
Color = BLACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( lastcolor != Color
|
if( s_DC_lastcolor != Color ||
|
||||||
|| lastwidth != width
|
s_DC_lastwidth != width ||
|
||||||
|| s_Last_Pen_Style != style
|
s_DC_lastpenstyle != style ||
|
||||||
|| lastDC != DC )
|
s_DC_lastDC != DC )
|
||||||
{
|
{
|
||||||
wxPen pen;
|
wxPen pen;
|
||||||
|
|
||||||
|
@ -555,11 +559,11 @@ void GRSetColorPen( wxDC* DC, int Color, int width, int style )
|
||||||
|
|
||||||
DC->SetPen( pen );
|
DC->SetPen( pen );
|
||||||
|
|
||||||
lastcolor = Color;
|
s_DC_lastcolor = Color;
|
||||||
lastwidth = width;
|
s_DC_lastwidth = width;
|
||||||
lastDC = DC;
|
s_DC_lastpenstyle = style;
|
||||||
|
s_DC_lastDC = DC;
|
||||||
|
|
||||||
s_Last_Pen_Style = style;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -568,6 +572,11 @@ void GRSetBrush( wxDC* DC, int Color, int fill )
|
||||||
{
|
{
|
||||||
if( ForceBlackPen )
|
if( ForceBlackPen )
|
||||||
Color = BLACK;
|
Color = BLACK;
|
||||||
|
|
||||||
|
if( s_DC_lastbrushcolor != Color ||
|
||||||
|
s_DC_lastbrushfill != fill ||
|
||||||
|
s_DC_lastDC != DC )
|
||||||
|
{
|
||||||
wxBrush DrawBrush;
|
wxBrush DrawBrush;
|
||||||
DrawBrush.SetColour( MakeColour( Color ) );
|
DrawBrush.SetColour( MakeColour( Color ) );
|
||||||
|
|
||||||
|
@ -575,10 +584,17 @@ void GRSetBrush( wxDC* DC, int Color, int fill )
|
||||||
DrawBrush.SetStyle( wxSOLID );
|
DrawBrush.SetStyle( wxSOLID );
|
||||||
else
|
else
|
||||||
DrawBrush.SetStyle( wxTRANSPARENT );
|
DrawBrush.SetStyle( wxTRANSPARENT );
|
||||||
|
|
||||||
DC->SetBrush( DrawBrush );
|
DC->SetBrush( DrawBrush );
|
||||||
|
|
||||||
|
s_DC_lastbrushcolor = Color;
|
||||||
|
s_DC_lastbrushfill = fill;
|
||||||
|
s_DC_lastDC = DC;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** function GRForceBlackPen
|
/** function GRForceBlackPen
|
||||||
* @param flagforce True to force a black pen whenever the asked color
|
* @param flagforce True to force a black pen whenever the asked color
|
||||||
*/
|
*/
|
||||||
|
@ -689,10 +705,10 @@ void GRSDashedLine( EDA_Rect* ClipBox,
|
||||||
{
|
{
|
||||||
GRLastMoveToX = x2;
|
GRLastMoveToX = x2;
|
||||||
GRLastMoveToY = y2;
|
GRLastMoveToY = y2;
|
||||||
lastcolor = -1;
|
s_DC_lastcolor = -1;
|
||||||
GRSetColorPen( DC, Color, width, wxSHORT_DASH );
|
GRSetColorPen( DC, Color, width, wxSHORT_DASH );
|
||||||
GRSLine( ClipBox, DC, x1, y1, x2, y2, width, Color );
|
GRSLine( ClipBox, DC, x1, y1, x2, y2, width, Color );
|
||||||
lastcolor = -1;
|
s_DC_lastcolor = -1;
|
||||||
GRSetColorPen( DC, Color, width );
|
GRSetColorPen( DC, Color, width );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -704,10 +720,10 @@ void GRSDashedLineTo( EDA_Rect* ClipBox,
|
||||||
int width,
|
int width,
|
||||||
int Color )
|
int Color )
|
||||||
{
|
{
|
||||||
lastcolor = -1;
|
s_DC_lastcolor = -1;
|
||||||
GRSetColorPen( DC, Color, width, wxSHORT_DASH );
|
GRSetColorPen( DC, Color, width, wxSHORT_DASH );
|
||||||
GRSLine( ClipBox, DC, GRLastMoveToX, GRLastMoveToY, x2, y2, width, Color );
|
GRSLine( ClipBox, DC, GRLastMoveToX, GRLastMoveToY, x2, y2, width, Color );
|
||||||
lastcolor = -1;
|
s_DC_lastcolor = -1;
|
||||||
GRSetColorPen( DC, Color, width );
|
GRSetColorPen( DC, Color, width );
|
||||||
GRLastMoveToX = x2;
|
GRLastMoveToX = x2;
|
||||||
GRLastMoveToY = y2;
|
GRLastMoveToY = y2;
|
||||||
|
|
Loading…
Reference in New Issue