Skip to content

Commit

Permalink
[diagram] Workaround floating point errors leading to diagram distortion
Browse files Browse the repository at this point in the history
Fix #8554
  • Loading branch information
m-kuhn committed Sep 3, 2013
1 parent 40ca274 commit fef175b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/core/diagram/qgspiediagram.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit fef175b

Please sign in to comment.