Bug 637852. Part 2: Add BaseRect::ScaleInverseRoundOut API. r=joe

This commit is contained in:
Robert O'Callahan 2011-06-23 00:11:27 +12:00
parent 29044a8c64
commit ac135884a6

View File

@ -305,6 +305,16 @@ struct BaseRect {
width = right - x;
height = bottom - y;
}
void ScaleInverseRoundOut(double aScale) { ScaleInverseRoundOut(aScale, aScale); }
void ScaleInverseRoundOut(double aXScale, double aYScale)
{
T right = static_cast<T>(ceil(double(XMost()) / aXScale));
T bottom = static_cast<T>(ceil(double(YMost()) / aYScale));
x = static_cast<T>(floor(double(x) / aXScale));
y = static_cast<T>(floor(double(y) / aYScale));
width = right - x;
height = bottom - y;
}
private:
// Do not use the default operator== or operator!= !