From 9d4a19797ca0b40bceecd2cadc6826c6ef9f9cd8 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Sat, 16 Feb 2019 17:45:05 -0800 Subject: [PATCH] cairo: Don't round locations of outlines Pixel alignment is not required for track outline mode. It creates differences between segment and radius calculations. Also add specific width of the outlines --- common/gal/cairo/cairo_gal.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/common/gal/cairo/cairo_gal.cpp b/common/gal/cairo/cairo_gal.cpp index dfbd6e8da7..56683df328 100644 --- a/common/gal/cairo/cairo_gal.cpp +++ b/common/gal/cairo/cairo_gal.cpp @@ -188,6 +188,10 @@ void CAIRO_GAL_BASE::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& a } else { + aWidth /= 2.0; + SetLineWidth( 1.0 ); + syncLineWidth(); + // Outline mode for tracks VECTOR2D startEndVector = aEndPoint - aStartPoint; double lineAngle = atan2( startEndVector.y, startEndVector.x ); @@ -195,13 +199,13 @@ void CAIRO_GAL_BASE::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& a double sa = sin( lineAngle + M_PI / 2.0 ); double ca = cos( lineAngle + M_PI / 2.0 ); - auto pa0 = roundp( xform ( aStartPoint + VECTOR2D(aWidth * ca, aWidth * sa ) ) ); - auto pa1 = roundp( xform ( aStartPoint - VECTOR2D(aWidth * ca, aWidth * sa ) ) ); - auto pb0 = roundp( xform ( aEndPoint + VECTOR2D(aWidth * ca, aWidth * sa ) ) ); - auto pb1 = roundp( xform ( aEndPoint - VECTOR2D(aWidth * ca, aWidth * sa ) ) ); - auto pa = roundp( xform( aStartPoint ) ); - auto pb = roundp( xform( aEndPoint ) ); - auto rb = ::roundp( (pa0 - pa).EuclideanNorm() ); + auto pa0 = xform ( aStartPoint + VECTOR2D(aWidth * ca, aWidth * sa ) ); + auto pa1 = xform ( aStartPoint - VECTOR2D(aWidth * ca, aWidth * sa ) ); + auto pb0 = xform ( aEndPoint + VECTOR2D(aWidth * ca, aWidth * sa ) ); + auto pb1 = xform ( aEndPoint - VECTOR2D(aWidth * ca, aWidth * sa ) ); + auto pa = xform( aStartPoint ); + auto pb = xform( aEndPoint ); + auto rb = (pa0 - pa).EuclideanNorm(); cairo_set_source_rgba( currentContext, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a );