All: use solid lines instead of dashed lines to draw X and Y axis in legacy canvas (like in Gal canvas). The main reason: on OSX axis using dashed lines are very very slow to draw (looks like a wxWidget issue when the wxDC scale factor is very small)

This commit is contained in:
jean-pierre charras 2015-10-25 17:58:04 +01:00
parent bafb06c8c0
commit ade51289a7
5 changed files with 23 additions and 66 deletions

View File

@ -667,12 +667,10 @@ void EDA_DRAW_PANEL::DrawBackGround( wxDC* DC )
wxSize pageSize = GetParent()->GetPageSizeIU();
// Draw the Y axis
GRDashedLine( &m_ClipBox, DC, 0, -pageSize.y,
0, pageSize.y, 0, axis_color );
GRLine( &m_ClipBox, DC, 0, -pageSize.y, 0, pageSize.y, 0, axis_color );
// Draw the X axis
GRDashedLine( &m_ClipBox, DC, -pageSize.x, 0,
pageSize.x, 0, 0, axis_color );
GRLine( &m_ClipBox, DC, -pageSize.x, 0, pageSize.x, 0, 0, axis_color );
}
if( GetParent()->m_showOriginAxis )
@ -821,20 +819,12 @@ void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, GR_DRAWMODE aDrawMode )
GRSetDrawMode( aDC, aDrawMode );
// Draw the Y axis
GRDashedLine( &m_ClipBox, aDC,
origin.x,
-pageSize.y,
origin.x,
pageSize.y,
0, color );
GRLine( &m_ClipBox, aDC, origin.x, -pageSize.y,
origin.x, pageSize.y, 0, color );
// Draw the X axis
GRDashedLine( &m_ClipBox, aDC,
-pageSize.x,
origin.y,
pageSize.x,
origin.y,
0, color );
GRLine( &m_ClipBox, aDC, -pageSize.x, origin.y,
pageSize.x, origin.y, 0, color );
}
@ -849,20 +839,12 @@ void EDA_DRAW_PANEL::DrawGridAxis( wxDC* aDC, GR_DRAWMODE aDrawMode, const wxPoi
GRSetDrawMode( aDC, aDrawMode );
// Draw the Y axis
GRDashedLine( &m_ClipBox, aDC,
aGridOrigin.x,
-pageSize.y,
aGridOrigin.x,
pageSize.y,
0, color );
GRLine( &m_ClipBox, aDC, aGridOrigin.x, -pageSize.y,
aGridOrigin.x, pageSize.y, 0, color );
// Draw the X axis
GRDashedLine( &m_ClipBox, aDC,
-pageSize.x,
aGridOrigin.y,
pageSize.x,
aGridOrigin.y,
0, color );
GRLine( &m_ClipBox, aDC, -pageSize.x, aGridOrigin.y,
pageSize.x, aGridOrigin.y, 0, color );
}

View File

@ -206,12 +206,7 @@ void EDA_DRAW_PANEL_GAL::ForceRefresh()
void EDA_DRAW_PANEL_GAL::SetEventDispatcher( TOOL_DISPATCHER* aEventDispatcher )
{
m_eventDispatcher = aEventDispatcher;
#if wxCHECK_VERSION( 3, 0, 0 )
const wxEventType eventTypes[] = { wxEVT_TOOL };
#else
const wxEventType eventTypes[] = { wxEVT_COMMAND_MENU_SELECTED, wxEVT_COMMAND_TOOL_CLICKED };
#endif
if( m_eventDispatcher )
{
@ -310,7 +305,7 @@ bool EDA_DRAW_PANEL_GAL::SwitchBackend( GAL_TYPE aGalType )
// warn about unhandled GAL canvas type, but continue with the fallback option
case GAL_TYPE_NONE:
// KIGFX::GAL is a stub - it actually does cannot display anything,
// KIGFX::GAL is a stub - it actually does cannot display anything,
// but prevents code relying on GAL canvas existence from crashing
new_gal = new KIGFX::GAL();
break;

View File

@ -375,26 +375,9 @@ void GRLine( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, int aW
}
void GRDashedLineTo( EDA_RECT* ClipBox, wxDC* DC, int x2, int y2, int width, EDA_COLOR_T Color )
{
s_DC_lastcolor = UNSPECIFIED_COLOR;
GRSetColorPen( DC, Color, width, wxPENSTYLE_SHORT_DASH );
WinClipAndDrawLine( ClipBox, DC, GRLastMoveToX, GRLastMoveToY, x2, y2, width );
s_DC_lastcolor = UNSPECIFIED_COLOR;
GRSetColorPen( DC, Color, width );
GRLastMoveToX = x2;
GRLastMoveToY = y2;
}
void GRDashedLine( EDA_RECT* ClipBox,
wxDC* DC,
int x1,
int y1,
int x2,
int y2,
int width,
EDA_COLOR_T Color )
void GRDashedLine( EDA_RECT* ClipBox, wxDC* DC,
int x1, int y1, int x2, int y2,
int width, EDA_COLOR_T Color )
{
GRLastMoveToX = x2;
GRLastMoveToY = y2;
@ -421,12 +404,7 @@ void GRMoveTo( int x, int y )
*/
void GRLineTo( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int width, EDA_COLOR_T Color )
{
int GRLineToX, GRLineToY;
GRLineToX = x;
GRLineToY = y;
GRLine( ClipBox, DC, GRLastMoveToX, GRLastMoveToY, GRLineToX, GRLineToY, width, Color );
GRLine( ClipBox, DC, GRLastMoveToX, GRLastMoveToY, x, y, width, Color );
}

View File

@ -109,15 +109,17 @@ void GRForceBlackPen( bool flagforce );
*/
bool GetGRForceBlackPenState( void );
void GRLine( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, int aWidth, EDA_COLOR_T aColor );
void GRLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, EDA_COLOR_T Color );
void GRLine( EDA_RECT* aClipBox, wxDC* aDC,
wxPoint aStart, wxPoint aEnd, int aWidth, EDA_COLOR_T aColor );
void GRLine( EDA_RECT* ClipBox, wxDC* DC,
int x1, int y1, int x2, int y2, int width, EDA_COLOR_T Color );
void GRMixedLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
int width, EDA_COLOR_T Color );
void GRDashedLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
int width, EDA_COLOR_T Color );
void GRDashedLineTo( EDA_RECT* ClipBox, wxDC* DC, int x2, int y2, int width, EDA_COLOR_T Color );
void GRMoveTo( int x, int y );
void GRLineTo( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int width, EDA_COLOR_T Color );
void GRLineTo( EDA_RECT* ClipBox, wxDC* DC,
int x, int y, int width, EDA_COLOR_T Color );
void GRPoly( EDA_RECT* ClipBox, wxDC* DC, int n, wxPoint Points[], bool Fill,
int width, EDA_COLOR_T Color, EDA_COLOR_T BgColor );

View File

@ -5,10 +5,10 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License