Skip to content

Commit

Permalink
sizePainterUnits: Calculate based on specified size instead of size i…
Browse files Browse the repository at this point in the history
…n QgsDiagramSettings
  • Loading branch information
m-kuhn committed Sep 3, 2012
1 parent 9c4d67c commit aa31c8c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/core/diagram/qgsdiagram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@ void QgsDiagram::setPenWidth( QPen& pen, const QgsDiagramSettings& s, const QgsR

QSizeF QgsDiagram::sizePainterUnits( const QSizeF& size, const QgsDiagramSettings& s, const QgsRenderContext& c )
{
Q_UNUSED( size );
if ( s.sizeType == QgsDiagramSettings::MM )
{
return QSizeF( s.size.width() * c.scaleFactor() * c.rasterScaleFactor(), s.size.height() * c.scaleFactor() * c.rasterScaleFactor());
return QSizeF( size.width() * c.scaleFactor() * c.rasterScaleFactor(), size.height() * c.scaleFactor() * c.rasterScaleFactor());
}
else
{
return QSizeF( s.size.width() / c.mapToPixel().mapUnitsPerPixel(), s.size.height() / c.mapToPixel().mapUnitsPerPixel() );
return QSizeF( size.width() / c.mapToPixel().mapUnitsPerPixel(), size.height() / c.mapToPixel().mapUnitsPerPixel() );
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/diagram/qgsdiagram.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class CORE_EXPORT QgsDiagram
void setPenWidth( QPen& pen, const QgsDiagramSettings& s, const QgsRenderContext& c );

/** Calculates a size to match the current settings and rendering context
* @param size Unused
* @param s The settings that specify the diagram size
* @param size The size to convert
* @param s The settings that specify the size type
* @param c The rendering specifying the proper scale units for pixel conversion
*
* @return The converted size for rendering
Expand Down

0 comments on commit aa31c8c

Please sign in to comment.