Skip to content
Permalink
Browse files

[diagram] Workaround floating point errors leading to diagram distortion

Fix #8554
  • Loading branch information
m-kuhn committed Sep 3, 2013
1 parent 40ca274 commit fef175b618dc5d7bc56008faeb648ea5d9bd7fc1
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/core/diagram/qgspiediagram.cpp
@@ -67,7 +67,15 @@ QSizeF QgsPieDiagram::diagramSize( const QgsAttributes& attributes, const QgsRen
// Scale, if extension is smaller than the specified minimum
if ( size.width() <= s.minimumSize && size.height() <= s.minimumSize )
{
bool p = false; // preserve height == width
if ( size.width() == size.height() )
p = true;

size.scale( s.minimumSize, s.minimumSize, Qt::KeepAspectRatio );

// If height == width, recover here (overwrite floating point errors)
if ( p )
size.setWidth( size.height() );
}

return size;

0 comments on commit fef175b

Please sign in to comment.
You can’t perform that action at this time.