GAL: changed line width setting to float type
This commit is contained in:
parent
59f77e68c9
commit
47d0eaa2c6
|
@ -417,11 +417,10 @@ void CAIRO_GAL_BASE::SetFillColor( const COLOR4D& aColor )
|
|||
}
|
||||
|
||||
|
||||
void CAIRO_GAL_BASE::SetLineWidth( double aLineWidth )
|
||||
void CAIRO_GAL_BASE::SetLineWidth( float aLineWidth )
|
||||
{
|
||||
storePath();
|
||||
|
||||
lineWidth = aLineWidth;
|
||||
GAL::SetLineWidth( aLineWidth );
|
||||
|
||||
if( isGrouping )
|
||||
{
|
||||
|
@ -435,8 +434,8 @@ void CAIRO_GAL_BASE::SetLineWidth( double aLineWidth )
|
|||
// Make lines appear at least 1 pixel wide, no matter of zoom
|
||||
double x = 1.0, y = 1.0;
|
||||
cairo_device_to_user_distance( currentContext, &x, &y );
|
||||
double minWidth = std::min( fabs( x ), fabs( y ) );
|
||||
cairo_set_line_width( currentContext, std::max( aLineWidth, minWidth ) );
|
||||
float minWidth = std::min( fabs( x ), fabs( y ) );
|
||||
cairo_set_line_width( currentContext, std::fmax( aLineWidth, minWidth ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,14 +54,14 @@ GAL::GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions ) :
|
|||
SetDepthRange( VECTOR2D( GAL::MIN_DEPTH, GAL::MAX_DEPTH ) );
|
||||
SetLayerDepth( 0.0 );
|
||||
SetFlip( false, false );
|
||||
SetLineWidth( 1.0 );
|
||||
SetLineWidth( 1.0f );
|
||||
computeWorldScale();
|
||||
SetAxesEnabled( false );
|
||||
|
||||
// Set grid defaults
|
||||
SetGridVisibility( true );
|
||||
SetCoarseGrid( 10 );
|
||||
gridLineWidth = 0.5;
|
||||
gridLineWidth = 0.5f;
|
||||
gridStyle = GRID_STYLE::LINES;
|
||||
gridMinSpacing = 10;
|
||||
|
||||
|
@ -231,8 +231,8 @@ void GAL::DrawGrid()
|
|||
// Note: generic grids can't handle sub-pixel lines without
|
||||
// either losing fine/course distinction or having some dots
|
||||
// fail to render
|
||||
double marker = std::max( 1.0, gridLineWidth ) / worldScale;
|
||||
double doubleMarker = 2.0 * marker;
|
||||
float marker = std::fmax( 1.0f, gridLineWidth ) / worldScale;
|
||||
float doubleMarker = 2.0f * marker;
|
||||
|
||||
// Draw axes if desired
|
||||
if( axesEnabled )
|
||||
|
|
|
@ -1182,8 +1182,8 @@ void OPENGL_GAL::DrawGrid()
|
|||
nonCachedManager->EnableDepthTest( false );
|
||||
|
||||
// sub-pixel lines all render the same
|
||||
double minorLineWidth = std::max( 1.0, gridLineWidth ) * getWorldPixelSize();
|
||||
double majorLineWidth = minorLineWidth * 2.0;
|
||||
float minorLineWidth = std::fmax( 1.0f, gridLineWidth ) * getWorldPixelSize();
|
||||
float majorLineWidth = minorLineWidth * 2.0f;
|
||||
|
||||
// Draw the axis and grid
|
||||
// For the drawing the start points, end points and increments have
|
||||
|
|
|
@ -143,7 +143,7 @@ public:
|
|||
virtual void SetFillColor( const COLOR4D& aColor ) override;
|
||||
|
||||
/// @copydoc GAL::SetLineWidth()
|
||||
virtual void SetLineWidth( double aLineWidth ) override;
|
||||
virtual void SetLineWidth( float aLineWidth ) override;
|
||||
|
||||
/// @copydoc GAL::SetLayerDepth()
|
||||
virtual void SetLayerDepth( double aLayerDepth ) override;
|
||||
|
|
|
@ -283,7 +283,7 @@ public:
|
|||
*
|
||||
* @param aLineWidth is the line width.
|
||||
*/
|
||||
virtual void SetLineWidth( double aLineWidth )
|
||||
virtual void SetLineWidth( float aLineWidth )
|
||||
{
|
||||
lineWidth = aLineWidth;
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ public:
|
|||
*
|
||||
* @return the actual line width.
|
||||
*/
|
||||
inline double GetLineWidth() const
|
||||
inline float GetLineWidth() const
|
||||
{
|
||||
return lineWidth;
|
||||
}
|
||||
|
@ -916,7 +916,7 @@ public:
|
|||
*
|
||||
* @return the grid line width
|
||||
*/
|
||||
inline double GetGridLineWidth() const
|
||||
inline float GetGridLineWidth() const
|
||||
{
|
||||
return gridLineWidth;
|
||||
}
|
||||
|
@ -1042,7 +1042,7 @@ protected:
|
|||
bool globalFlipX; ///< Flag for X axis flipping
|
||||
bool globalFlipY; ///< Flag for Y axis flipping
|
||||
|
||||
double lineWidth; ///< The line width
|
||||
float lineWidth; ///< The line width
|
||||
|
||||
bool isFillEnabled; ///< Is filling of graphic objects enabled ?
|
||||
bool isStrokeEnabled; ///< Are the outlines stroked ?
|
||||
|
@ -1064,7 +1064,7 @@ protected:
|
|||
COLOR4D axesColor; ///< Color of the axes
|
||||
bool axesEnabled; ///< Should the axes be drawn
|
||||
int gridTick; ///< Every tick line gets the double width
|
||||
double gridLineWidth; ///< Line width of the grid
|
||||
float gridLineWidth; ///< Line width of the grid
|
||||
int gridMinSpacing; ///< Minimum screen size of the grid (pixels)
|
||||
///< below which the grid is not drawn
|
||||
|
||||
|
|
Loading…
Reference in New Issue