[Marble-commits] KDE/kdeedu/marble/src/lib
Jens-Michael Hoffmann
jensmh at gmx.de
Sat Jan 15 16:09:07 CET 2011
SVN commit 1214616 by jmhoffmann:
Pass floating point numbers as qreal's to qMin/qMax, reported by krazy.
M +2 -1 TileScalingTextureMapper.cpp
M +12 -6 blendings/BlendingAlgorithms.cpp
--- trunk/KDE/kdeedu/marble/src/lib/TileScalingTextureMapper.cpp #1214615:1214616
@@ -74,7 +74,8 @@
const int maxTileX = numTilesX * ( xNormalizedCenter + imageWidth/( 8.0 * radius ) );
const qreal yNormalizedCenter = 0.5 - 0.5 * asinh( tan( centerLat ) ) / M_PI;
- const int minTileY = qMax( numTilesY * ( yNormalizedCenter - imageHeight/( 8.0 * radius ) ), 0.0 );
+ const int minTileY = qMax( numTilesY * ( yNormalizedCenter - imageHeight/( 8.0 * radius ) ),
+ qreal( 0.0 ));
const int maxTileY = qMin( numTilesY * ( yNormalizedCenter + imageHeight/( 8.0 * radius ) ), numTilesY - 1.0 );
QPainter painter( canvasImage );
--- trunk/KDE/kdeedu/marble/src/lib/blendings/BlendingAlgorithms.cpp #1214615:1214616
@@ -79,7 +79,8 @@
qreal LinearLightBlending::blendChannel( qreal const bottomColorIntensity,
qreal const topColorIntensity ) const
{
- return qMin( 1.0, qMax( 0.0, ( bottomColorIntensity + 2.0 * topColorIntensity ) - 1.0 ));
+ return qMin( qreal( 1.0 ),
+ qMax( qreal( 0.0 ), ( bottomColorIntensity + 2.0 * topColorIntensity ) - 1.0 ));
}
qreal OverlayBlending::blendChannel( qreal const bottomColorIntensity,
@@ -118,7 +119,8 @@
Q_UNUSED(bottomColorIntensity);
Q_UNUSED(topColorIntensity);
// FIXME: check if this formula makes sense
- return qMin( 1.0, qMax( 0.0, 1.0 - ( 1.0 - bottomColorIntensity ) / topColorIntensity ));
+ return qMin( qreal( 1.0 ),
+ qMax( qreal( 0.0 ), 1.0 - ( 1.0 - bottomColorIntensity ) / topColorIntensity ));
}
qreal DarkBlending::blendChannel( qreal const bottomColorIntensity,
@@ -198,7 +200,8 @@
qreal ColorDodgeBlending::blendChannel( qreal const bottomColorIntensity,
qreal const topColorIntensity ) const
{
- return qMin( 1.0, qMax( 0.0, bottomColorIntensity / ( 1.0 - topColorIntensity )));
+ return qMin( qreal( 1.0 ),
+ qMax( qreal( 0.0 ), bottomColorIntensity / ( 1.0 - topColorIntensity )));
}
qreal GammaLightBlending::blendChannel( qreal const bottomColorIntensity,
@@ -251,8 +254,10 @@
qreal const topColorIntensity ) const
{
return topColorIntensity < 0.5
- ? qMin( 1.0, qMax( 0.0, 1.0 - ( 1.0 - bottomColorIntensity ) / ( 2.0 * topColorIntensity )))
- : qMin( 1.0, qMax( 0.0, bottomColorIntensity / ( 2.0 * ( 1.0 - topColorIntensity ))));
+ ? qMin( qreal( 1.0 ),
+ qMax( qreal( 0.0 ), 1.0 - ( 1.0 - bottomColorIntensity ) / ( 2.0 * topColorIntensity )))
+ : qMin( qreal( 1.0 ),
+ qMax( qreal( 0.0 ), bottomColorIntensity / ( 2.0 * ( 1.0 - topColorIntensity ))));
}
@@ -279,7 +284,8 @@
qreal DifferenceBlending::blendChannel( qreal const bottomColorIntensity,
qreal const topColorIntensity ) const
{
- return qMax( qMin( 1.0, bottomColorIntensity - topColorIntensity + 0.5 ), 0.0 );
+ return qMax( qMin( qreal( 1.0 ), bottomColorIntensity - topColorIntensity + 0.5 ),
+ qreal( 0.0 ));
}
qreal EquivalenceBlending::blendChannel( qreal const bottomColorIntensity,
More information about the Marble-commits
mailing list