r15075 by jghali - fix #15022 commit : numeric_limits<double>::min() is tricky as it does not represent the lowest possible double value but the lowest positive double value => after some search, use -numeric_limits<double>::max() instead

scribus-commit scribus-commit at lists.scribus.net
Fri May 14 20:41:23 CEST 2010


Revision: 15075
Author: jghali
Date: 2010-05-14T18:33:32.545481Z
Commit message: fix #15022 commit : numeric_limits<double>::min() is tricky as it does not represent the lowest possible double value but the lowest positive double value => after some search, use -numeric_limits<double>::max() instead

Changeset: 
M  /branches/Version135/Scribus/scribus/pageitem.cpp
M  /branches/Version135/Scribus/scribus/scribusXml.cpp
M  /branches/Version135/Scribus/scribus/scribusdoc.cpp

Diffs:
Index: scribus/scribusXml.cpp
===================================================================
--- scribus/scribusXml.cpp	(revision 15074)
+++ scribus/scribusXml.cpp	(revision 15075)
@@ -1786,10 +1786,10 @@
 	{
 		if (item->rotation() != 0)
 		{
-			double minx = std::numeric_limits<double>::max();
-			double miny = std::numeric_limits<double>::max();
-			double maxx = std::numeric_limits<double>::min();
-			double maxy = std::numeric_limits<double>::min();
+			double minx =  std::numeric_limits<double>::max();
+			double miny =  std::numeric_limits<double>::max();
+			double maxx = -std::numeric_limits<double>::max();
+			double maxy = -std::numeric_limits<double>::max();
 			double xpo = item->xPos() - doc->currentPage()->xOffset();
 			double ypo = item->yPos() - doc->currentPage()->yOffset();
 			FPointArray pb(4);
@@ -2679,3 +2679,4 @@
 		style.setTabValues(tabs);
 }
 
+
Index: scribus/pageitem.cpp
===================================================================
--- scribus/pageitem.cpp	(revision 15074)
+++ scribus/pageitem.cpp	(revision 15075)
@@ -1543,10 +1543,10 @@
 {
 	QList<PageItem*> emG;
 	emG.clear();
-	double minx = std::numeric_limits<double>::max();
-	double miny = std::numeric_limits<double>::max();
-	double maxx = std::numeric_limits<double>::min();
-	double maxy = std::numeric_limits<double>::min();
+	double minx =  std::numeric_limits<double>::max();
+	double miny =  std::numeric_limits<double>::max();
+	double maxx = -std::numeric_limits<double>::max();
+	double maxy = -std::numeric_limits<double>::max();
 	if (Groups.count() != 0)
 	{
 		for (int ga=0; ga<m_Doc->Items->count(); ++ga)
@@ -4291,10 +4291,10 @@
 
 void PageItem::getBoundingRect(double *x1, double *y1, double *x2, double *y2) const
 {
-	double minx = std::numeric_limits<double>::max();
-	double miny = std::numeric_limits<double>::max();
-	double maxx = std::numeric_limits<double>::min();
-	double maxy = std::numeric_limits<double>::min();
+	double minx =  std::numeric_limits<double>::max();
+	double miny =  std::numeric_limits<double>::max();
+	double maxx = -std::numeric_limits<double>::max();
+	double maxy = -std::numeric_limits<double>::max();
 	if (Rot != 0)
 	{
 		FPointArray pb;
@@ -4433,10 +4433,10 @@
 
 void PageItem::getVisualBoundingRect(double * x1, double * y1, double * x2, double * y2) const
 {
-	double minx = std::numeric_limits<double>::max();
-	double miny = std::numeric_limits<double>::max();
-	double maxx = std::numeric_limits<double>::min();
-	double maxy = std::numeric_limits<double>::min();
+	double minx =  std::numeric_limits<double>::max();
+	double miny =  std::numeric_limits<double>::max();
+	double maxx = -std::numeric_limits<double>::max();
+	double maxy = -std::numeric_limits<double>::max();
 	double extraSpace = 0.0;
 	if (NamedLStyle.isEmpty())
 	{
@@ -5613,3 +5613,4 @@
 
 
 
+
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(revision 15074)
+++ scribus/scribusdoc.cpp	(revision 15075)
@@ -4018,10 +4018,10 @@
 void ScribusDoc::canvasMinMax(FPoint& minPoint, FPoint& maxPoint)
 {
 	PageItem *currItem;
-	double minx = std::numeric_limits<double>::max();
-	double miny = std::numeric_limits<double>::max();
-	double maxx = std::numeric_limits<double>::min();
-	double maxy = std::numeric_limits<double>::min();
+	double minx =  std::numeric_limits<double>::max();
+	double miny =  std::numeric_limits<double>::max();
+	double maxx = -std::numeric_limits<double>::max();
+	double maxy = -std::numeric_limits<double>::max();
 	uint docItemsCount=Items->count();
 	if (docItemsCount != 0)
 	{
@@ -8067,8 +8067,8 @@
 			newX=currentPage()->xOffset() + guidePosition;
 			break;
 		case alignSelection:
-			double minX=std::numeric_limits<double>::max();
-			double maxX=std::numeric_limits<double>::min();
+			double minX =  std::numeric_limits<double>::max();
+			double maxX = -std::numeric_limits<double>::max();
 			for (uint a = 0; a < alignObjectsCount; ++a)
 			{
 				minX = qMin(AObjects[a].x1, minX);
@@ -8094,7 +8094,7 @@
 		return;
 	uint alignObjectsCount=AObjects.count();
 	int loopStart=0, loopEnd=alignObjectsCount-1;
-	double newX = std::numeric_limits<double>::min();
+	double newX = -std::numeric_limits<double>::max();
 	switch ( currAlignTo ) 
 	{
 		case alignFirst:
@@ -8139,7 +8139,7 @@
 		return;
 	uint alignObjectsCount=AObjects.count();
 	int loopStart=0, loopEnd=alignObjectsCount-1;
-	double newX = std::numeric_limits<double>::min();
+	double newX = -std::numeric_limits<double>::max();
 	switch ( currAlignTo ) 
 	{
 		case alignFirst:
@@ -8297,8 +8297,8 @@
 			newY=currentPage()->yOffset() + guidePosition;
 			break;
 		case alignSelection:
-			double minY = std::numeric_limits<double>::max();
-			double maxY = std::numeric_limits<double>::min();
+			double minY =  std::numeric_limits<double>::max();
+			double maxY = -std::numeric_limits<double>::max();
 			for (uint a = 0; a < alignObjectsCount; ++a)
 			{
 				minY = qMin(AObjects[a].y1, minY);
@@ -8324,7 +8324,7 @@
 		return;
 	uint alignObjectsCount=AObjects.count();
 	int loopStart=0, loopEnd=alignObjectsCount-1;
-	double newY = std::numeric_limits<double>::min();
+	double newY = -std::numeric_limits<double>::max();
 	switch ( currAlignTo ) 
 	{
 		case alignFirst:
@@ -8369,7 +8369,7 @@
 		return;
 	uint alignObjectsCount=AObjects.count();
 	int loopStart=0, loopEnd=alignObjectsCount-1;
-	double newY = std::numeric_limits<double>::min();
+	double newY = -std::numeric_limits<double>::max();
 	switch ( currAlignTo )
 	{
 		case alignFirst:
@@ -10057,10 +10057,10 @@
 			lowestItem = qMin(lowestItem, currItem->ItemNr);
 			highestItem = qMax(highestItem, currItem->ItemNr);
 		}
-		double minx = std::numeric_limits<double>::max();
-		double miny = std::numeric_limits<double>::max();
-		double maxx = std::numeric_limits<double>::min();
-		double maxy = std::numeric_limits<double>::min();
+		double minx =  std::numeric_limits<double>::max();
+		double miny =  std::numeric_limits<double>::max();
+		double maxx = -std::numeric_limits<double>::max();
+		double maxy = -std::numeric_limits<double>::max();
 		for (uint ep = 0; ep < selectedItemCount; ++ep)
 		{
 			PageItem* currItem = itemSelection->itemAt(ep);




More information about the scribus-commit mailing list