Replace some floating point expressions with equivalent integer ones
This commit is contained in:
@@ -211,7 +211,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
|
|||||||
int edgePos = GetEdge(otherEdge, win, otherWin);
|
int edgePos = GetEdge(otherEdge, win, otherWin);
|
||||||
if (edgePos != -1)
|
if (edgePos != -1)
|
||||||
{
|
{
|
||||||
value = (int)(edgePos*(((float)percent)*0.01) + margin);
|
value = (edgePos * percent) / 100 + margin;
|
||||||
done = true;
|
done = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -286,7 +286,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
|
|||||||
int edgePos = GetEdge(otherEdge, win, otherWin);
|
int edgePos = GetEdge(otherEdge, win, otherWin);
|
||||||
if (edgePos != -1)
|
if (edgePos != -1)
|
||||||
{
|
{
|
||||||
value = (int)(edgePos*(((float)percent)*0.01) - margin);
|
value = (edgePos * percent) / 100 - margin;
|
||||||
done = true;
|
done = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -364,7 +364,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
|
|||||||
int edgePos = GetEdge(otherEdge, win, otherWin);
|
int edgePos = GetEdge(otherEdge, win, otherWin);
|
||||||
if (edgePos != -1)
|
if (edgePos != -1)
|
||||||
{
|
{
|
||||||
value = (int)(edgePos*(((float)percent)*0.01) + margin);
|
value = (edgePos * percent) / 100 + margin;
|
||||||
done = true;
|
done = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -439,7 +439,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
|
|||||||
int edgePos = GetEdge(otherEdge, win, otherWin);
|
int edgePos = GetEdge(otherEdge, win, otherWin);
|
||||||
if (edgePos != -1)
|
if (edgePos != -1)
|
||||||
{
|
{
|
||||||
value = (int)(edgePos*(((float)percent)*0.01) - margin);
|
value = (edgePos * percent) / 100 - margin;
|
||||||
done = true;
|
done = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -517,7 +517,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
|
|||||||
int edgePos = GetEdge(otherEdge, win, otherWin);
|
int edgePos = GetEdge(otherEdge, win, otherWin);
|
||||||
if (edgePos != -1)
|
if (edgePos != -1)
|
||||||
{
|
{
|
||||||
value = (int)(edgePos*(((float)percent)*0.01) + margin);
|
value = (edgePos * percent) / 100 + margin;
|
||||||
done = true;
|
done = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -585,7 +585,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
|
|||||||
int edgePos = GetEdge(otherEdge, win, otherWin);
|
int edgePos = GetEdge(otherEdge, win, otherWin);
|
||||||
if (edgePos != -1)
|
if (edgePos != -1)
|
||||||
{
|
{
|
||||||
value = (int)(edgePos*(((float)percent)*0.01) + margin);
|
value = (edgePos * percent) / 100 + margin;
|
||||||
done = true;
|
done = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -626,7 +626,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
|
|||||||
int edgePos = GetEdge(otherEdge, win, otherWin);
|
int edgePos = GetEdge(otherEdge, win, otherWin);
|
||||||
if (edgePos != -1)
|
if (edgePos != -1)
|
||||||
{
|
{
|
||||||
value = (int)(edgePos*(((float)percent)*0.01));
|
value = (edgePos * percent) / 100;
|
||||||
done = true;
|
done = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -684,7 +684,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
|
|||||||
int edgePos = GetEdge(otherEdge, win, otherWin);
|
int edgePos = GetEdge(otherEdge, win, otherWin);
|
||||||
if (edgePos != -1)
|
if (edgePos != -1)
|
||||||
{
|
{
|
||||||
value = (int)(edgePos*(((float)percent)*0.01));
|
value = (edgePos * percent) / 100;
|
||||||
done = true;
|
done = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -325,8 +325,8 @@ void wxPostScriptPrintPreview::DetermineScaling()
|
|||||||
m_previewPrintout->SetPPIPrinter( logPPIPrinterX, logPPIPrinterY );
|
m_previewPrintout->SetPPIPrinter( logPPIPrinterX, logPPIPrinterY );
|
||||||
|
|
||||||
wxSize sizeDevUnits(paper->GetSizeDeviceUnits());
|
wxSize sizeDevUnits(paper->GetSizeDeviceUnits());
|
||||||
sizeDevUnits.x = (wxCoord)((float)sizeDevUnits.x * resolution / 72.0);
|
sizeDevUnits.x = sizeDevUnits.x * resolution / 72;
|
||||||
sizeDevUnits.y = (wxCoord)((float)sizeDevUnits.y * resolution / 72.0);
|
sizeDevUnits.y = sizeDevUnits.y * resolution / 72;
|
||||||
wxSize sizeTenthsMM(paper->GetSize());
|
wxSize sizeTenthsMM(paper->GetSize());
|
||||||
wxSize sizeMM(sizeTenthsMM.x / 10, sizeTenthsMM.y / 10);
|
wxSize sizeMM(sizeTenthsMM.x / 10, sizeTenthsMM.y / 10);
|
||||||
|
|
||||||
|
@@ -1874,7 +1874,7 @@ bool wxRichTextCtrl::ScrollIntoView(long position, int keyCode)
|
|||||||
if (GetWindowStyle() & wxRE_CENTRE_CARET)
|
if (GetWindowStyle() & wxRE_CENTRE_CARET)
|
||||||
{
|
{
|
||||||
int y = rect.y - GetClientSize().y/2;
|
int y = rect.y - GetClientSize().y/2;
|
||||||
int yUnits = (int) (0.5 + ((float) y)/(float) ppuY);
|
int yUnits = (y + ppuY - 1) / ppuY;
|
||||||
if (y >= 0 && (y + clientSize.y) < (int) (0.5 + GetBuffer().GetCachedSize().y * GetScale()))
|
if (y >= 0 && (y + clientSize.y) < (int) (0.5 + GetBuffer().GetCachedSize().y * GetScale()))
|
||||||
{
|
{
|
||||||
if (startYUnits != yUnits)
|
if (startYUnits != yUnits)
|
||||||
@@ -1902,7 +1902,7 @@ bool wxRichTextCtrl::ScrollIntoView(long position, int keyCode)
|
|||||||
// Make it scroll so this item is at the bottom
|
// Make it scroll so this item is at the bottom
|
||||||
// of the window
|
// of the window
|
||||||
int y = rect.y - (clientSize.y - rect.height);
|
int y = rect.y - (clientSize.y - rect.height);
|
||||||
int yUnits = (int) (0.5 + ((float) y)/(float) ppuY);
|
int yUnits = (y + ppuY - 1) / ppuY;
|
||||||
|
|
||||||
// If we're still off the screen, scroll another line down
|
// If we're still off the screen, scroll another line down
|
||||||
if ((rect.y + rect.height) > (clientSize.y + (yUnits*ppuY)))
|
if ((rect.y + rect.height) > (clientSize.y + (yUnits*ppuY)))
|
||||||
@@ -1919,7 +1919,7 @@ bool wxRichTextCtrl::ScrollIntoView(long position, int keyCode)
|
|||||||
// Make it scroll so this item is at the top
|
// Make it scroll so this item is at the top
|
||||||
// of the window
|
// of the window
|
||||||
int y = rect.y - (int) (0.5 + GetBuffer().GetTopMargin() * GetScale());
|
int y = rect.y - (int) (0.5 + GetBuffer().GetTopMargin() * GetScale());
|
||||||
int yUnits = (int) (0.5 + ((float) y)/(float) ppuY);
|
int yUnits = (y + ppuY - 1) / ppuY;
|
||||||
|
|
||||||
if (startYUnits != yUnits)
|
if (startYUnits != yUnits)
|
||||||
{
|
{
|
||||||
@@ -1939,7 +1939,7 @@ bool wxRichTextCtrl::ScrollIntoView(long position, int keyCode)
|
|||||||
// Make it scroll so this item is at the top
|
// Make it scroll so this item is at the top
|
||||||
// of the window
|
// of the window
|
||||||
int y = rect.y - (int) (0.5 + GetBuffer().GetTopMargin() * GetScale());
|
int y = rect.y - (int) (0.5 + GetBuffer().GetTopMargin() * GetScale());
|
||||||
int yUnits = (int) (0.5 + ((float) y)/(float) ppuY);
|
int yUnits = (y + ppuY - 1) / ppuY;
|
||||||
|
|
||||||
if (startYUnits != yUnits)
|
if (startYUnits != yUnits)
|
||||||
{
|
{
|
||||||
@@ -1952,7 +1952,7 @@ bool wxRichTextCtrl::ScrollIntoView(long position, int keyCode)
|
|||||||
// Make it scroll so this item is at the bottom
|
// Make it scroll so this item is at the bottom
|
||||||
// of the window
|
// of the window
|
||||||
int y = rect.y - (clientSize.y - rect.height);
|
int y = rect.y - (clientSize.y - rect.height);
|
||||||
int yUnits = (int) (0.5 + ((float) y)/(float) ppuY);
|
int yUnits = (y + ppuY - 1) / ppuY;
|
||||||
|
|
||||||
// If we're still off the screen, scroll another line down
|
// If we're still off the screen, scroll another line down
|
||||||
if ((rect.y + rect.height) > (clientSize.y + (yUnits*ppuY)))
|
if ((rect.y + rect.height) > (clientSize.y + (yUnits*ppuY)))
|
||||||
@@ -2955,14 +2955,14 @@ void wxRichTextCtrl::SetupScrollbars(bool atTop, bool fromOnPaint)
|
|||||||
int maxHeight = (int) (0.5 + GetScale() * (GetBuffer().GetCachedSize().y + GetBuffer().GetTopMargin()));
|
int maxHeight = (int) (0.5 + GetScale() * (GetBuffer().GetCachedSize().y + GetBuffer().GetTopMargin()));
|
||||||
|
|
||||||
// Round up so we have at least maxHeight pixels
|
// Round up so we have at least maxHeight pixels
|
||||||
int unitsY = (int) (((float)maxHeight/(float)pixelsPerUnit) + 0.5);
|
int unitsY = (maxHeight + pixelsPerUnit - 1) / pixelsPerUnit;
|
||||||
|
|
||||||
int startX = 0, startY = 0;
|
int startX = 0, startY = 0;
|
||||||
if (!atTop)
|
if (!atTop)
|
||||||
GetViewStart(& startX, & startY);
|
GetViewStart(& startX, & startY);
|
||||||
|
|
||||||
int maxPositionX = 0;
|
int maxPositionX = 0;
|
||||||
int maxPositionY = (int) ((((float)(wxMax((unitsY*pixelsPerUnit) - clientSize.y, 0)))/((float)pixelsPerUnit)) + 0.5);
|
int maxPositionY = (wxMax(unitsY * pixelsPerUnit - clientSize.y, 0) + pixelsPerUnit - 1) / pixelsPerUnit;
|
||||||
|
|
||||||
int newStartX = wxMin(maxPositionX, startX);
|
int newStartX = wxMin(maxPositionX, startX);
|
||||||
int newStartY = wxMin(maxPositionY, startY);
|
int newStartY = wxMin(maxPositionY, startY);
|
||||||
|
Reference in New Issue
Block a user