Bug 660662. Eliminate NS_(ceil|floor). r=roc

These just called the system versions.
This commit is contained in:
Jeff Muizelaar 2011-05-30 15:08:55 -04:00
Родитель d0b2e1b18a
Коммит 1f4cd33169
20 изменённых файлов: 82 добавлений и 106 удалений

Просмотреть файл

@ -94,7 +94,7 @@ inline nscoord NSToCoordRound(float aValue)
#if defined(XP_WIN32) && defined(_M_IX86) && !defined(__GNUC__)
return NS_lroundup30(aValue);
#else
return nscoord(NS_floorf(aValue + 0.5f));
return nscoord(floorf(aValue + 0.5f));
#endif /* XP_WIN32 && _M_IX86 && !__GNUC__ */
}
@ -103,7 +103,7 @@ inline nscoord NSToCoordRound(double aValue)
#if defined(XP_WIN32) && defined(_M_IX86) && !defined(__GNUC__)
return NS_lroundup30((float)aValue);
#else
return nscoord(NS_floor(aValue + 0.5f));
return nscoord(floor(aValue + 0.5f));
#endif /* XP_WIN32 && _M_IX86 && !__GNUC__ */
}
@ -360,12 +360,12 @@ inline float NSCoordToFloat(nscoord aCoord) {
*/
inline nscoord NSToCoordFloor(float aValue)
{
return nscoord(NS_floorf(aValue));
return nscoord(floorf(aValue));
}
inline nscoord NSToCoordFloor(double aValue)
{
return nscoord(NS_floor(aValue));
return nscoord(floor(aValue));
}
inline nscoord NSToCoordFloorClamped(float aValue)
@ -388,12 +388,12 @@ inline nscoord NSToCoordFloorClamped(float aValue)
inline nscoord NSToCoordCeil(float aValue)
{
return nscoord(NS_ceilf(aValue));
return nscoord(ceilf(aValue));
}
inline nscoord NSToCoordCeil(double aValue)
{
return nscoord(NS_ceil(aValue));
return nscoord(ceil(aValue));
}
inline nscoord NSToCoordCeilClamped(float aValue)
@ -437,12 +437,12 @@ inline nscoord NSToCoordCeilClamped(double aValue)
*/
inline PRInt32 NSToIntFloor(float aValue)
{
return PRInt32(NS_floorf(aValue));
return PRInt32(floorf(aValue));
}
inline PRInt32 NSToIntCeil(float aValue)
{
return PRInt32(NS_ceilf(aValue));
return PRInt32(ceilf(aValue));
}
inline PRInt32 NSToIntRound(float aValue)
@ -457,12 +457,12 @@ inline PRInt32 NSToIntRound(double aValue)
inline PRInt32 NSToIntRoundUp(float aValue)
{
return PRInt32(NS_floorf(aValue + 0.5f));
return PRInt32(floorf(aValue + 0.5f));
}
inline PRInt32 NSToIntRoundUp(double aValue)
{
return PRInt32(NS_floor(aValue + 0.5));
return PRInt32(floor(aValue + 0.5));
}
/*

Просмотреть файл

@ -147,7 +147,7 @@ nsFontMetrics::Destroy()
// XXXTODO get rid of this macro
#define ROUND_TO_TWIPS(x) (nscoord)floor(((x) * mP2A) + 0.5)
#define CEIL_TO_TWIPS(x) (nscoord)NS_ceil((x) * mP2A)
#define CEIL_TO_TWIPS(x) (nscoord)ceil((x) * mP2A)
const gfxFont::Metrics& nsFontMetrics::GetMetrics() const
{
@ -194,15 +194,15 @@ nsFontMetrics::GetUnderline(nscoord& aOffset, nscoord& aSize)
static gfxFloat ComputeMaxDescent(const gfxFont::Metrics& aMetrics,
gfxFontGroup* aFontGroup)
{
gfxFloat offset = NS_floor(-aFontGroup->GetUnderlineOffset() + 0.5);
gfxFloat offset = floor(-aFontGroup->GetUnderlineOffset() + 0.5);
gfxFloat size = NS_round(aMetrics.underlineSize);
gfxFloat minDescent = NS_floor(offset + size + 0.5);
gfxFloat minDescent = floor(offset + size + 0.5);
return NS_MAX(minDescent, aMetrics.maxDescent);
}
static gfxFloat ComputeMaxAscent(const gfxFont::Metrics& aMetrics)
{
return NS_floor(aMetrics.maxAscent + 0.5);
return floor(aMetrics.maxAscent + 0.5);
}
nscoord

Просмотреть файл

@ -114,7 +114,7 @@ gfxCachedTempSurface::Get(gfxASurface::gfxContentType aContentType,
PRBool cleared = PR_FALSE;
if (!mSurface) {
mSize = gfxIntSize(PRInt32(NS_ceil(aRect.width)), PRInt32(NS_ceil(aRect.height)));
mSize = gfxIntSize(PRInt32(ceil(aRect.width)), PRInt32(ceil(aRect.height)));
mSurface = aSimilarTo->CreateSimilarSurface(aContentType, mSize);
if (!mSurface)
return nsnull;

Просмотреть файл

@ -70,11 +70,11 @@ ScaleRoundDesignUnits(FT_Short aDesignMetric, FT_Fixed aScale)
static void
SnapLineToPixels(gfxFloat& aOffset, gfxFloat& aSize)
{
gfxFloat snappedSize = NS_MAX(NS_floor(aSize + 0.5), 1.0);
gfxFloat snappedSize = NS_MAX(floor(aSize + 0.5), 1.0);
// Correct offset for change in size
gfxFloat offset = aOffset - 0.5 * (aSize - snappedSize);
// Snap offset
aOffset = NS_floor(offset + 0.5);
aOffset = floor(offset + 0.5);
aSize = snappedSize;
}
@ -281,16 +281,16 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics,
// internalLeading + externalLeading, but first each of these is rounded
// to layout units. To ensure that the result is an integer number of
// pixels, round each of the components to pixels.
aMetrics->emHeight = NS_floor(emHeight + 0.5);
aMetrics->emHeight = floor(emHeight + 0.5);
// maxHeight will normally be an integer, but round anyway in case
// FreeType is configured differently.
aMetrics->internalLeading =
NS_floor(aMetrics->maxHeight - aMetrics->emHeight + 0.5);
floor(aMetrics->maxHeight - aMetrics->emHeight + 0.5);
// Text input boxes currently don't work well with lineHeight
// significantly less than maxHeight (with Verdana, for example).
lineHeight = NS_floor(NS_MAX(lineHeight, aMetrics->maxHeight) + 0.5);
lineHeight = floor(NS_MAX(lineHeight, aMetrics->maxHeight) + 0.5);
aMetrics->externalLeading =
lineHeight - aMetrics->internalLeading - aMetrics->emHeight;

Просмотреть файл

@ -1594,7 +1594,7 @@ gfxFont::SetupGlyphExtents(gfxContext *aContext, PRUint32 aGlyphID, PRBool aNeed
extents.y_bearing >= -fontMetrics.maxAscent &&
extents.height + extents.y_bearing <= fontMetrics.maxDescent) {
PRUint32 appUnitsWidth =
PRUint32(NS_ceil((extents.x_bearing + extents.width)*appUnitsPerDevUnit));
PRUint32(ceil((extents.x_bearing + extents.width)*appUnitsPerDevUnit));
if (appUnitsWidth < gfxGlyphExtents::INVALID_WIDTH) {
aExtents->SetContainedGlyphWidthAppUnits(aGlyphID, PRUint16(appUnitsWidth));
return;
@ -1713,9 +1713,9 @@ RoundToNearestMultiple(double aValue, double aFraction)
void gfxFont::CalculateDerivedMetrics(Metrics& aMetrics)
{
aMetrics.maxAscent =
NS_ceil(RoundToNearestMultiple(aMetrics.maxAscent, 1/1024.0));
ceil(RoundToNearestMultiple(aMetrics.maxAscent, 1/1024.0));
aMetrics.maxDescent =
NS_ceil(RoundToNearestMultiple(aMetrics.maxDescent, 1/1024.0));
ceil(RoundToNearestMultiple(aMetrics.maxDescent, 1/1024.0));
if (aMetrics.xHeight <= 0) {
// only happens if we couldn't find either font metrics
@ -1828,13 +1828,13 @@ gfxFont::SanitizeMetrics(gfxFont::Metrics *aMetrics, PRBool aIsBadUnderlineFont)
// If strikeout line is overflowed from the ascent, the line should be resized and moved for
// that being in the ascent space.
// Note that the strikeoutOffset is *middle* of the strikeout line position.
gfxFloat halfOfStrikeoutSize = NS_floor(aMetrics->strikeoutSize / 2.0 + 0.5);
gfxFloat halfOfStrikeoutSize = floor(aMetrics->strikeoutSize / 2.0 + 0.5);
if (halfOfStrikeoutSize + aMetrics->strikeoutOffset > aMetrics->maxAscent) {
if (aMetrics->strikeoutSize > aMetrics->maxAscent) {
aMetrics->strikeoutSize = NS_MAX(aMetrics->maxAscent, 1.0);
halfOfStrikeoutSize = NS_floor(aMetrics->strikeoutSize / 2.0 + 0.5);
halfOfStrikeoutSize = floor(aMetrics->strikeoutSize / 2.0 + 0.5);
}
gfxFloat ascent = NS_floor(aMetrics->maxAscent + 0.5);
gfxFloat ascent = floor(aMetrics->maxAscent + 0.5);
aMetrics->strikeoutOffset = NS_MAX(halfOfStrikeoutSize, ascent / 2.0);
}
@ -2544,7 +2544,7 @@ gfxFontGroup::InitScriptRun(gfxContext *aContext,
gfxFloat wid = mainFont->SynthesizeSpaceWidth(ch);
if (wid >= 0.0) {
nscoord advance =
aTextRun->GetAppUnitsPerDevUnit() * NS_floor(wid + 0.5);
aTextRun->GetAppUnitsPerDevUnit() * floor(wid + 0.5);
gfxTextRun::CompressedGlyph g;
if (gfxTextRun::CompressedGlyph::IsSimpleAdvance(advance)) {
aTextRun->SetSimpleGlyph(index,

Просмотреть файл

@ -1128,7 +1128,7 @@ gfxHarfBuzzShaper::SetGlyphsFromRun(gfxContext *aContext,
hb_position_t x_advance = posInfo[glyphStart].x_advance;
nscoord advance =
roundX ? dev2appUnits * FixedToIntRound(x_advance)
: NS_floor(hb2appUnits * x_advance + 0.5);
: floor(hb2appUnits * x_advance + 0.5);
if (glyphsInClump == 1 &&
gfxTextRun::CompressedGlyph::IsSimpleGlyphID(ginfo[glyphStart].codepoint) &&
@ -1158,18 +1158,18 @@ gfxHarfBuzzShaper::SetGlyphsFromRun(gfxContext *aContext,
hb_position_t x_offset = posInfo[glyphStart].x_offset;
details->mXOffset =
roundX ? dev2appUnits * FixedToIntRound(x_offset)
: NS_floor(hb2appUnits * x_offset + 0.5);
: floor(hb2appUnits * x_offset + 0.5);
hb_position_t y_offset = posInfo[glyphStart].y_offset;
details->mYOffset = yPos -
(roundY ? dev2appUnits * FixedToIntRound(y_offset)
: NS_floor(hb2appUnits * y_offset + 0.5));
: floor(hb2appUnits * y_offset + 0.5));
details->mAdvance = advance;
hb_position_t y_advance = posInfo[glyphStart].y_advance;
if (y_advance != 0) {
yPos -=
roundY ? dev2appUnits * FixedToIntRound(y_advance)
: NS_floor(hb2appUnits * y_advance + 0.5);
: floor(hb2appUnits * y_advance + 0.5);
}
if (++glyphStart >= glyphEnd) {
break;
@ -1177,7 +1177,7 @@ gfxHarfBuzzShaper::SetGlyphsFromRun(gfxContext *aContext,
x_advance = posInfo[glyphStart].x_advance;
advance =
roundX ? dev2appUnits * FixedToIntRound(x_advance)
: NS_floor(hb2appUnits * x_advance + 0.5);
: floor(hb2appUnits * x_advance + 0.5);
}
gfxTextRun::CompressedGlyph g;

Просмотреть файл

@ -194,8 +194,8 @@ public:
*/
PRBool HasNonIntegerTranslation() const {
return HasNonTranslation() ||
!FuzzyEqual(x0, NS_floor(x0 + 0.5)) ||
!FuzzyEqual(y0, NS_floor(y0 + 0.5));
!FuzzyEqual(x0, floor(x0 + 0.5)) ||
!FuzzyEqual(y0, floor(y0 + 0.5));
}
/**
@ -291,8 +291,8 @@ public:
* Returns true if the matrix has non-integer scale
*/
PRBool HasNonIntegerScale() const {
return !FuzzyEqual(xx, NS_floor(xx + 0.5)) ||
!FuzzyEqual(yy, NS_floor(yy + 0.5));
return !FuzzyEqual(xx, floor(xx + 0.5)) ||
!FuzzyEqual(yy, floor(yy + 0.5));
}
private:

Просмотреть файл

@ -127,11 +127,11 @@ static void FillMetricsDefaults(gfxFont::Metrics *aMetrics)
// line as close to the original position as possible.
static void SnapLineToPixels(gfxFloat& aOffset, gfxFloat& aSize)
{
gfxFloat snappedSize = NS_MAX(NS_floor(aSize + 0.5), 1.0);
gfxFloat snappedSize = NS_MAX(floor(aSize + 0.5), 1.0);
// Correct offset for change in size
gfxFloat offset = aOffset - 0.5 * (aSize - snappedSize);
// Snap offset
aOffset = NS_floor(offset + 0.5);
aOffset = floor(offset + 0.5);
aSize = snappedSize;
}
@ -155,7 +155,7 @@ const gfxFont::Metrics& gfxOS2Font::GetMetrics()
// round size to integer pixels, this is to get full pixels for layout
// together with internal/external leading (see below)
mMetrics->emHeight = NS_floor(GetStyle()->size + 0.5);
mMetrics->emHeight = floor(GetStyle()->size + 0.5);
cairo_scaled_font_t* scaledFont = CairoScaledFont();
if (!scaledFont) {
@ -274,9 +274,9 @@ const gfxFont::Metrics& gfxOS2Font::GetMetrics()
// leadings are not available directly (only for WinFNTs);
// better compute them on our own, to get integer values and make
// layout happy (see // LockedFTFace::GetMetrics in gfxPangoFonts.cpp)
mMetrics->internalLeading = NS_floor(mMetrics->maxHeight
mMetrics->internalLeading = floor(mMetrics->maxHeight
- mMetrics->emHeight + 0.5);
gfxFloat lineHeight = NS_floor(mMetrics->maxHeight + 0.5);
gfxFloat lineHeight = floor(mMetrics->maxHeight + 0.5);
mMetrics->externalLeading = lineHeight
- mMetrics->internalLeading - mMetrics->emHeight;

Просмотреть файл

@ -69,8 +69,8 @@ struct THEBES_API gfxPoint : public mozilla::gfx::BasePoint<gfxFloat, gfxPoint>
// And if you need similar method which is using NS_round(), you should
// create new |RoundAwayFromZero()| method.
gfxPoint& Round() {
x = NS_floor(x + 0.5);
y = NS_floor(y + 0.5);
x = floor(x + 0.5);
y = floor(y + 0.5);
return *this;
}
};

Просмотреть файл

@ -59,10 +59,10 @@ void
gfxRect::Round()
{
// Note that don't use NS_round here. See the comment for this method in gfxRect.h
gfxFloat x0 = NS_floor(X() + 0.5);
gfxFloat y0 = NS_floor(Y() + 0.5);
gfxFloat x1 = NS_floor(XMost() + 0.5);
gfxFloat y1 = NS_floor(YMost() + 0.5);
gfxFloat x0 = floor(X() + 0.5);
gfxFloat y0 = floor(Y() + 0.5);
gfxFloat x1 = floor(XMost() + 0.5);
gfxFloat y1 = floor(YMost() + 0.5);
x = x0;
y = y0;
@ -74,10 +74,10 @@ gfxRect::Round()
void
gfxRect::RoundIn()
{
gfxFloat x0 = NS_ceil(X());
gfxFloat y0 = NS_ceil(Y());
gfxFloat x1 = NS_floor(XMost());
gfxFloat y1 = NS_floor(YMost());
gfxFloat x0 = ceil(X());
gfxFloat y0 = ceil(Y());
gfxFloat x1 = floor(XMost());
gfxFloat y1 = floor(YMost());
x = x0;
y = y0;
@ -89,10 +89,10 @@ gfxRect::RoundIn()
void
gfxRect::RoundOut()
{
gfxFloat x0 = NS_floor(X());
gfxFloat y0 = NS_floor(Y());
gfxFloat x1 = NS_ceil(XMost());
gfxFloat y1 = NS_ceil(YMost());
gfxFloat x0 = floor(X());
gfxFloat y0 = floor(Y());
gfxFloat x1 = ceil(XMost());
gfxFloat y1 = ceil(YMost());
x = x0;
y = y0;

Просмотреть файл

@ -489,7 +489,7 @@ gfxUtils::ClampToScaleFactor(gfxFloat aVal)
if (fabs(power - NS_round(power)) < 1e-6) {
power = NS_round(power);
} else {
power = NS_ceil(power);
power = ceil(power);
}
return pow(kScaleResolution, power);

Просмотреть файл

@ -138,8 +138,8 @@ gfxWindowsNativeDrawing::BeginNativeDrawing()
// There's probably a better fix, but I haven't figured out
// the root cause of the problem.
mTempSurfaceSize =
gfxIntSize((PRInt32) NS_ceil(mNativeRect.Width() + 1),
(PRInt32) NS_ceil(mNativeRect.Height() + 1));
gfxIntSize((PRInt32) ceil(mNativeRect.Width() + 1),
(PRInt32) ceil(mNativeRect.Height() + 1));
} else {
// figure out the scale factors
mScale = m.ScaleFactors(PR_TRUE);
@ -153,8 +153,8 @@ gfxWindowsNativeDrawing::BeginNativeDrawing()
// See comment above about "+1"
mTempSurfaceSize =
gfxIntSize((PRInt32) NS_ceil(mNativeRect.Width() * mScale.width + 1),
(PRInt32) NS_ceil(mNativeRect.Height() * mScale.height + 1));
gfxIntSize((PRInt32) ceil(mNativeRect.Width() * mScale.width + 1),
(PRInt32) ceil(mNativeRect.Height() * mScale.height + 1));
}
}
}

Просмотреть файл

@ -1943,7 +1943,7 @@ static nscoord
FindTileStart(nscoord aDirtyCoord, nscoord aTilePos, nscoord aTileDim)
{
NS_ASSERTION(aTileDim > 0, "Non-positive tile dimension");
double multiples = NS_floor(double(aDirtyCoord - aTilePos)/aTileDim);
double multiples = floor(double(aDirtyCoord - aTilePos)/aTileDim);
return NSToCoordRound(multiples*aTileDim + aTilePos);
}
@ -2050,7 +2050,7 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
// try to do anything in that case. We certainly need to avoid
// dividing by zero.
if (stopDelta >= 1e-6) {
double instanceCount = NS_ceil(-firstStop/stopDelta);
double instanceCount = ceil(-firstStop/stopDelta);
// Advance stops by instanceCount multiples of the period of the
// repeating gradient.
double offset = instanceCount*stopDelta;
@ -3607,15 +3607,15 @@ nsCSSRendering::GetTextDecorationRectInternal(const gfxPoint& aPt,
PRBool canLiftUnderline = aDescentLimit >= 0.0;
const gfxFloat left = NS_floor(aPt.x + 0.5),
right = NS_floor(aPt.x + aLineSize.width + 0.5);
const gfxFloat left = floor(aPt.x + 0.5),
right = floor(aPt.x + aLineSize.width + 0.5);
gfxRect r(left, 0, right - left, 0);
gfxFloat lineHeight = NS_round(aLineSize.height);
lineHeight = NS_MAX(lineHeight, 1.0);
gfxFloat ascent = NS_round(aAscent);
gfxFloat descentLimit = NS_floor(aDescentLimit);
gfxFloat descentLimit = floor(aDescentLimit);
gfxFloat suggestedMaxRectHeight = NS_MAX(NS_MIN(ascent, descentLimit), 1.0);
r.height = lineHeight;
@ -3671,7 +3671,7 @@ nsCSSRendering::GetTextDecorationRectInternal(const gfxPoint& aPt,
}
}
gfxFloat baseline = NS_floor(aPt.y + aAscent + 0.5);
gfxFloat baseline = floor(aPt.y + aAscent + 0.5);
gfxFloat offset = 0.0;
switch (aDecoration) {
case NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE:
@ -3692,7 +3692,7 @@ nsCSSRendering::GetTextDecorationRectInternal(const gfxPoint& aPt,
offset = aOffset - lineHeight + r.Height();
break;
case NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH: {
gfxFloat extra = NS_floor(r.Height() / 2.0 + 0.5);
gfxFloat extra = floor(r.Height() / 2.0 + 0.5);
extra = NS_MAX(extra, lineHeight);
offset = aOffset - lineHeight + extra;
break;
@ -3700,7 +3700,7 @@ nsCSSRendering::GetTextDecorationRectInternal(const gfxPoint& aPt,
default:
NS_ERROR("Invalid decoration value!");
}
r.y = baseline - NS_floor(offset + 0.5);
r.y = baseline - floor(offset + 0.5);
return r;
}

Просмотреть файл

@ -2767,7 +2767,7 @@ AdvanceToNextTab(gfxFloat aX, nsIFrame* aFrame,
// Advance aX to the next multiple of *aCachedTabWidth. We must advance
// by at least 1 appunit.
// XXX should we make this 1 CSS pixel?
return NS_ceil((aX + 1)/(*aCachedTabWidth))*(*aCachedTabWidth);
return ceil((aX + 1)/(*aCachedTabWidth))*(*aCachedTabWidth);
}
void
@ -4518,7 +4518,7 @@ ComputeSelectionUnderlineHeight(nsPresContext* aPresContext,
gfxFloat fontSize = NS_MIN(gfxFloat(defaultFontSize),
aFontMetrics.emHeight);
fontSize = NS_MAX(fontSize, 1.0);
return NS_ceil(fontSize / 20);
return ceil(fontSize / 20);
}
default:
NS_WARNING("Requested underline style is not valid");

Просмотреть файл

@ -319,8 +319,8 @@ static nscoord CalcLengthWith(const nsCSSValue& aValue,
gfxFloat zeroWidth = (fm->GetThebesFontGroup()->GetFontAt(0)
->GetMetrics().zeroOrAveCharWidth);
return ScaleCoord(aValue, NS_ceil(aPresContext->AppUnitsPerDevPixel() *
zeroWidth));
return ScaleCoord(aValue, ceil(aPresContext->AppUnitsPerDevPixel() *
zeroWidth));
}
// For properties for which lengths are the *only* units accepted in
// calc(), we can handle calc() here and just compute a final

Просмотреть файл

@ -1384,8 +1384,8 @@ nsStyleAnimation::AddWeighted(nsCSSProperty aProperty,
switch (aProperty) {
case eCSSProperty_font_stretch: {
// Animate just like eUnit_Integer.
PRInt32 result = NS_floor(aCoeff1 * double(aValue1.GetIntValue()) +
aCoeff2 * double(aValue2.GetIntValue()));
PRInt32 result = floor(aCoeff1 * double(aValue1.GetIntValue()) +
aCoeff2 * double(aValue2.GetIntValue()));
if (result < NS_STYLE_FONT_STRETCH_ULTRA_CONDENSED) {
result = NS_STYLE_FONT_STRETCH_ULTRA_CONDENSED;
} else if (result > NS_STYLE_FONT_STRETCH_ULTRA_EXPANDED) {
@ -1409,8 +1409,8 @@ nsStyleAnimation::AddWeighted(nsCSSProperty aProperty,
case eUnit_Integer: {
// http://dev.w3.org/csswg/css3-transitions/#animation-of-property-types-
// says we should use floor
PRInt32 result = NS_floor(aCoeff1 * double(aValue1.GetIntValue()) +
aCoeff2 * double(aValue2.GetIntValue()));
PRInt32 result = floor(aCoeff1 * double(aValue1.GetIntValue()) +
aCoeff2 * double(aValue2.GetIntValue()));
if (aProperty == eCSSProperty_font_weight) {
if (result < 100) {
result = 100;

Просмотреть файл

@ -590,9 +590,9 @@ namespace places {
}
else {
// Estimate frecency using the last few visits.
// Use NS_ceilf() so that we don't round down to 0, which
// Use ceilf() so that we don't round down to 0, which
// would cause us to completely ignore the place during autocomplete.
NS_ADDREF(*_result = new IntegerVariant((PRInt32) NS_ceilf(fullVisitCount * NS_ceilf(pointsForSampledVisits) / numSampledVisits)));
NS_ADDREF(*_result = new IntegerVariant((PRInt32) ceilf(fullVisitCount * ceilf(pointsForSampledVisits) / numSampledVisits)));
}
return NS_OK;
@ -625,9 +625,9 @@ namespace places {
// Assume "now" as our ageInDays, so use the first bucket.
pointsForSampledVisits = history->GetFrecencyBucketWeight(1) * (bonus / (float)100.0);
// use NS_ceilf() so that we don't round down to 0, which
// use ceilf() so that we don't round down to 0, which
// would cause us to completely ignore the place during autocomplete
NS_ADDREF(*_result = new IntegerVariant((PRInt32) NS_ceilf(fullVisitCount * NS_ceilf(pointsForSampledVisits))));
NS_ADDREF(*_result = new IntegerVariant((PRInt32) ceilf(fullVisitCount * ceilf(pointsForSampledVisits))));
return NS_OK;
}

Просмотреть файл

@ -177,7 +177,7 @@ static const PRInt64 USECS_PER_DAY = LL_INIT(20, 500654080);
// long, but we split only the last 6 months.
#define HISTORY_DATE_CONT_NUM(_daysFromOldestVisit) \
(HISTORY_ADDITIONAL_DATE_CONT_NUM + \
NS_MIN(6, (PRInt32)NS_ceilf((float)_daysFromOldestVisit/30)))
NS_MIN(6, (PRInt32)ceilf((float)_daysFromOldestVisit/30)))
// Max number of containers, used to initialize the params hash.
#define HISTORY_DATE_CONT_MAX 10

Просмотреть файл

@ -6359,7 +6359,7 @@ nsWindow::ResetRemainingWheelDelta()
static PRInt32 RoundDelta(double aDelta)
{
return aDelta >= 0 ? (PRInt32)NS_floor(aDelta) : (PRInt32)NS_ceil(aDelta);
return aDelta >= 0 ? (PRInt32)floor(aDelta) : (PRInt32)ceil(aDelta);
}
/**

Просмотреть файл

@ -105,30 +105,6 @@ inline NS_HIDDEN_(PRInt32) NS_lroundf(float x)
return x >= 0.0f ? PRInt32(x + 0.5f) : PRInt32(x - 0.5f);
}
/*
* ceil
*/
inline NS_HIDDEN_(double) NS_ceil(double x)
{
return ceil(x);
}
inline NS_HIDDEN_(float) NS_ceilf(float x)
{
return ceilf(x);
}
/*
* floor
*/
inline NS_HIDDEN_(double) NS_floor(double x)
{
return floor(x);
}
inline NS_HIDDEN_(float) NS_floorf(float x)
{
return floorf(x);
}
/*
* hypot. We don't need a super accurate version of this, if a platform
* turns up with none of the possibilities below it would be okay to fall