r15074 by jghali - fix #15023 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:40:50 CEST 2010
Revision: 15074
Author: jghali
Date: 2010-05-14T18:31:11.851061Z
Commit message: fix #15023 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 /trunk/Scribus/scribus/scribus.cpp
M /trunk/Scribus/scribus/pageitem.cpp
M /trunk/Scribus/scribus/scribusXml.cpp
M /trunk/Scribus/scribus/scribusdoc.cpp
Diffs:
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp (revision 15073)
+++ scribus/scribusdoc.cpp (revision 15074)
@@ -4655,14 +4655,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 = 9999999.9;
- double miny = 9999999.9;
- double maxx = -9999999.9;
- double maxy = -9999999.9;
+ 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)
{
@@ -8946,10 +8942,8 @@
newX=currentPage()->xOffset() + guidePosition;
break;
case alignSelection:
- // double minX = std::numeric_limits<double>::max();
- // double maxX = std::numeric_limits<double>::min();
- double minX = 9999999.9;
- double maxX = -9999999.9;
+ 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);
@@ -8975,8 +8969,7 @@
return;
uint alignObjectsCount=AObjects.count();
int loopStart=0, loopEnd=alignObjectsCount-1;
-// double newX = std::numeric_limits<double>::min();
- double newX = -9999999.9;
+ double newX = -std::numeric_limits<double>::max();
switch ( currAlignTo )
{
case alignFirst:
@@ -9021,8 +9014,7 @@
return;
uint alignObjectsCount=AObjects.count();
int loopStart=0, loopEnd=alignObjectsCount-1;
-// double newX = std::numeric_limits<double>::min();
- double newX = -9999999.9;
+ double newX = -std::numeric_limits<double>::max();
switch ( currAlignTo )
{
case alignFirst:
@@ -9180,10 +9172,8 @@
newY=currentPage()->yOffset() + guidePosition;
break;
case alignSelection:
- // double minY = std::numeric_limits<double>::max();
- // double maxY = std::numeric_limits<double>::min();
- double minY = 9999999.9;
- double maxY = -9999999.9;
+ 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);
@@ -9209,8 +9199,7 @@
return;
uint alignObjectsCount=AObjects.count();
int loopStart=0, loopEnd=alignObjectsCount-1;
-// double newY = std::numeric_limits<double>::min();
- double newY = -9999999.9;
+ double newY = -std::numeric_limits<double>::max();
switch ( currAlignTo )
{
case alignFirst:
@@ -9255,8 +9244,7 @@
return;
uint alignObjectsCount=AObjects.count();
int loopStart=0, loopEnd=alignObjectsCount-1;
-// double newY = std::numeric_limits<double>::min();
- double newY = -9999999.9;
+ double newY = -std::numeric_limits<double>::max();
switch ( currAlignTo )
{
case alignFirst:
@@ -9817,8 +9805,8 @@
int itemIndex=itX.value(); //get our first item's index in the AObjects array
// bool found=false;
// double itXX=itX.key();
- minY = std::numeric_limits<double>::max();
- maxY = std::numeric_limits<double>::min();
+ minY = std::numeric_limits<double>::max();
+ maxY = -std::numeric_limits<double>::max();
int nextItemIndex=itemIndex;
circleList.append(nextItemIndex);
++circleListCounter;
@@ -9931,10 +9919,8 @@
int itemIndex=itX.value(); //get our first item's index in the AObjects array
// bool found=false;
// double itXX=itX.key();
-// minY = std::numeric_limits<double>::max();
-// maxY = std::numeric_limits<double>::min();
- minY = 9999999.9;
- maxY = -9999999.9;
+ minY = std::numeric_limits<double>::max();
+ maxY = -std::numeric_limits<double>::max();
int nextItemIndex=itemIndex;
circleList.append(nextItemIndex);
++circleListCounter;
@@ -11197,14 +11183,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 = 9999999.9;
- double miny = 9999999.9;
- double maxx = -9999999.9;
- double maxy = -9999999.9;
+ 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);
@@ -12360,3 +12342,4 @@
}
+
Index: scribus/scribusXml.cpp
===================================================================
--- scribus/scribusXml.cpp (revision 15073)
+++ scribus/scribusXml.cpp (revision 15074)
@@ -2164,14 +2164,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 = 9999999.9;
- double miny = 9999999.9;
- double maxx = -9999999.9;
- double maxy = -9999999.9;
+ 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);
@@ -3285,3 +3281,4 @@
}
+
Index: scribus/pageitem.cpp
===================================================================
--- scribus/pageitem.cpp (revision 15073)
+++ scribus/pageitem.cpp (revision 15074)
@@ -2211,14 +2211,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 = 9999999.9;
- double miny = 9999999.9;
- double maxx = -9999999.9;
- double maxy = -9999999.9;
+ 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)
@@ -5666,14 +5662,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 = 9999999.9;
- double miny = 9999999.9;
- double maxx = -9999999.9;
- double maxy = -9999999.9;
+ 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;
@@ -5812,14 +5804,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 = 9999999.9;
- double miny = 9999999.9;
- double maxx = -9999999.9;
- double maxy = -9999999.9;
+ 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())
{
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp (revision 15073)
+++ scribus/scribus.cpp (revision 15074)
@@ -9740,14 +9740,10 @@
int ae = doc->Items->count();
if ((docSelectionCount > 1) && (!isGroup))
{
-// 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 = 9999999.9;
- double miny = 9999999.9;
- double maxx = -9999999.9;
- double maxy = -9999999.9;
+ 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 (int as = ac+1; as < ae; ++as)
{
PageItem* currItem = doc->Items->at(as);
More information about the scribus-commit
mailing list