Retire DPOINT and DSIZE.

This commit is contained in:
Jeff Young
2022-01-20 21:10:04 +00:00
parent 67eb3116ce
commit fbab335128
16 changed files with 97 additions and 109 deletions
+20 -20
View File
@@ -371,9 +371,9 @@ void SVG_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int
{
EDA_RECT rect( p1, VECTOR2I( p2.x - p1.x, p2.y - p1.y ) );
rect.Normalize();
DPOINT org_dev = userToDeviceCoordinates( rect.GetOrigin() );
DPOINT end_dev = userToDeviceCoordinates( rect.GetEnd() );
DSIZE size_dev = end_dev - org_dev;
VECTOR2D org_dev = userToDeviceCoordinates( rect.GetOrigin() );
VECTOR2D end_dev = userToDeviceCoordinates( rect.GetEnd() );
VECTOR2D size_dev = end_dev - org_dev;
// Ensure size of rect in device coordinates is > 0
// I don't know if this is a SVG issue or a Inkscape issue, but
@@ -406,8 +406,8 @@ void SVG_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int
void SVG_PLOTTER::Circle( const VECTOR2I& pos, int diametre, FILL_T fill, int width )
{
DPOINT pos_dev = userToDeviceCoordinates( pos );
double radius = userToDeviceSize( diametre / 2.0 );
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
double radius = userToDeviceSize( diametre / 2.0 );
setFillMode( fill );
SetCurrentLineWidth( width );
@@ -450,8 +450,8 @@ void SVG_PLOTTER::Arc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAngle,
std::swap( startAngle, endAngle );
// Calculate start point.
DPOINT centre_device = userToDeviceCoordinates( aCenter );
double radius_device = userToDeviceSize( aRadius );
VECTOR2D centre_device = userToDeviceCoordinates( aCenter );
double radius_device = userToDeviceSize( aRadius );
if( !m_yaxisReversed ) // Should be never the case
{
@@ -475,10 +475,10 @@ void SVG_PLOTTER::Arc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAngle,
}
}
DPOINT start;
VECTOR2D start;
start.x = radius_device;
RotatePoint( start, startAngle );
DPOINT end;
VECTOR2D end;
end.x = radius_device;
RotatePoint( end, endAngle );
start += centre_device;
@@ -539,10 +539,10 @@ void SVG_PLOTTER::BezierCurve( const VECTOR2I& aStart, const VECTOR2I& aControl1
setFillMode( FILL_T::NO_FILL );
SetCurrentLineWidth( aLineThickness );
DPOINT start = userToDeviceCoordinates( aStart );
DPOINT ctrl1 = userToDeviceCoordinates( aControl1 );
DPOINT ctrl2 = userToDeviceCoordinates( aControl2 );
DPOINT end = userToDeviceCoordinates( aEnd );
VECTOR2D start = userToDeviceCoordinates( aStart );
VECTOR2D ctrl1 = userToDeviceCoordinates( aControl1 );
VECTOR2D ctrl2 = userToDeviceCoordinates( aControl2 );
VECTOR2D end = userToDeviceCoordinates( aEnd );
// Generate a cubic curve: start point and 3 other control points.
fprintf( m_outputFile, "<path d=\"M%f,%f C%f,%f %f,%f %f,%f\" />\n",
@@ -577,7 +577,7 @@ void SVG_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFi
break;
}
DPOINT pos = userToDeviceCoordinates( aCornerList[0] );
VECTOR2D pos = userToDeviceCoordinates( aCornerList[0] );
fprintf( m_outputFile, "d=\"M %f,%f\n", pos.x, pos.y );
for( unsigned ii = 1; ii < aCornerList.size() - 1; ii++ )
@@ -604,7 +604,7 @@ void SVG_PLOTTER::PlotImage( const wxImage& aImage, const VECTOR2I& aPos, double
VECTOR2I pix_size( aImage.GetWidth(), aImage.GetHeight() );
// Requested size (in IUs)
DPOINT drawsize( aScaleFactor * pix_size.x, aScaleFactor * pix_size.y );
VECTOR2D drawsize( aScaleFactor * pix_size.x, aScaleFactor * pix_size.y );
// calculate the bitmap start position
VECTOR2I start( aPos.x - drawsize.x / 2, aPos.y - drawsize.y / 2 );
@@ -662,7 +662,7 @@ void SVG_PLOTTER::PenTo( const VECTOR2I& pos, char plume )
if( m_penState == 'Z' ) // here plume = 'D' or 'U'
{
DPOINT pos_dev = userToDeviceCoordinates( pos );
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
// Ensure we do not use a fill mode when moving the pen,
// in SVG mode (i;e. we are plotting only basic lines, not a filled area
@@ -676,7 +676,7 @@ void SVG_PLOTTER::PenTo( const VECTOR2I& pos, char plume )
}
else if( m_penState != plume || pos != m_penLastpos )
{
DPOINT pos_dev = userToDeviceCoordinates( pos );
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
fprintf( m_outputFile, "L%d %d\n", (int) pos_dev.x, (int) pos_dev.y );
}
@@ -794,9 +794,9 @@ void SVG_PLOTTER::Text( const VECTOR2I& aPos,
// The actual text size value is the absolute value
text_size.x = std::abs( GraphicTextWidth( aText, aFont, aSize, aWidth, aBold, aItalic ) );
text_size.y = std::abs( aSize.x * 4/3 ); // Hershey font height to em size conversion
DPOINT anchor_pos_dev = userToDeviceCoordinates( aPos );
DPOINT text_pos_dev = userToDeviceCoordinates( text_pos );
DPOINT sz_dev = userToDeviceSize( text_size );
VECTOR2D anchor_pos_dev = userToDeviceCoordinates( aPos );
VECTOR2D text_pos_dev = userToDeviceCoordinates( text_pos );
VECTOR2D sz_dev = userToDeviceSize( text_size );
if( !aOrient.IsZero() )
{